mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Updated CreateRelease.cs
This commit is contained in:
parent
ee833626c9
commit
fc6a6e08e8
6
.github/CreateRelease.cs
vendored
6
.github/CreateRelease.cs
vendored
@ -8,14 +8,14 @@
|
||||
string text = File.ReadAllText(path);
|
||||
|
||||
// Find the whole line of the first define ending with "MIRROR_n_OR_NEWER,"
|
||||
string pattern = @"\s+\""(MIRROR_(\d+)_OR_NEWER)\""\,\r\n";
|
||||
string pattern = @"\s+\""(MIRROR_(\d+)_OR_NEWER)\""\,\n";
|
||||
Match match = Regex.Matches(text, pattern).First();
|
||||
|
||||
// Remove the first define
|
||||
text = text.Replace(match.Value, "");
|
||||
|
||||
// Find the highest version number entry, not having a comma at the end
|
||||
pattern = @"\""(MIRROR_(\d+)_OR_NEWER)\""\r\n";
|
||||
pattern = @"\""(MIRROR_(\d+)_OR_NEWER)\""\n";
|
||||
MatchCollection matches = Regex.Matches(text, pattern);
|
||||
int maxVersion = matches.Max(m => int.Parse(m.Groups[2].Value));
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
string newDefine = $"MIRROR_{maxVersion + 1}_OR_NEWER";
|
||||
|
||||
// Add the new define to the end of the hashset entries, with a comma after the previous entry and properly indented
|
||||
text = text.Insert(lastMatch.Index + lastMatch.Length, $",\r\n{match.Groups[1].Value}\"{newDefine}\"");
|
||||
text = text.Insert(lastMatch.Index + lastMatch.Length, $",\n{match.Groups[1].Value}\"{newDefine}\"");
|
||||
|
||||
File.WriteAllText(path, text);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user