mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Updated ModPreprocessorDefine.csx
This commit is contained in:
parent
08aa2a9167
commit
5ae11f2cc7
7
.github/ModPreprocessorDefine.csx
vendored
7
.github/ModPreprocessorDefine.csx
vendored
@ -8,6 +8,7 @@ using System.Text.RegularExpressions;
|
||||
void Main()
|
||||
{
|
||||
Console.WriteLine("ModPreprocessorDefine Started");
|
||||
Console.Out.Flush();
|
||||
|
||||
// Redirect console output to a file
|
||||
var originalConsoleOut = Console.Out;
|
||||
@ -23,6 +24,7 @@ void Main()
|
||||
// Print some debug information
|
||||
Console.WriteLine($"Working Directory: {Environment.CurrentDirectory}");
|
||||
Console.WriteLine($"Output File Path: {outputPath}");
|
||||
Console.Out.Flush();
|
||||
|
||||
// Define the path to the PreprocessorDefine.cs file
|
||||
string filePath = "Assets/Mirror/CompilerSymbols/PreprocessorDefine.cs";
|
||||
@ -30,18 +32,22 @@ void Main()
|
||||
// Read the contents of the file
|
||||
string fileContents = File.ReadAllText(filePath);
|
||||
Console.WriteLine("ModPreprocessorDefine File read");
|
||||
Console.Out.Flush();
|
||||
|
||||
// Find and remove the first entry ending with "_OR_NEWER"
|
||||
fileContents = RemoveFirstOrNewerEntry(fileContents);
|
||||
Console.WriteLine("ModPreprocessorDefine Old entry removed");
|
||||
Console.Out.Flush();
|
||||
|
||||
// Find the last entry and capture the version number
|
||||
string versionNumber = GetLastVersionNumber(fileContents);
|
||||
Console.WriteLine($"ModPreprocessorDefine current version {versionNumber}");
|
||||
Console.Out.Flush();
|
||||
|
||||
// Append a new entry with the correct indentation and next version number
|
||||
fileContents = AppendNewEntry(fileContents, versionNumber);
|
||||
Console.WriteLine("ModPreprocessorDefine New entry appended");
|
||||
Console.Out.Flush();
|
||||
|
||||
// Write the modified contents back to the file
|
||||
File.WriteAllText(filePath, fileContents);
|
||||
@ -54,6 +60,7 @@ void Main()
|
||||
// Print the contents of the redirected file
|
||||
Console.WriteLine("Console Output:");
|
||||
Console.WriteLine(File.ReadAllText("console_output.txt"));
|
||||
Console.Out.Flush();
|
||||
}
|
||||
|
||||
string RemoveFirstOrNewerEntry(string input)
|
||||
|
Loading…
Reference in New Issue
Block a user