Skip to content

Commit b1d1bdc

Browse files
committed
Fix version creation
1 parent c504592 commit b1d1bdc

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

src/UnturnedRedistUpdateTool/Program.cs

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,16 @@ private static async Task<int> Main(string[] args)
114114
var combinedHash = CreateCombinedHash(manifests);
115115
Console.WriteLine($"Combined hash of updated files: {combinedHash}");
116116
Console.WriteLine($"Old Combined hash of updated files: {versionInfo?.FilesHash}");
117-
var versionToUse = DetermineVersionToUse(newVersion, newBuildId, currentNuspecVersion, versionInfo, combinedHash, preview);
117+
118+
if (versionInfo?.FilesHash == combinedHash)
119+
{
120+
Console.WriteLine("Files haven't changed, keeping current version");
121+
return 0;
122+
}
123+
Console.WriteLine("Files are different now!");
124+
var versionToUse = preview
125+
? $"{newVersion}-preview{newBuildId}"
126+
: newVersion;
118127
Console.WriteLine($"New Version: {newVersion}");
119128
Console.WriteLine($"New Build Id: {newBuildId}");
120129
Console.WriteLine($"Version to use: {versionToUse}");
@@ -178,23 +187,4 @@ private static string CreateCombinedHash(Dictionary<string, string> manifests)
178187
}
179188
return Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(combinedData.ToString())));
180189
}
181-
182-
private static string DetermineVersionToUse(string gameVersion, string buildId, string currentNuspecVersion,
183-
VersionInfo? versionInfo, string newFilesHash, bool preview)
184-
{
185-
if (versionInfo?.FilesHash == newFilesHash)
186-
{
187-
Console.WriteLine("Files haven't changed, keeping current version");
188-
return currentNuspecVersion;
189-
}
190-
if (versionInfo?.GameVersion != gameVersion)
191-
{
192-
Console.WriteLine("Game version changed, using new game version");
193-
return gameVersion;
194-
}
195-
Console.WriteLine("Same game version but files changed");
196-
return preview
197-
? $"{gameVersion}-preview{buildId}"
198-
: gameVersion;
199-
}
200190
}

0 commit comments

Comments
 (0)