Server Version Changes

This commit is contained in:
Brett Hewitson 2021-06-06 18:49:08 +10:00
parent 0a90a0cfec
commit ae55d0d1c0
8 changed files with 117 additions and 4 deletions

View file

@ -1244,7 +1244,14 @@ namespace ServerManagerTool.Lib
LogProfileMessage("Validated server files (*new*).");
}
LogProfileMessage("Updated server from cache. See ARK patch notes.");
// update the version number
_profile.LastInstalledVersion = GetServerVersion(GetServerVersionFile()).ToString();
_profile.ServerUpdated = true;
LogProfileMessage("Updated server from cache.");
LogProfileMessage($"Server version: {_profile.LastInstalledVersion}.");
LogProfileMessage("See ARK patch notes.");
LogProfileMessage(Config.Default.ArkSE_PatchNotesUrl);
if (!string.IsNullOrWhiteSpace(Config.Default.Alert_ServerUpdate))
@ -1253,8 +1260,6 @@ namespace ServerManagerTool.Lib
emailMessage.AppendLine();
emailMessage.AppendLine("Updated server from cache. See ARK patch notes.");
emailMessage.AppendLine(Config.Default.ArkSE_PatchNotesUrl);
_profile.ServerUpdated = true;
}
else
{
@ -1747,6 +1752,9 @@ namespace ServerManagerTool.Lib
}
else
LogBranchMessage(branchName, "No new version.");
var cacheVersion = GetServerVersion(GetServerCacheVersionFile(branchName)).ToString();
LogMessage($"Server cache version: {cacheVersion}");
}
else
LogBranchMessage(branchName, $"Server cache does not exist.");
@ -2271,6 +2279,8 @@ namespace ServerManagerTool.Lib
private static string GetServerCacheTimeFile(string branchName) => IOUtils.NormalizePath(Path.Combine(GetServerCacheFolder(branchName), Config.Default.LastUpdatedTimeFile));
private static string GetServerCacheVersionFile(string branchName) => IOUtils.NormalizePath(Path.Combine(GetServerCacheFolder(branchName), Config.Default.VersionFile));
private string GetServerExecutableFile() => IOUtils.NormalizePath(Path.Combine(_profile.InstallDirectory, Config.Default.ServerBinaryRelativePath, Config.Default.ServerExe));
private DateTime GetServerLatestTime(string timeFile)
@ -2313,6 +2323,28 @@ namespace ServerManagerTool.Lib
private string GetServerSaveFolder() => IOUtils.NormalizePath(ServerProfile.GetProfileSavePath(_profile.InstallDirectory, _profile.AltSaveDirectoryName, _profile.PGM_Enabled, _profile.PGM_Name));
private string GetServerVersionFile() => IOUtils.NormalizePath(Path.Combine(_profile.InstallDirectory, Config.Default.VersionFile));
public static Version GetServerVersion(string versionFile)
{
if (!string.IsNullOrWhiteSpace(versionFile) && File.Exists(versionFile))
{
var fileValue = File.ReadAllText(versionFile);
if (!string.IsNullOrWhiteSpace(fileValue))
{
string versionString = fileValue.ToString();
if (versionString.IndexOf('.') == -1)
versionString = versionString + ".0";
if (Version.TryParse(versionString, out Version version))
return version;
}
}
return new Version(0, 0);
}
private string GetServerWorldFile()
{
var profileSaveFolder = GetServerSaveFolder();

View file

@ -5052,6 +5052,7 @@ namespace ServerManagerTool.Lib
this.ClearValue(EnableAllowCaveFlyersProperty);
this.ClearValue(AllowFlyingStaminaRecoveryProperty);
this.ClearValue(AllowFlyerSpeedLevelingProperty);
this.ClearValue(PreventMateBoostProperty);
this.ClearValue(DisableDinoDecayPvEProperty);
@ -5300,6 +5301,7 @@ namespace ServerManagerTool.Lib
this.ClearValue(AllowTekSuitPowersInGenesisProperty);
this.ClearValue(DisableGenesisMissionsProperty);
this.ClearValue(DisableDefaultMapItemSetsProperty);
this.ClearValue(EnableCryoSicknessPVEProperty);
this.ClearValue(EnableCryopodNerfProperty);
@ -5308,7 +5310,10 @@ namespace ServerManagerTool.Lib
this.ClearValue(CryopodNerfIncomingDamageMultiplierPercentProperty);
this.ClearValue(MaxHexagonsPerCharacterProperty);
this.ClearValue(DisableHexagonStoreProperty);
this.ClearValue(HexStoreAllowOnlyEngramTradeOptionProperty);
this.ClearValue(HexagonRewardMultiplierProperty);
this.ClearValue(HexagonCostMultiplierProperty);
}
public void ResetSOTFSection()
@ -5650,6 +5655,8 @@ namespace ServerManagerTool.Lib
this.SetValue(EnableAllowCaveFlyersProperty, sourceProfile.EnableAllowCaveFlyers);
this.SetValue(AllowFlyingStaminaRecoveryProperty, sourceProfile.AllowFlyingStaminaRecovery);
this.SetValue(AllowFlyerSpeedLevelingProperty, sourceProfile.AllowFlyerSpeedLeveling);
this.SetValue(PreventMateBoostProperty, sourceProfile.PreventMateBoost);
this.SetValue(DisableDinoDecayPvEProperty, sourceProfile.DisableDinoDecayPvE);
this.SetValue(DisableDinoDecayPvPProperty, sourceProfile.DisableDinoDecayPvP);
@ -5959,7 +5966,10 @@ namespace ServerManagerTool.Lib
this.SetValue(CryopodNerfIncomingDamageMultiplierPercentProperty, sourceProfile.CryopodNerfIncomingDamageMultiplierPercent);
this.SetValue(MaxHexagonsPerCharacterProperty, sourceProfile.MaxHexagonsPerCharacter);
this.SetValue(DisableHexagonStoreProperty, sourceProfile.DisableHexagonStore);
this.SetValue(HexStoreAllowOnlyEngramTradeOptionProperty, sourceProfile.HexStoreAllowOnlyEngramTradeOption);
this.SetValue(HexagonRewardMultiplierProperty, sourceProfile.HexagonRewardMultiplier);
this.SetValue(HexagonCostMultiplierProperty, sourceProfile.HexagonCostMultiplier);
}
private void SyncServerFiles(ServerProfile sourceProfile)

View file

@ -619,6 +619,12 @@ namespace ServerManagerTool.Lib
gotNewVersion = ServerApp.HasNewServerVersion(this.ProfileSnapshot.InstallDirectory, startTime);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} New server version - {gotNewVersion.ToString().ToUpperInvariant()}.");
// update the version number of the server.
var versionFile = Path.Combine(this.ProfileSnapshot.InstallDirectory, Config.Default.VersionFile);
this.Version = ServerApp.GetServerVersion(versionFile);
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server version: {this.Version}\r\n");
}
progressCallback?.Invoke(0, "\r\n");