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

@ -341,6 +341,9 @@
<setting name="ServerEngineConfigFile" serializeAs="String">
<value>Engine.ini</value>
</setting>
<setting name="VersionFile" serializeAs="String">
<value>version.txt</value>
</setting>
</ServerManagerTool.Config>
<ServerManagerTool.Common.CommonConfig>
<setting name="DefaultSteamAPIKey" serializeAs="String">

View file

@ -12,7 +12,7 @@ namespace ServerManagerTool {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
public sealed partial class Config : global::System.Configuration.ApplicationSettingsBase {
private static Config defaultInstance = ((Config)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Config())));
@ -2530,5 +2530,14 @@ namespace ServerManagerTool {
this["ManagePublicIPAutomatically"] = value;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("version.txt")]
public string VersionFile {
get {
return ((string)(this["VersionFile"]));
}
}
}
}

View file

@ -707,5 +707,8 @@
<Setting Name="ManagePublicIPAutomatically" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="VersionFile" Type="System.String" Scope="Application">
<Value Profile="(Default)">version.txt</Value>
</Setting>
</Settings>
</SettingsFile>

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");

View file

@ -72,6 +72,7 @@ namespace ServerManagerTool
DinoTamedPerLevelStatMultipliers,
DinoTamedAddPerLevelStatMultipliers,
DinoTamedAffinityPerLevelStatMultipliers,
ItemStatClamps,
RCONWindowExtents,
ServerOptions,
ServerLogOptions,
@ -3991,6 +3992,9 @@ namespace ServerManagerTool
this.Settings.PerLevelStatsMultiplier_DinoTamed_Affinity.Reset();
break;
case ServerSettingsResetAction.ItemStatClamps:
break;
case ServerSettingsResetAction.RCONWindowExtents:
this.Settings.ResetRCONWindowExtents();
break;