mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Server File Changes
- added Testlive server option - changed code to use different appids.
This commit is contained in:
parent
96ba2c3474
commit
a20354c1b1
32 changed files with 969 additions and 812 deletions
|
|
@ -71,9 +71,6 @@
|
|||
<setting name="ProfileExtension" serializeAs="String">
|
||||
<value>.profile</value>
|
||||
</setting>
|
||||
<setting name="DefaultDataDir" serializeAs="String">
|
||||
<value>Ark Server Manager</value>
|
||||
</setting>
|
||||
<setting name="ServerProcessName" serializeAs="String">
|
||||
<value>ShooterGameServer</value>
|
||||
</setting>
|
||||
|
|
@ -110,12 +107,6 @@
|
|||
<setting name="AppPatchNotesUrlSotF" serializeAs="String">
|
||||
<value>https://survivetheark.com/index.php?/forums/forum/9-changelog-patch-notes/</value>
|
||||
</setting>
|
||||
<setting name="AppUrl" serializeAs="String">
|
||||
<value>https://store.steampowered.com/app/346110/</value>
|
||||
</setting>
|
||||
<setting name="AppUrl_SotF" serializeAs="String">
|
||||
<value>https://store.steampowered.com/app/407530/</value>
|
||||
</setting>
|
||||
<setting name="LastUpdatedTimeFile" serializeAs="String">
|
||||
<value>LastUpdatedASM.txt</value>
|
||||
</setting>
|
||||
|
|
@ -126,7 +117,7 @@
|
|||
<value>+login {0} +workshop_download_item {1} {2} +quit</value>
|
||||
</setting>
|
||||
<setting name="AppSteamWorkshopFolderRelativePath" serializeAs="String">
|
||||
<value>steamapps\workshop\content\346110\</value>
|
||||
<value>steamapps\workshop\content\{0}\</value>
|
||||
</setting>
|
||||
<setting name="ServerModsRelativePath" serializeAs="String">
|
||||
<value>ShooterGame\Content\Mods</value>
|
||||
|
|
@ -138,7 +129,7 @@
|
|||
<value>ShooterGame\Saved</value>
|
||||
</setting>
|
||||
<setting name="WorkshopCacheFile" serializeAs="String">
|
||||
<value>workshopcache_346110.json</value>
|
||||
<value>workshopcache_{0}.json</value>
|
||||
</setting>
|
||||
<setting name="SteamCmd_AnonymousUsername" serializeAs="String">
|
||||
<value>anonymous</value>
|
||||
|
|
@ -150,16 +141,7 @@
|
|||
<value>steamapps\workshop</value>
|
||||
</setting>
|
||||
<setting name="AppSteamWorkshopFile" serializeAs="String">
|
||||
<value>appworkshop_346110.acf</value>
|
||||
</setting>
|
||||
<setting name="AppSteamWorkshopFile_SotF" serializeAs="String">
|
||||
<value>appworkshop_407530.acf</value>
|
||||
</setting>
|
||||
<setting name="AppSteamWorkshopFolderRelativePath_SotF" serializeAs="String">
|
||||
<value>steamapps\workshop\content\407530\</value>
|
||||
</setting>
|
||||
<setting name="WorkshopCacheFile_SotF" serializeAs="String">
|
||||
<value>workshopcache_407530.json</value>
|
||||
<value>appworkshop_{0}.acf</value>
|
||||
</setting>
|
||||
<setting name="AppId" serializeAs="String">
|
||||
<value>346110</value>
|
||||
|
|
@ -303,10 +285,7 @@
|
|||
<value>__</value>
|
||||
</setting>
|
||||
<setting name="AppSteamManifestFile" serializeAs="String">
|
||||
<value>appmanifest_376030.acf</value>
|
||||
</setting>
|
||||
<setting name="AppSteamManifestFile_SotF" serializeAs="String">
|
||||
<value>appmanifest_407530.acf</value>
|
||||
<value>appmanifest_{0}.acf</value>
|
||||
</setting>
|
||||
<setting name="SteamManifestFolderRelativePath" serializeAs="String">
|
||||
<value>steamapps</value>
|
||||
|
|
|
|||
71
src/ARKServerManager/Config.Designer.cs
generated
71
src/ARKServerManager/Config.Designer.cs
generated
|
|
@ -191,15 +191,6 @@ namespace ServerManagerTool {
|
|||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Ark Server Manager")]
|
||||
public string DefaultDataDir {
|
||||
get {
|
||||
return ((string)(this["DefaultDataDir"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("ShooterGameServer")]
|
||||
|
|
@ -585,24 +576,6 @@ namespace ServerManagerTool {
|
|||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://store.steampowered.com/app/346110/")]
|
||||
public string AppUrl {
|
||||
get {
|
||||
return ((string)(this["AppUrl"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://store.steampowered.com/app/407530/")]
|
||||
public string AppUrl_SotF {
|
||||
get {
|
||||
return ((string)(this["AppUrl_SotF"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
|
|
@ -742,7 +715,7 @@ namespace ServerManagerTool {
|
|||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("steamapps\\workshop\\content\\346110\\")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("steamapps\\workshop\\content\\{0}\\")]
|
||||
public string AppSteamWorkshopFolderRelativePath {
|
||||
get {
|
||||
return ((string)(this["AppSteamWorkshopFolderRelativePath"]));
|
||||
|
|
@ -862,7 +835,7 @@ namespace ServerManagerTool {
|
|||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("workshopcache_346110.json")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("workshopcache_{0}.json")]
|
||||
public string WorkshopCacheFile {
|
||||
get {
|
||||
return ((string)(this["WorkshopCacheFile"]));
|
||||
|
|
@ -1042,7 +1015,7 @@ namespace ServerManagerTool {
|
|||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("appworkshop_346110.acf")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("appworkshop_{0}.acf")]
|
||||
public string AppSteamWorkshopFile {
|
||||
get {
|
||||
return ((string)(this["AppSteamWorkshopFile"]));
|
||||
|
|
@ -1109,33 +1082,6 @@ namespace ServerManagerTool {
|
|||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("appworkshop_407530.acf")]
|
||||
public string AppSteamWorkshopFile_SotF {
|
||||
get {
|
||||
return ((string)(this["AppSteamWorkshopFile_SotF"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("steamapps\\workshop\\content\\407530\\")]
|
||||
public string AppSteamWorkshopFolderRelativePath_SotF {
|
||||
get {
|
||||
return ((string)(this["AppSteamWorkshopFolderRelativePath_SotF"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("workshopcache_407530.json")]
|
||||
public string WorkshopCacheFile_SotF {
|
||||
get {
|
||||
return ((string)(this["WorkshopCacheFile_SotF"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("346110")]
|
||||
|
|
@ -2086,22 +2032,13 @@ namespace ServerManagerTool {
|
|||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("appmanifest_376030.acf")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("appmanifest_{0}.acf")]
|
||||
public string AppSteamManifestFile {
|
||||
get {
|
||||
return ((string)(this["AppSteamManifestFile"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("appmanifest_407530.acf")]
|
||||
public string AppSteamManifestFile_SotF {
|
||||
get {
|
||||
return ((string)(this["AppSteamManifestFile_SotF"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("steamapps")]
|
||||
|
|
|
|||
|
|
@ -56,9 +56,6 @@
|
|||
<Setting Name="DataDir" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="DefaultDataDir" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Ark Server Manager</Value>
|
||||
</Setting>
|
||||
<Setting Name="ServerProcessName" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">ShooterGameServer</Value>
|
||||
</Setting>
|
||||
|
|
@ -164,12 +161,6 @@
|
|||
<Setting Name="AppPatchNotesUrlSotF" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">https://survivetheark.com/index.php?/forums/forum/9-changelog-patch-notes/</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppUrl" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">https://store.steampowered.com/app/346110/</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppUrl_SotF" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">https://store.steampowered.com/app/407530/</Value>
|
||||
</Setting>
|
||||
<Setting Name="RunAsAdministratorPrompt" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
|
|
@ -207,7 +198,7 @@
|
|||
<Value Profile="(Default)">+login {0} +workshop_download_item {1} {2} +quit</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppSteamWorkshopFolderRelativePath" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">steamapps\workshop\content\346110\</Value>
|
||||
<Value Profile="(Default)">steamapps\workshop\content\{0}\</Value>
|
||||
</Setting>
|
||||
<Setting Name="ServerModsRelativePath" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">ShooterGame\Content\Mods</Value>
|
||||
|
|
@ -240,7 +231,7 @@
|
|||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="WorkshopCacheFile" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">workshopcache_346110.json</Value>
|
||||
<Value Profile="(Default)">workshopcache_{0}.json</Value>
|
||||
</Setting>
|
||||
<Setting Name="Email_Host" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
|
|
@ -288,7 +279,7 @@
|
|||
<Value Profile="(Default)">steamapps\workshop</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppSteamWorkshopFile" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">appworkshop_346110.acf</Value>
|
||||
<Value Profile="(Default)">appworkshop_{0}.acf</Value>
|
||||
</Setting>
|
||||
<Setting Name="SteamCmd_Password" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
|
|
@ -305,15 +296,6 @@
|
|||
<Setting Name="ServerUpdate_OnServerStart" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppSteamWorkshopFile_SotF" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">appworkshop_407530.acf</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppSteamWorkshopFolderRelativePath_SotF" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">steamapps\workshop\content\407530\</Value>
|
||||
</Setting>
|
||||
<Setting Name="WorkshopCacheFile_SotF" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">workshopcache_407530.json</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppId" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">346110</Value>
|
||||
</Setting>
|
||||
|
|
@ -585,10 +567,7 @@
|
|||
<Value Profile="(Default)">__</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppSteamManifestFile" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">appmanifest_376030.acf</Value>
|
||||
</Setting>
|
||||
<Setting Name="AppSteamManifestFile_SotF" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">appmanifest_407530.acf</Value>
|
||||
<Value Profile="(Default)">appmanifest_{0}.acf</Value>
|
||||
</Setting>
|
||||
<Setting Name="SteamManifestFolderRelativePath" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">steamapps</Value>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ namespace ServerManagerTool.Lib
|
|||
{
|
||||
}
|
||||
|
||||
public string AppIdServer = string.Empty;
|
||||
public string BranchName = string.Empty;
|
||||
public string BranchPassword = string.Empty;
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ namespace ServerManagerTool.Lib
|
|||
{
|
||||
return new BranchSnapshot
|
||||
{
|
||||
AppIdServer = profile.SOTF_Enabled ? Config.Default.AppIdServer_SotF : string.Empty,
|
||||
BranchName = profile.BranchName,
|
||||
BranchPassword = profile.BranchPassword
|
||||
};
|
||||
|
|
@ -25,6 +27,7 @@ namespace ServerManagerTool.Lib
|
|||
{
|
||||
return new BranchSnapshot
|
||||
{
|
||||
AppIdServer = profile.AppIdServer,
|
||||
BranchName = profile.BranchName,
|
||||
BranchPassword = profile.BranchPassword
|
||||
};
|
||||
|
|
@ -42,17 +45,20 @@ namespace ServerManagerTool.Lib
|
|||
if (x is null || y is null)
|
||||
return false;
|
||||
|
||||
//Check whether the snapshot' properties are equal.
|
||||
return string.Equals(x.BranchName ?? string.Empty, y.BranchName ?? string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
//Check whether the snapshot properties are equal.
|
||||
var result = string.Equals(x.AppIdServer ?? string.Empty, y.AppIdServer ?? string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
return result && string.Equals(x.BranchName ?? string.Empty, y.BranchName ?? string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public int GetHashCode(BranchSnapshot snapshot)
|
||||
{
|
||||
//Check whether the object is null
|
||||
if (snapshot is null) return 0;
|
||||
if (snapshot is null)
|
||||
return 0;
|
||||
|
||||
//Get hash code for the Name field if it is not null.
|
||||
return snapshot.BranchName == null ? 0 : snapshot.BranchName.GetHashCode();
|
||||
var result = $"{snapshot.AppIdServer ?? ""}-{snapshot.BranchName ?? ""}";
|
||||
return result.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -830,7 +830,7 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
}
|
||||
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallServerArgsFormat, Config.Default.SteamCmd_AnonymousUsername, _profile.InstallDirectory, _profile.SotFEnabled ? Config.Default.AppIdServer_SotF : Config.Default.AppIdServer, steamCmdInstallServerBetaArgs.ToString(), validate ? "validate" : string.Empty);
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallServerArgsFormat, Config.Default.SteamCmd_AnonymousUsername, _profile.InstallDirectory, _profile.AppIdServer, steamCmdInstallServerBetaArgs.ToString(), validate ? "validate" : string.Empty);
|
||||
if (steamCmdRemoveQuit)
|
||||
{
|
||||
SteamCMDProcessWindowStyle = ProcessWindowStyle.Normal;
|
||||
|
|
@ -933,8 +933,8 @@ namespace ServerManagerTool.Lib
|
|||
LogProfileMessage($"{modDetail.title}.\r\n");
|
||||
}
|
||||
|
||||
var modCachePath = ModUtils.GetModCachePath(modId, _profile.SotFEnabled);
|
||||
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, _profile.SotFEnabled);
|
||||
var modCachePath = ModUtils.GetModCachePath(modId, _profile.AppId);
|
||||
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, _profile.AppId);
|
||||
var modPath = ModUtils.GetModPath(_profile.InstallDirectory, modId);
|
||||
var modTimeFile = ModUtils.GetLatestModTimeFile(_profile.InstallDirectory, modId);
|
||||
|
||||
|
|
@ -1014,13 +1014,9 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
steamCmdArgs = string.Empty;
|
||||
if (Config.Default.SteamCmd_UseAnonymousCredentials)
|
||||
{
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_AnonymousUsername, _profile.SotFEnabled ? Config.Default.AppId_SotF : Config.Default.AppId, modId);
|
||||
}
|
||||
else
|
||||
{
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_Username, _profile.SotFEnabled ? Config.Default.AppId_SotF : Config.Default.AppId, modId);
|
||||
}
|
||||
|
||||
modSuccess = ServerUpdater.UpgradeModsAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, Config.Default.SteamCmdRedirectOutput ? modOutputHandler : null, cancellationToken, SteamCMDProcessWindowStyle).Result;
|
||||
if (modSuccess && downloadSuccessful)
|
||||
|
|
@ -1039,7 +1035,7 @@ namespace ServerManagerTool.Lib
|
|||
if (modDetail == null || modDetail.time_updated <= 0)
|
||||
{
|
||||
// get the version number from the steamcmd workshop file.
|
||||
steamLastUpdated = ModUtils.GetSteamWorkshopLatestTime(ModUtils.GetSteamWorkshopFile(_profile.SotFEnabled), modId).ToString();
|
||||
steamLastUpdated = ModUtils.GetSteamWorkshopLatestTime(ModUtils.GetSteamWorkshopFile(_profile.AppId), modId).ToString();
|
||||
}
|
||||
|
||||
// update the last updated file with the steam updated time.
|
||||
|
|
@ -1209,26 +1205,32 @@ namespace ServerManagerTool.Lib
|
|||
LogProfileMessage("Started server update...");
|
||||
LogProfileMessage("------------------------");
|
||||
LogProfileMessage($"Server Manager version: {App.Instance.Version}");
|
||||
LogProfileMessage($"Server branch: {GetBranchName(_profile.BranchName)}");
|
||||
LogProfileMessage($"Server branch: {GetBranchInfo(_profile.AppIdServer, _profile.BranchName)}");
|
||||
LogProfileMessage($"Profile Name: {_profile.ProfileName}");
|
||||
|
||||
// check if the server needs to be updated
|
||||
var serverCacheLastUpdated = GetServerLatestTime(GetServerCacheTimeFile(_profile?.BranchName));
|
||||
var serverCacheLastUpdated = GetServerLatestTime(GetServerCacheTimeFile(_profile.AppIdServer, _profile.BranchName));
|
||||
var serverLastUpdated = GetServerLatestTime(GetServerTimeFile());
|
||||
var updateServer = serverCacheLastUpdated > serverLastUpdated;
|
||||
|
||||
// check if any of the mods need to be updated
|
||||
var updateModIds = new List<string>();
|
||||
var modIdList = GetModList();
|
||||
var appModList = GetModList();
|
||||
|
||||
// cycle through each mod.
|
||||
foreach (var modId in modIdList)
|
||||
foreach (var appMods in appModList)
|
||||
{
|
||||
// check if the mod needs to be updated.
|
||||
var modCacheLastUpdated = ModUtils.GetModLatestTime(ModUtils.GetLatestModCacheTimeFile(modId, false));
|
||||
var modLastUpdated = ModUtils.GetModLatestTime(ModUtils.GetLatestModTimeFile(_profile.InstallDirectory, modId));
|
||||
if (modCacheLastUpdated > modLastUpdated || modLastUpdated == 0)
|
||||
updateModIds.Add(modId);
|
||||
if (!appMods.AppId.Equals(_profile.AppId, StringComparison.OrdinalIgnoreCase))
|
||||
continue;
|
||||
|
||||
foreach (var modId in appMods.ModIdList)
|
||||
{
|
||||
// check if the mod needs to be updated.
|
||||
var modCacheLastUpdated = ModUtils.GetModLatestTime(ModUtils.GetLatestModCacheTimeFile(modId, _profile.AppId));
|
||||
var modLastUpdated = ModUtils.GetModLatestTime(ModUtils.GetLatestModTimeFile(_profile.InstallDirectory, modId));
|
||||
if (modCacheLastUpdated > modLastUpdated || modLastUpdated == 0)
|
||||
updateModIds.Add(modId);
|
||||
}
|
||||
}
|
||||
|
||||
if (ExitCode != EXITCODE_NORMALEXIT)
|
||||
|
|
@ -1325,7 +1327,7 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
try
|
||||
{
|
||||
var cacheFolder = GetServerCacheFolder(_profile?.BranchName);
|
||||
var cacheFolder = GetServerCacheFolder(_profile.AppIdServer, _profile.BranchName);
|
||||
|
||||
if (Directory.Exists(cacheFolder))
|
||||
{
|
||||
|
|
@ -1347,13 +1349,14 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
LogProfileMessage("Updated server from cache. See patch notes.");
|
||||
LogProfileMessage(Config.Default.AppPatchNotesUrl);
|
||||
LogProfileMessage(_profile.SotFEnabled ? Config.Default.AppPatchNotesUrlSotF : Config.Default.AppPatchNotesUrl);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.Alert_ServerUpdate))
|
||||
alertMessage.AppendLine(Config.Default.Alert_ServerUpdate);
|
||||
|
||||
emailMessage.AppendLine();
|
||||
emailMessage.AppendLine("Updated server from cache. See patch notes.");
|
||||
emailMessage.AppendLine(Config.Default.AppPatchNotesUrl);
|
||||
emailMessage.AppendLine(_profile.SotFEnabled ? Config.Default.AppPatchNotesUrlSotF : Config.Default.AppPatchNotesUrl);
|
||||
|
||||
_profile.ServerUpdated = true;
|
||||
}
|
||||
|
|
@ -1399,7 +1402,7 @@ namespace ServerManagerTool.Lib
|
|||
for (var index = 0; index < updateModIds.Count; index++)
|
||||
{
|
||||
var modId = updateModIds[index];
|
||||
var modCachePath = ModUtils.GetModCachePath(modId, false);
|
||||
var modCachePath = ModUtils.GetModCachePath(modId, _profile.AppId);
|
||||
var modPath = ModUtils.GetModPath(_profile.InstallDirectory, modId);
|
||||
var modName = modDetails?.publishedfiledetails?.FirstOrDefault(m => m.publishedfileid == modId)?.title ?? string.Empty;
|
||||
|
||||
|
|
@ -1480,7 +1483,7 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
else
|
||||
{
|
||||
if (modIdList.Count > 0)
|
||||
if (appModList.Sum(m => m.ModIdList.Count) > 0)
|
||||
LogProfileMessage("Mods are already up to date, no updates required.");
|
||||
}
|
||||
|
||||
|
|
@ -1513,7 +1516,7 @@ namespace ServerManagerTool.Lib
|
|||
else
|
||||
{
|
||||
LogProfileMessage("");
|
||||
if (modIdList.Count > 0)
|
||||
if (appModList.Sum(m => m.ModIdList.Count) > 0)
|
||||
LogProfileMessage("The server and mods files are already up to date, no updates required.");
|
||||
else
|
||||
LogProfileMessage("The server files are already up to date, no updates required.");
|
||||
|
|
@ -1549,10 +1552,10 @@ namespace ServerManagerTool.Lib
|
|||
private void UpdateModCache()
|
||||
{
|
||||
// get a list of mods to be processed
|
||||
var modIdList = GetModList();
|
||||
var appModList = GetModList();
|
||||
|
||||
// check if there are any mods to be processed
|
||||
if (modIdList.Count == 0)
|
||||
if (appModList.Count == 0 || appModList.Sum(m => m.ModIdList.Count) == 0)
|
||||
{
|
||||
ExitCode = EXITCODE_NORMALEXIT;
|
||||
return;
|
||||
|
|
@ -1564,12 +1567,13 @@ namespace ServerManagerTool.Lib
|
|||
LogMessage("----------------------------");
|
||||
LogMessage($"Server Manager version: {App.Instance.Version}");
|
||||
|
||||
LogMessage($"Downloading mod information for {modIdList.Count} mods from steam.");
|
||||
var totalMods = appModList.Sum(m => m.ModIdList.Count);
|
||||
LogMessage($"Downloading mod information for {totalMods} mods from steam.");
|
||||
|
||||
var forceUpdateMods = Config.Default.ServerUpdate_ForceUpdateModsIfNoSteamInfo || string.IsNullOrWhiteSpace(SteamUtils.SteamWebApiKey);
|
||||
|
||||
// get the details of the mods to be processed.
|
||||
var modDetails = SteamUtils.GetSteamModDetails(modIdList);
|
||||
var modDetails = SteamUtils.GetSteamModDetails(appModList);
|
||||
if (modDetails == null)
|
||||
{
|
||||
if (forceUpdateMods)
|
||||
|
|
@ -1587,19 +1591,19 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
else
|
||||
{
|
||||
LogMessage($"Downloaded mod information for {modIdList.Count} mods from steam.");
|
||||
LogMessage($"Downloaded mod information for {totalMods} mods from steam.");
|
||||
LogMessage("");
|
||||
}
|
||||
|
||||
// cycle through each mod finding which needs to be updated.
|
||||
var updateModIds = new List<string>();
|
||||
var updateMods = new List<(string AppId, List<string> ModIdList)>();
|
||||
if (modDetails == null)
|
||||
{
|
||||
if (forceUpdateMods)
|
||||
{
|
||||
LogMessage("All mods will be updated - unable to download steam information and force mod update is TRUE.");
|
||||
|
||||
updateModIds.AddRange(modIdList);
|
||||
updateMods = appModList;
|
||||
modDetails = new PublishedFileDetailsResponse();
|
||||
}
|
||||
}
|
||||
|
|
@ -1608,46 +1612,67 @@ namespace ServerManagerTool.Lib
|
|||
if (Config.Default.ServerUpdate_ForceUpdateMods)
|
||||
{
|
||||
LogMessage("All mods will be updated - force mod update is TRUE.");
|
||||
updateModIds.AddRange(modIdList);
|
||||
updateMods = appModList;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage("Mods will be selectively updated - force mod update is FALSE.");
|
||||
|
||||
foreach (var modId in modIdList)
|
||||
foreach (var appMod in appModList)
|
||||
{
|
||||
var modDetail = modDetails.publishedfiledetails?.FirstOrDefault(m => m.publishedfileid.Equals(modId, StringComparison.OrdinalIgnoreCase));
|
||||
if (modDetail == null)
|
||||
foreach (var modId in appMod.ModIdList)
|
||||
{
|
||||
LogMessage($"Mod {modId} will not be updated - unable to download steam information.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (modDetail.time_updated == 0)
|
||||
{
|
||||
LogMessage($"Mod {modId} will be updated - mod is private.");
|
||||
updateModIds.Add(modId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, false);
|
||||
|
||||
// check if the mod needs to be updated
|
||||
var steamLastUpdated = modDetail.time_updated;
|
||||
var modCacheLastUpdated = ModUtils.GetModLatestTime(cacheTimeFile);
|
||||
if (steamLastUpdated > modCacheLastUpdated)
|
||||
var modDetail = modDetails.publishedfiledetails?.FirstOrDefault(m => m.publishedfileid.Equals(modId, StringComparison.OrdinalIgnoreCase));
|
||||
if (modDetail == null)
|
||||
{
|
||||
LogMessage($"Mod {modId} will be updated - new version found.");
|
||||
updateModIds.Add(modId);
|
||||
LogMessage($"Mod {modId} will not be updated - unable to download steam information.");
|
||||
continue;
|
||||
}
|
||||
else if (modCacheLastUpdated == 0)
|
||||
|
||||
var updateMod = updateMods.FirstOrDefault(m => m.AppId.Equals(appMod.AppId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (modDetail.time_updated == 0)
|
||||
{
|
||||
LogMessage($"Mod {modId} will be updated - cache not versioned.");
|
||||
updateModIds.Add(modId);
|
||||
LogMessage($"Mod {modId} will be updated - mod is private.");
|
||||
if (updateMod == default)
|
||||
updateMods.Add((appMod.AppId, new List<string> { modId }));
|
||||
else
|
||||
updateMod.ModIdList.Add(modId);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage($"Mod {modId} update skipped - cache contains the latest version.");
|
||||
if (modDetail.creator_app_id is null || modDetail.creator_app_id.Equals(appMod.AppId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, appMod.AppId);
|
||||
|
||||
// check if the mod needs to be updated
|
||||
var steamLastUpdated = modDetail.time_updated;
|
||||
var modCacheLastUpdated = ModUtils.GetModLatestTime(cacheTimeFile);
|
||||
if (steamLastUpdated > modCacheLastUpdated)
|
||||
{
|
||||
LogMessage($"Mod {modId} will be updated - new version found.");
|
||||
if (updateMod == default)
|
||||
updateMods.Add((appMod.AppId, new List<string> { modId }));
|
||||
else
|
||||
updateMod.ModIdList.Add(modId);
|
||||
}
|
||||
else if (modCacheLastUpdated == 0)
|
||||
{
|
||||
LogMessage($"Mod {modId} will be updated - cache not versioned.");
|
||||
if (updateMod == default)
|
||||
updateMods.Add((appMod.AppId, new List<string> { modId }));
|
||||
else
|
||||
updateMod.ModIdList.Add(modId);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage($"Mod {modId} update skipped - cache contains the latest version.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage($"Mod {modId} update skipped - mod does not belong to this application.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1662,97 +1687,105 @@ namespace ServerManagerTool.Lib
|
|||
return;
|
||||
}
|
||||
|
||||
var totalUpdateMods = updateMods.Sum(m => m.ModIdList.Count);
|
||||
var updateIndex = 0;
|
||||
|
||||
// cycle through each mod id.
|
||||
for (var index = 0; index < updateModIds.Count; index++)
|
||||
foreach (var appMod in updateMods)
|
||||
{
|
||||
var modId = updateModIds[index];
|
||||
var modDetail = modDetails.publishedfiledetails?.FirstOrDefault(m => m.publishedfileid.Equals(modId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, false);
|
||||
var modCachePath = ModUtils.GetModCachePath(modId, false);
|
||||
|
||||
var downloadSuccessful = false;
|
||||
|
||||
DataReceivedEventHandler modOutputHandler = (s, e) =>
|
||||
for (var index = 0; index < appMod.ModIdList.Count; index++)
|
||||
{
|
||||
var dataValue = e.Data ?? string.Empty;
|
||||
LogMessage(dataValue);
|
||||
if (dataValue.StartsWith("Success."))
|
||||
var modId = appMod.ModIdList[index];
|
||||
var modDetail = modDetails.publishedfiledetails?.FirstOrDefault(m => m.publishedfileid.Equals(modId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, appMod.AppId);
|
||||
var modCachePath = ModUtils.GetModCachePath(modId, appMod.AppId);
|
||||
|
||||
var downloadSuccessful = false;
|
||||
|
||||
DataReceivedEventHandler modOutputHandler = (s, e) =>
|
||||
{
|
||||
downloadSuccessful = true;
|
||||
}
|
||||
};
|
||||
|
||||
LogMessage("");
|
||||
LogMessage($"Started mod cache update {index + 1} of {updateModIds.Count}");
|
||||
LogMessage($"{modId} - {modDetail?.title ?? "<unknown>"}");
|
||||
|
||||
var attempt = 0;
|
||||
while (true)
|
||||
{
|
||||
attempt++;
|
||||
downloadSuccessful = !Config.Default.SteamCmdRedirectOutput;
|
||||
|
||||
// update the mod cache
|
||||
var steamCmdArgs = string.Empty;
|
||||
if (Config.Default.SteamCmd_UseAnonymousCredentials)
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(false, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_AnonymousUsername, Config.Default.AppId, modId);
|
||||
else
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(false, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_Username, Config.Default.AppId, modId);
|
||||
var workingDirectory = Config.Default.DataDir;
|
||||
|
||||
var success = ServerUpdater.UpgradeModsAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, Config.Default.SteamCmdRedirectOutput ? modOutputHandler : null, CancellationToken.None, SteamCMDProcessWindowStyle).Result;
|
||||
if (success && downloadSuccessful)
|
||||
// download was successful, exit loop and continue.
|
||||
break;
|
||||
|
||||
// download was not successful, log a failed attempt.
|
||||
var logError = $"Mod {modId} cache update failed";
|
||||
if (Config.Default.AutoUpdate_RetryOnFail)
|
||||
logError += $" - attempt {attempt}.";
|
||||
LogError(logError);
|
||||
|
||||
// check if we have reached the max failed attempt limit.
|
||||
if (!Config.Default.AutoUpdate_RetryOnFail || attempt >= MAXRETRIES_STEAM)
|
||||
{
|
||||
// failed max limit reached
|
||||
if (Config.Default.SteamCmdRedirectOutput)
|
||||
var dataValue = e.Data ?? string.Empty;
|
||||
LogMessage(dataValue);
|
||||
if (dataValue.StartsWith("Success."))
|
||||
{
|
||||
LogMessage("Check steamcmd logs for more information why the mod cache update failed.\r\n");
|
||||
LogMessage($"If the mod cache update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the Server Manager settings window.");
|
||||
downloadSuccessful = true;
|
||||
}
|
||||
};
|
||||
|
||||
updateIndex++;
|
||||
|
||||
LogMessage("");
|
||||
LogMessage($"Started mod cache update {updateIndex} of {totalUpdateMods}");
|
||||
LogMessage($"{modId} - {modDetail?.title ?? "<unknown>"}");
|
||||
|
||||
var attempt = 0;
|
||||
while (true)
|
||||
{
|
||||
attempt++;
|
||||
downloadSuccessful = !Config.Default.SteamCmdRedirectOutput;
|
||||
|
||||
// update the mod cache
|
||||
var steamCmdArgs = string.Empty;
|
||||
if (Config.Default.SteamCmd_UseAnonymousCredentials)
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(false, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_AnonymousUsername, appMod.AppId, modId);
|
||||
else
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(false, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_Username, appMod.AppId, modId);
|
||||
var workingDirectory = Config.Default.DataDir;
|
||||
|
||||
var success = ServerUpdater.UpgradeModsAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, Config.Default.SteamCmdRedirectOutput ? modOutputHandler : null, CancellationToken.None, SteamCMDProcessWindowStyle).Result;
|
||||
if (success && downloadSuccessful)
|
||||
// download was successful, exit loop and continue.
|
||||
break;
|
||||
|
||||
// download was not successful, log a failed attempt.
|
||||
var logError = $"Mod {modId} cache update failed";
|
||||
if (Config.Default.AutoUpdate_RetryOnFail)
|
||||
logError += $" - attempt {attempt}.";
|
||||
LogError(logError);
|
||||
|
||||
// check if we have reached the max failed attempt limit.
|
||||
if (!Config.Default.AutoUpdate_RetryOnFail || attempt >= MAXRETRIES_STEAM)
|
||||
{
|
||||
// failed max limit reached
|
||||
if (Config.Default.SteamCmdRedirectOutput)
|
||||
{
|
||||
LogMessage("Check steamcmd logs for more information why the mod cache update failed.\r\n");
|
||||
LogMessage($"If the mod cache update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the Server Manager settings window.");
|
||||
}
|
||||
|
||||
ExitCode = EXITCODE_CACHEMODUPDATEFAILED;
|
||||
return;
|
||||
}
|
||||
|
||||
ExitCode = EXITCODE_CACHEMODUPDATEFAILED;
|
||||
return;
|
||||
Task.Delay(5000).Wait();
|
||||
}
|
||||
|
||||
Task.Delay(5000).Wait();
|
||||
}
|
||||
|
||||
// check if any of the mod files have changed.
|
||||
if (Directory.Exists(modCachePath))
|
||||
{
|
||||
var gotNewVersion = new DirectoryInfo(modCachePath).GetFiles("*.*", SearchOption.AllDirectories).Any(file => file.LastWriteTime >= _startTime);
|
||||
|
||||
if (gotNewVersion)
|
||||
LogMessage("***** New version downloaded. *****");
|
||||
else
|
||||
LogMessage("No new version.");
|
||||
|
||||
var steamLastUpdated = modDetail?.time_updated.ToString() ?? string.Empty;
|
||||
if (modDetail == null || modDetail.time_updated <= 0)
|
||||
// check if any of the mod files have changed.
|
||||
if (Directory.Exists(modCachePath))
|
||||
{
|
||||
// get the version number from the steamcmd workshop file.
|
||||
steamLastUpdated = ModUtils.GetSteamWorkshopLatestTime(ModUtils.GetSteamWorkshopFile(false), modId).ToString();
|
||||
var gotNewVersion = new DirectoryInfo(modCachePath).GetFiles("*.*", SearchOption.AllDirectories).Any(file => file.LastWriteTime >= _startTime);
|
||||
|
||||
if (gotNewVersion)
|
||||
LogMessage("***** New version downloaded. *****");
|
||||
else
|
||||
LogMessage("No new version.");
|
||||
|
||||
var steamLastUpdated = modDetail?.time_updated.ToString() ?? string.Empty;
|
||||
if (modDetail == null || modDetail.time_updated <= 0)
|
||||
{
|
||||
// get the version number from the steamcmd workshop file.
|
||||
steamLastUpdated = ModUtils.GetSteamWorkshopLatestTime(ModUtils.GetSteamWorkshopFile(appMod.AppId), modId).ToString();
|
||||
}
|
||||
|
||||
File.WriteAllText(cacheTimeFile, steamLastUpdated);
|
||||
LogMessage($"Mod {modId} cache version: {steamLastUpdated}");
|
||||
}
|
||||
else
|
||||
LogMessage($"Mod {modId} cache does not exist.");
|
||||
|
||||
File.WriteAllText(cacheTimeFile, steamLastUpdated);
|
||||
LogMessage($"Mod {modId} cache version: {steamLastUpdated}");
|
||||
LogMessage($"Finished mod {modId} cache update.");
|
||||
}
|
||||
else
|
||||
LogMessage($"Mod {modId} cache does not exist.");
|
||||
|
||||
LogMessage($"Finished mod {modId} cache update.");
|
||||
}
|
||||
|
||||
LogMessage("---------------------------");
|
||||
|
|
@ -1762,13 +1795,13 @@ namespace ServerManagerTool.Lib
|
|||
ExitCode = EXITCODE_NORMALEXIT;
|
||||
}
|
||||
|
||||
private void UpdateServerCache(string branchName, string branchPassword)
|
||||
private void UpdateServerCache(string appIdServer, string branchName, string branchPassword)
|
||||
{
|
||||
LogBranchMessage(branchName, "-------------------------------");
|
||||
LogBranchMessage(branchName, "Starting server cache update...");
|
||||
LogBranchMessage(branchName, "-------------------------------");
|
||||
LogBranchMessage(branchName, $"Server Manager version: {App.Instance.Version}");
|
||||
LogBranchMessage(branchName, $"Server branch: {GetBranchName(branchName)}");
|
||||
LogBranchMessage(appIdServer, branchName, "-------------------------------");
|
||||
LogBranchMessage(appIdServer, branchName, "Starting server cache update...");
|
||||
LogBranchMessage(appIdServer, branchName, "-------------------------------");
|
||||
LogBranchMessage(appIdServer, branchName, $"Server Manager version: {App.Instance.Version}");
|
||||
LogBranchMessage(appIdServer, branchName, $"Server branch: {GetBranchInfo(appIdServer, branchName)}");
|
||||
|
||||
var gotNewVersion = false;
|
||||
var downloadSuccessful = false;
|
||||
|
|
@ -1776,7 +1809,7 @@ namespace ServerManagerTool.Lib
|
|||
var steamCmdFile = SteamCmdUpdater.GetSteamCmdFile(Config.Default.DataDir);
|
||||
if (string.IsNullOrWhiteSpace(steamCmdFile) || !File.Exists(steamCmdFile))
|
||||
{
|
||||
LogBranchError(branchName, $"SteamCMD could not be found. Expected location is {steamCmdFile}");
|
||||
LogBranchError(appIdServer, branchName, $"SteamCMD could not be found. Expected location is {steamCmdFile}");
|
||||
ExitCode = EXITCODE_STEAMCMDNOTFOUND;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1784,7 +1817,7 @@ namespace ServerManagerTool.Lib
|
|||
DataReceivedEventHandler serverOutputHandler = (s, e) =>
|
||||
{
|
||||
var dataValue = e.Data ?? string.Empty;
|
||||
LogBranchMessage(branchName, dataValue);
|
||||
LogBranchMessage(appIdServer, branchName, dataValue);
|
||||
if (!gotNewVersion && dataValue.Contains("downloading,"))
|
||||
{
|
||||
gotNewVersion = true;
|
||||
|
|
@ -1807,9 +1840,9 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
}
|
||||
|
||||
var cacheFolder = GetServerCacheFolder(branchName);
|
||||
var cacheFolder = GetServerCacheFolder(appIdServer, branchName);
|
||||
|
||||
LogBranchMessage(branchName, "Server update started.");
|
||||
LogBranchMessage(appIdServer, branchName, "Server update started.");
|
||||
|
||||
var attempt = 0;
|
||||
while (true)
|
||||
|
|
@ -1820,7 +1853,7 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
// update the server cache
|
||||
var validate = Config.Default.AutoUpdate_ValidateServerFiles;
|
||||
var steamCmdArgs = SteamUtils.BuildSteamCmdArguments(false, Config.Default.SteamCmdInstallServerArgsFormat, Config.Default.SteamCmd_AnonymousUsername, cacheFolder, Config.Default.AppIdServer, steamCmdInstallServerBetaArgs.ToString(), validate ? "validate" : string.Empty);
|
||||
var steamCmdArgs = SteamUtils.BuildSteamCmdArguments(false, Config.Default.SteamCmdInstallServerArgsFormat, Config.Default.SteamCmd_AnonymousUsername, cacheFolder, appIdServer, steamCmdInstallServerBetaArgs.ToString(), validate ? "validate" : string.Empty);
|
||||
var workingDirectory = Config.Default.DataDir;
|
||||
|
||||
var success = ServerUpdater.UpgradeServerAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, cacheFolder, Config.Default.SteamCmdRedirectOutput ? serverOutputHandler : null, CancellationToken.None, SteamCMDProcessWindowStyle).Result;
|
||||
|
|
@ -1832,7 +1865,7 @@ namespace ServerManagerTool.Lib
|
|||
var logError = "Server cache update failed";
|
||||
if (Config.Default.AutoUpdate_RetryOnFail)
|
||||
logError += $" - attempt {attempt}.";
|
||||
LogBranchError(branchName, logError);
|
||||
LogBranchError(appIdServer, branchName, logError);
|
||||
|
||||
// check if we have reached the max failed attempt limit.
|
||||
if (!Config.Default.AutoUpdate_RetryOnFail || attempt >= MAXRETRIES_STEAM)
|
||||
|
|
@ -1840,8 +1873,8 @@ namespace ServerManagerTool.Lib
|
|||
// failed max limit reached
|
||||
if (Config.Default.SteamCmdRedirectOutput)
|
||||
{
|
||||
LogBranchMessage(branchName, $"Check steamcmd logs for more information why the server cache update failed.\r\n");
|
||||
LogBranchMessage(branchName, $"If the server cache update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the ASM settings window.");
|
||||
LogBranchMessage(appIdServer, branchName, $"Check steamcmd logs for more information why the server cache update failed.\r\n");
|
||||
LogBranchMessage(appIdServer, branchName, $"If the server cache update keeps failing try disabling the '{_globalizer.GetResourceString("GlobalSettings_SteamCmdRedirectOutputLabel")}' option in the server manager settings window.");
|
||||
}
|
||||
|
||||
ExitCode = EXITCODE_CACHESERVERUPDATEFAILED;
|
||||
|
|
@ -1859,24 +1892,24 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
if (gotNewVersion)
|
||||
{
|
||||
LogBranchMessage(branchName, "***** New version downloaded. *****");
|
||||
LogBranchMessage(appIdServer, branchName, "***** New version downloaded. *****");
|
||||
|
||||
var latestCacheTimeFile = GetServerCacheTimeFile(branchName);
|
||||
var latestCacheTimeFile = GetServerCacheTimeFile(appIdServer, branchName);
|
||||
File.WriteAllText(latestCacheTimeFile, _startTime.ToString("o", CultureInfo.CurrentCulture));
|
||||
}
|
||||
else
|
||||
LogBranchMessage(branchName, "No new version.");
|
||||
LogBranchMessage(appIdServer, branchName, "No new version.");
|
||||
}
|
||||
else
|
||||
LogBranchMessage(branchName, $"Server cache does not exist.");
|
||||
LogBranchMessage(appIdServer, branchName, $"Server cache does not exist.");
|
||||
|
||||
var cacheVersion = GetServerVersion(GetServerCacheVersionFile(branchName)).ToString();
|
||||
LogBranchMessage(branchName, $"Server cache version: {cacheVersion}");
|
||||
var cacheVersion = GetServerVersion(GetServerCacheVersionFile(appIdServer, branchName)).ToString();
|
||||
LogBranchMessage(appIdServer, branchName, $"Server cache version: {cacheVersion}");
|
||||
|
||||
LogBranchMessage(branchName, "-----------------------------");
|
||||
LogBranchMessage(branchName, "Finished server cache update.");
|
||||
LogBranchMessage(branchName, "-----------------------------");
|
||||
LogBranchMessage(branchName, "");
|
||||
LogBranchMessage(appIdServer, branchName, "-----------------------------");
|
||||
LogBranchMessage(appIdServer, branchName, "Finished server cache update.");
|
||||
LogBranchMessage(appIdServer, branchName, "-----------------------------");
|
||||
LogBranchMessage(appIdServer, branchName, "");
|
||||
ExitCode = EXITCODE_NORMALEXIT;
|
||||
}
|
||||
|
||||
|
|
@ -2320,7 +2353,14 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
}
|
||||
|
||||
public static string GetBranchName(string branchName) => string.IsNullOrWhiteSpace(branchName) ? Config.Default.DefaultServerBranchName : branchName;
|
||||
public static string GetBranchInfo(string appIdServer, string branchName)
|
||||
{
|
||||
var branchInfo = string.IsNullOrWhiteSpace(branchName) ? Config.Default.DefaultServerBranchName : branchName;
|
||||
if (!string.IsNullOrWhiteSpace(appIdServer) && !appIdServer.Equals(Config.Default.AppIdServer, StringComparison.OrdinalIgnoreCase))
|
||||
branchInfo += $"_{appIdServer}";
|
||||
|
||||
return branchInfo;
|
||||
}
|
||||
|
||||
private string GetLauncherFile() => IOUtils.NormalizePath(Path.Combine(GetProfileServerConfigDir(_profile), Config.Default.LauncherFile));
|
||||
|
||||
|
|
@ -2367,9 +2407,9 @@ namespace ServerManagerTool.Lib
|
|||
return LogManager.GetLogger(loggerName);
|
||||
}
|
||||
|
||||
private List<string> GetModList()
|
||||
private List<(string AppId, List<string> ModIdList)> GetModList()
|
||||
{
|
||||
var modIdList = new List<string>();
|
||||
var appMods = new List<(string AppId, List<string> ModIdList)>();
|
||||
|
||||
// check if we need to update the mods.
|
||||
if (Config.Default.ServerUpdate_UpdateModsWhenUpdatingServer)
|
||||
|
|
@ -2383,6 +2423,8 @@ namespace ServerManagerTool.Lib
|
|||
if (!profile.EnableAutoUpdate)
|
||||
continue;
|
||||
|
||||
var modIdList = new List<string>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(profile.ServerMapModId))
|
||||
modIdList.Add(profile.ServerMapModId);
|
||||
|
||||
|
|
@ -2390,11 +2432,19 @@ namespace ServerManagerTool.Lib
|
|||
modIdList.Add(profile.TotalConversionModId);
|
||||
|
||||
modIdList.AddRange(profile.ServerModIds);
|
||||
|
||||
var appMod = appMods.FirstOrDefault(m => m.AppId.Equals(profile.AppId, StringComparison.OrdinalIgnoreCase));
|
||||
if (appMod == default)
|
||||
appMods.Add((profile.AppId, modIdList));
|
||||
else
|
||||
appMod.ModIdList.AddRange(modIdList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// get all the mods for only the specified profile.
|
||||
var modIdList = new List<string>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_profile.ServerMapModId))
|
||||
modIdList.Add(_profile.ServerMapModId);
|
||||
|
||||
|
|
@ -2402,10 +2452,19 @@ namespace ServerManagerTool.Lib
|
|||
modIdList.Add(_profile.TotalConversionModId);
|
||||
|
||||
modIdList.AddRange(_profile.ServerModIds);
|
||||
|
||||
appMods.Add((_profile.AppId, modIdList));
|
||||
}
|
||||
}
|
||||
|
||||
return ModUtils.ValidateModList(modIdList);
|
||||
for (int i = 0; i < appMods.Count; i++)
|
||||
{
|
||||
var validatedModList = ModUtils.ValidateModList(appMods[i].ModIdList);
|
||||
|
||||
appMods[i].ModIdList.Clear();
|
||||
appMods[i].ModIdList.AddRange(validatedModList);
|
||||
}
|
||||
return appMods;
|
||||
}
|
||||
|
||||
public static string GetMutexName(string directory)
|
||||
|
|
@ -2469,11 +2528,15 @@ namespace ServerManagerTool.Lib
|
|||
return IOUtils.NormalizePath(Path.Combine(Config.Default.BackupPath, Config.Default.ServersInstallDir, profile.ProfileId.ToLower()));
|
||||
}
|
||||
|
||||
private static string GetServerCacheFolder(string branchName) => IOUtils.NormalizePath(Path.Combine(Config.Default.AutoUpdate_CacheDir, $"{Config.Default.ServerBranchFolderPrefix}{GetBranchName(branchName)}"));
|
||||
public static string GetServerCacheFolder(string appIdServer, string branchName)
|
||||
{
|
||||
var branchInfo = GetBranchInfo(appIdServer, branchName) ?? "unknown";
|
||||
return IOUtils.NormalizePath(Path.Combine(Config.Default.AutoUpdate_CacheDir, $"{Config.Default.ServerBranchFolderPrefix}{branchInfo}"));
|
||||
}
|
||||
|
||||
private static string GetServerCacheTimeFile(string branchName) => IOUtils.NormalizePath(Path.Combine(GetServerCacheFolder(branchName), Config.Default.LastUpdatedTimeFile));
|
||||
private static string GetServerCacheTimeFile(string appIdServer, string branchName) => IOUtils.NormalizePath(Path.Combine(GetServerCacheFolder(appIdServer, branchName), Config.Default.LastUpdatedTimeFile));
|
||||
|
||||
private static string GetServerCacheVersionFile(string branchName) => IOUtils.NormalizePath(Path.Combine(GetServerCacheFolder(branchName), Config.Default.VersionFile));
|
||||
private static string GetServerCacheVersionFile(string appIdServer, string branchName) => IOUtils.NormalizePath(Path.Combine(GetServerCacheFolder(appIdServer, branchName), Config.Default.VersionFile));
|
||||
|
||||
private string GetServerExecutableFile() => IOUtils.NormalizePath(Path.Combine(_profile.InstallDirectory, Config.Default.ServerBinaryRelativePath, Config.Default.ServerExe));
|
||||
|
||||
|
|
@ -2640,7 +2703,7 @@ namespace ServerManagerTool.Lib
|
|||
Debug.WriteLine($"[INFO] {message}");
|
||||
}
|
||||
|
||||
private void LogBranchError(string branchName, string error, bool includeProgressCallback = true)
|
||||
private void LogBranchError(string appIdServer, string branchName, string error, bool includeProgressCallback = true)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(error))
|
||||
return;
|
||||
|
|
@ -2650,10 +2713,12 @@ namespace ServerManagerTool.Lib
|
|||
if (includeProgressCallback)
|
||||
ProgressCallback?.Invoke(0, $"[ERROR] {error}");
|
||||
|
||||
Debug.WriteLine($"[ERROR] (Branch {GetBranchName(branchName) ?? "unknown"}) {error}");
|
||||
var branchInfo = GetBranchInfo(appIdServer, branchName) ?? "unknown";
|
||||
|
||||
Debug.WriteLine($"[ERROR] (Branch {branchInfo}) {error}");
|
||||
}
|
||||
|
||||
private void LogBranchMessage(string branchName, string message, bool includeProgressCallback = true)
|
||||
private void LogBranchMessage(string appIdServer, string branchName, string message, bool includeProgressCallback = true)
|
||||
{
|
||||
message = message ?? string.Empty;
|
||||
|
||||
|
|
@ -2662,7 +2727,9 @@ namespace ServerManagerTool.Lib
|
|||
if (includeProgressCallback)
|
||||
ProgressCallback?.Invoke(0, $"{message}");
|
||||
|
||||
Debug.WriteLine($"[INFO] (Branch {GetBranchName(branchName) ?? "unknown"}) {message}");
|
||||
var branchInfo = GetBranchInfo(appIdServer, branchName) ?? "unknown";
|
||||
|
||||
Debug.WriteLine($"[INFO] (Branch {branchInfo}) {message}");
|
||||
}
|
||||
|
||||
private void LogProfileDebug(string message, bool includeProgressCallback = true)
|
||||
|
|
@ -3081,16 +3148,17 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
Mutex mutex = null;
|
||||
var createdNew = false;
|
||||
var branchInfo = GetBranchInfo(branch.AppIdServer, branch.BranchName) ?? "unknown";
|
||||
|
||||
if (OutputLogs)
|
||||
{
|
||||
_loggerBranch = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), $"{LOGPREFIX_AUTOUPDATE}", $"BranchUpdate_{GetBranchName(branch.BranchName)}");
|
||||
_loggerBranch = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), $"{LOGPREFIX_AUTOUPDATE}", $"BranchUpdate_{branchInfo}");
|
||||
_loggerProfile = GetLogger(GetProfileLogFolder(profile.ProfileId, LOGPREFIX_AUTOUPDATE), $"{LOGPREFIX_AUTOUPDATE}_{profile.ProfileId}", "Update");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
LogBranchMessage(branch.BranchName, $"[{_profile.ProfileName}] Started server update process.");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, $"[{_profile.ProfileName}] Started server update process.");
|
||||
|
||||
// try to establish a mutex for the profile.
|
||||
var mutexName = GetMutexName(_profile.InstallDirectory);
|
||||
|
|
@ -3111,7 +3179,7 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
UpdateFiles();
|
||||
|
||||
LogBranchMessage(branch.BranchName, $"[{_profile.ProfileName}] Finished server update process.");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, $"[{_profile.ProfileName}] Finished server update process.");
|
||||
|
||||
if (ExitCode != EXITCODE_NORMALEXIT)
|
||||
{
|
||||
|
|
@ -3124,7 +3192,7 @@ namespace ServerManagerTool.Lib
|
|||
{
|
||||
ExitCode = EXITCODE_PROCESSALREADYRUNNING;
|
||||
LogProfileMessage("Cancelled server update process, could not lock server.");
|
||||
LogBranchMessage(branch.BranchName, $"[{_profile.ProfileName}] Cancelled server update process, could not lock server.");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, $"[{_profile.ProfileName}] Cancelled server update process, could not lock server.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -3171,47 +3239,50 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
Mutex mutex = null;
|
||||
var createdNew = false;
|
||||
var branchInfo = GetBranchInfo(branch.AppIdServer, branch.BranchName) ?? "unknown";
|
||||
|
||||
if (OutputLogs)
|
||||
_loggerBranch = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), $"{LOGPREFIX_AUTOUPDATE}", $"BranchUpdate_{GetBranchName(branch.BranchName)}");
|
||||
{
|
||||
_loggerBranch = GetLogger(GetLogFolder(LOGPREFIX_AUTOUPDATE), $"{LOGPREFIX_AUTOUPDATE}", $"BranchUpdate_{branchInfo}");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
LogMessage($"[{GetBranchName(branch.BranchName)}] Started branch update process.");
|
||||
LogMessage($"[{branchInfo}] Started branch update process.");
|
||||
|
||||
var cacheFolder = GetServerCacheFolder(branch.BranchName);
|
||||
var cacheFolder = GetServerCacheFolder(branch.AppIdServer, branch.BranchName);
|
||||
|
||||
// try to establish a mutex for the profile.
|
||||
var mutexName = GetMutexName(cacheFolder);
|
||||
LogBranchMessage(branch.BranchName, $"Attempting to establish a lock on the cache ({mutexName})");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, $"Attempting to establish a lock on the cache ({mutexName})");
|
||||
|
||||
mutex = new Mutex(true, mutexName, out createdNew);
|
||||
if (!createdNew)
|
||||
{
|
||||
var timeout = new TimeSpan(0, MUTEX_TIMEOUT, 0);
|
||||
LogBranchMessage(branch.BranchName, $"Could not lock cache, waiting for cache to unlock - timeout set to {timeout}.");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, $"Could not lock cache, waiting for cache to unlock - timeout set to {timeout}.");
|
||||
createdNew = mutex.WaitOne(timeout);
|
||||
}
|
||||
|
||||
// check if the mutex was established
|
||||
if (createdNew)
|
||||
{
|
||||
LogBranchMessage(branch.BranchName, "Cache lock established.\r\n");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, "Cache lock established.\r\n");
|
||||
|
||||
// update the server cache for the branch
|
||||
UpdateServerCache(branch.BranchName, branch.BranchPassword);
|
||||
UpdateServerCache(branch.AppIdServer, branch.BranchName, branch.BranchPassword);
|
||||
|
||||
if (ExitCode != EXITCODE_NORMALEXIT)
|
||||
{
|
||||
if (Config.Default.EmailNotify_AutoUpdate)
|
||||
SendEmail($"{GetBranchName(branch.BranchName)} branch update", Config.Default.Alert_UpdateProcessError, true);
|
||||
SendEmail($"{branchInfo} branch update", Config.Default.Alert_UpdateProcessError, true);
|
||||
ProcessAlert(AlertType.Error, Config.Default.Alert_UpdateProcessError);
|
||||
}
|
||||
|
||||
if (ExitCode == EXITCODE_NORMALEXIT)
|
||||
{
|
||||
// get the profile associated with the branch
|
||||
var profiles = _profiles.Keys.Where(p => p.EnableAutoUpdate && string.Equals(p.BranchName, branch.BranchName, StringComparison.OrdinalIgnoreCase));
|
||||
var profiles = _profiles.Keys.Where(p => p.EnableAutoUpdate && string.Equals(p.AppIdServer, branch.AppIdServer, StringComparison.OrdinalIgnoreCase) && string.Equals(p.BranchName, branch.BranchName, StringComparison.OrdinalIgnoreCase));
|
||||
var profileExitCodes = new ConcurrentDictionary<ServerProfileSnapshot, int>();
|
||||
|
||||
if (Config.Default.AutoUpdate_ParallelUpdate)
|
||||
|
|
@ -3256,27 +3327,27 @@ namespace ServerManagerTool.Lib
|
|||
ExitCode = EXITCODE_EXITWITHERRORS;
|
||||
}
|
||||
|
||||
LogMessage($"[{GetBranchName(branch.BranchName)}] Finished branch update process.");
|
||||
LogMessage($"[{branchInfo}] Finished branch update process.");
|
||||
}
|
||||
else
|
||||
{
|
||||
ExitCode = EXITCODE_PROCESSALREADYRUNNING;
|
||||
LogMessage($"[{GetBranchName(branch.BranchName)}] Cancelled branch update process, could not lock cache.");
|
||||
LogMessage($"[{branchInfo}] Cancelled branch update process, could not lock cache.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogBranchError(branch.BranchName, ex.Message);
|
||||
LogBranchError(branch.BranchName, ex.GetType().ToString());
|
||||
LogBranchError(branch.AppIdServer, branch.BranchName, ex.Message);
|
||||
LogBranchError(branch.AppIdServer, branch.BranchName, ex.GetType().ToString());
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
LogBranchMessage(branch.BranchName, $"InnerException - {ex.InnerException.Message}");
|
||||
LogBranchMessage(branch.BranchName, ex.InnerException.GetType().ToString());
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, $"InnerException - {ex.InnerException.Message}");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, ex.InnerException.GetType().ToString());
|
||||
}
|
||||
LogBranchMessage(branch.BranchName, $"StackTrace\r\n{ex.StackTrace}");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, $"StackTrace\r\n{ex.StackTrace}");
|
||||
|
||||
if (Config.Default.EmailNotify_AutoUpdate)
|
||||
SendEmail($"{GetBranchName(branch.BranchName)} branch update", Config.Default.Alert_UpdateProcessError, true);
|
||||
SendEmail($"{branchInfo} branch update", Config.Default.Alert_UpdateProcessError, true);
|
||||
ProcessAlert(AlertType.Error, Config.Default.Alert_UpdateProcessError);
|
||||
ExitCode = EXITCODE_UNKNOWNTHREADERROR;
|
||||
}
|
||||
|
|
@ -3293,8 +3364,8 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
}
|
||||
|
||||
LogBranchMessage(branch.BranchName, "");
|
||||
LogBranchMessage(branch.BranchName, $"Exitcode = {ExitCode}");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, "");
|
||||
LogBranchMessage(branch.AppIdServer, branch.BranchName, $"Exitcode = {ExitCode}");
|
||||
return ExitCode;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3642,7 +3642,8 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
try
|
||||
{
|
||||
var manifestFile = ModUtils.GetSteamManifestFile(InstallDirectory, SOTF_Enabled);
|
||||
var appIdServer = SOTF_Enabled ? Config.Default.AppIdServer_SotF : Config.Default.AppIdServer;
|
||||
var manifestFile = ModUtils.GetSteamManifestFile(InstallDirectory, appIdServer);
|
||||
if (string.IsNullOrWhiteSpace(manifestFile) || !File.Exists(manifestFile))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,15 @@ namespace ServerManagerTool.Lib
|
|||
public string ServerMap;
|
||||
public string ServerMapModId;
|
||||
public string TotalConversionModId;
|
||||
public IEnumerable<string> ServerModIds;
|
||||
public List<string> ServerModIds;
|
||||
public string MOTD;
|
||||
public int MOTDDuration;
|
||||
public bool MOTDIntervalEnabled;
|
||||
public int MOTDInterval;
|
||||
public bool ForceRespawnDinos;
|
||||
|
||||
public string AppId;
|
||||
public string AppIdServer;
|
||||
public string BranchName;
|
||||
public string BranchPassword;
|
||||
|
||||
|
|
@ -87,6 +89,8 @@ namespace ServerManagerTool.Lib
|
|||
MOTDInterval = Math.Max(1, Math.Min(int.MaxValue, profile.MOTDInterval.Value)),
|
||||
ForceRespawnDinos = profile.ForceRespawnDinos,
|
||||
|
||||
AppId = profile.SOTF_Enabled ? Config.Default.AppId_SotF : Config.Default.AppId,
|
||||
AppIdServer = profile.SOTF_Enabled ? Config.Default.AppIdServer_SotF : Config.Default.AppIdServer,
|
||||
BranchName = profile.BranchName,
|
||||
BranchPassword = profile.BranchPassword,
|
||||
|
||||
|
|
|
|||
|
|
@ -660,8 +660,10 @@ namespace ServerManagerTool.Lib
|
|||
// Server Update Section
|
||||
// *********************
|
||||
|
||||
var branchInfo = ServerApp.GetBranchInfo(branch?.AppIdServer, branch?.BranchName);
|
||||
|
||||
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Starting server update.");
|
||||
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server branch: {ServerApp.GetBranchName(branch?.BranchName)}.");
|
||||
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Server branch: {branchInfo}.");
|
||||
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Profile name: {this.ProfileSnapshot.ProfileName}.");
|
||||
|
||||
// create the branch arguments
|
||||
|
|
@ -677,10 +679,9 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
|
||||
// Check if this is a new server installation.
|
||||
if (isNewInstallation && !this.ProfileSnapshot.SotFEnabled && Config.Default.AutoUpdate_EnableUpdate && !string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
||||
if (isNewInstallation && Config.Default.AutoUpdate_EnableUpdate && !string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
var branchName = string.IsNullOrWhiteSpace(branch?.BranchName) ? Config.Default.DefaultServerBranchName : branch.BranchName;
|
||||
var cacheFolder = IOUtils.NormalizePath(Path.Combine(Config.Default.AutoUpdate_CacheDir, $"{Config.Default.ServerBranchFolderPrefix}{branchName}"));
|
||||
var cacheFolder = ServerApp.GetServerCacheFolder(branch?.AppIdServer, branch?.BranchName);
|
||||
|
||||
// check if the auto-update facility is enabled and the cache folder defined.
|
||||
if (!string.IsNullOrWhiteSpace(cacheFolder) && Directory.Exists(cacheFolder))
|
||||
|
|
@ -719,7 +720,7 @@ namespace ServerManagerTool.Lib
|
|||
};
|
||||
|
||||
var steamCmdRemoveQuit = CommonConfig.Default.SteamCmdRemoveQuit && !Config.Default.SteamCmdRedirectOutput;
|
||||
var steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallServerArgsFormat, Config.Default.SteamCmd_AnonymousUsername, this.ProfileSnapshot.InstallDirectory, Config.Default.AppIdServer, steamCmdInstallServerBetaArgs.ToString(), validate ? "validate" : string.Empty);
|
||||
var steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallServerArgsFormat, Config.Default.SteamCmd_AnonymousUsername, this.ProfileSnapshot.InstallDirectory, this.ProfileSnapshot.AppIdServer, steamCmdInstallServerBetaArgs.ToString(), validate ? "validate" : string.Empty);
|
||||
var workingDirectory = Config.Default.DataDir;
|
||||
|
||||
success = await ServerUpdater.UpgradeServerAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, this.ProfileSnapshot.InstallDirectory, Config.Default.SteamCmdRedirectOutput ? serverOutputHandler : null, cancellationToken, steamCmdRemoveQuit ? ProcessWindowStyle.Normal : ProcessWindowStyle.Minimized);
|
||||
|
|
@ -813,16 +814,27 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod {modTitle}.");
|
||||
|
||||
var modCachePath = ModUtils.GetModCachePath(modId, this.ProfileSnapshot.SotFEnabled);
|
||||
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, this.ProfileSnapshot.SotFEnabled);
|
||||
var modPath = ModUtils.GetModPath(this.ProfileSnapshot.InstallDirectory, modId);
|
||||
var modTimeFile = ModUtils.GetLatestModTimeFile(this.ProfileSnapshot.InstallDirectory, modId);
|
||||
|
||||
var modCacheLastUpdated = 0;
|
||||
var downloadMod = true;
|
||||
var copyMod = true;
|
||||
var updateError = false;
|
||||
|
||||
if (modDetail?.creator_app_id != null && !modDetail.creator_app_id.Equals(this.ProfileSnapshot.AppId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************************************************************");
|
||||
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ERROR: Mod cannot be updated, this mod does not belong to this application.");
|
||||
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} ***************************************************************************");
|
||||
|
||||
downloadMod = false;
|
||||
copyMod = false;
|
||||
updateError = true;
|
||||
}
|
||||
|
||||
var modCachePath = ModUtils.GetModCachePath(modId, this.ProfileSnapshot.AppId);
|
||||
var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId, this.ProfileSnapshot.AppId);
|
||||
var modPath = ModUtils.GetModPath(this.ProfileSnapshot.InstallDirectory, modId);
|
||||
var modTimeFile = ModUtils.GetLatestModTimeFile(this.ProfileSnapshot.InstallDirectory, modId);
|
||||
|
||||
if (downloadMod)
|
||||
{
|
||||
// check if the mod needs to be downloaded, or force the download.
|
||||
|
|
@ -895,9 +907,9 @@ namespace ServerManagerTool.Lib
|
|||
var steamCmdArgs = string.Empty;
|
||||
var steamCmdRemoveQuit = CommonConfig.Default.SteamCmdRemoveQuit && !Config.Default.SteamCmdRedirectOutput;
|
||||
if (Config.Default.SteamCmd_UseAnonymousCredentials)
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_AnonymousUsername, this.ProfileSnapshot.SotFEnabled ? Config.Default.AppId_SotF : Config.Default.AppId, modId);
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_AnonymousUsername, this.ProfileSnapshot.AppId, modId);
|
||||
else
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_Username, this.ProfileSnapshot.SotFEnabled ? Config.Default.AppId_SotF : Config.Default.AppId, modId);
|
||||
steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_Username, this.ProfileSnapshot.AppId, modId);
|
||||
var workingDirectory = Config.Default.DataDir;
|
||||
|
||||
modSuccess = await ServerUpdater.UpgradeModsAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, Config.Default.SteamCmdRedirectOutput ? modOutputHandler : null, cancellationToken, steamCmdRemoveQuit ? ProcessWindowStyle.Normal : ProcessWindowStyle.Minimized);
|
||||
|
|
@ -917,7 +929,7 @@ namespace ServerManagerTool.Lib
|
|||
if (modDetail == null || modDetail.time_updated <= 0)
|
||||
{
|
||||
// get the version number from the steamcmd workshop file.
|
||||
steamLastUpdated = ModUtils.GetSteamWorkshopLatestTime(ModUtils.GetSteamWorkshopFile(this.ProfileSnapshot.SotFEnabled), modId).ToString();
|
||||
steamLastUpdated = ModUtils.GetSteamWorkshopLatestTime(ModUtils.GetSteamWorkshopFile(this.ProfileSnapshot.AppId), modId).ToString();
|
||||
}
|
||||
|
||||
// update the last updated file with the steam updated time.
|
||||
|
|
|
|||
|
|
@ -6497,9 +6497,6 @@
|
|||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<cctl:CheckBoxAndTextBlock Name="EnableSOTFCheckbox" IsChecked="{Binding SOTF_Enabled, Mode=TwoWay, NotifyOnSourceUpdated=True}" IsEnabled="{Binding ElementName=EnablePGMCheckbox, Path=IsChecked, Converter={StaticResource InvertBooleanConverter}, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Text="{DynamicResource ServerSettings_EnableSOTFLabel}" ToolTip="{DynamicResource ServerSettings_EnableSOTFTooltip}" VerticalContentAlignment="Center" FontWeight="Bold" SourceUpdated="EnableSOTFCheckbox_SourceUpdated" />
|
||||
<Button Margin="20,5,5,5" Click="HelpSOTF_Click" BorderThickness="0" Background="{StaticResource BeigeGradient}" ToolTip="{DynamicResource ServerSettings_SOTF_HelpTooltip}" Style="{StaticResource ButtonStyle1}">
|
||||
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Help.ico,Size=32}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
|
||||
|
|
|
|||
|
|
@ -658,22 +658,9 @@ namespace ServerManagerTool
|
|||
window.Focus();
|
||||
}
|
||||
|
||||
private void HelpSOTF_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Config.Default.AppUrl_SotF))
|
||||
return;
|
||||
|
||||
Process.Start(Config.Default.AppUrl_SotF);
|
||||
}
|
||||
|
||||
private void PatchNotes_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var url = string.Empty;
|
||||
if (Settings.SOTF_Enabled)
|
||||
url =Config.Default.AppPatchNotesUrlSotF;
|
||||
else
|
||||
url = Config.Default.AppPatchNotesUrl;
|
||||
|
||||
var url = Settings.SOTF_Enabled ? Config.Default.AppPatchNotesUrlSotF : Config.Default.AppPatchNotesUrl;
|
||||
if (string.IsNullOrWhiteSpace(url))
|
||||
return;
|
||||
|
||||
|
|
@ -812,10 +799,8 @@ namespace ServerManagerTool
|
|||
}
|
||||
|
||||
// <data folder>\SteamCMD\steamapps\workshop\content\<app id>
|
||||
if (this.Settings.SOTF_Enabled)
|
||||
folder = Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir, Config.Default.AppSteamWorkshopFolderRelativePath_SotF);
|
||||
else
|
||||
folder = Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir, Config.Default.AppSteamWorkshopFolderRelativePath);
|
||||
var workshopPath = string.Format(Config.Default.AppSteamWorkshopFolderRelativePath, this.Settings.SOTF_Enabled ? Config.Default.AppId_SotF : Config.Default.AppId);
|
||||
folder = Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir, workshopPath);
|
||||
if (Directory.Exists(folder))
|
||||
{
|
||||
foreach (var modFolder in Directory.GetDirectories(folder))
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ namespace ServerManagerTool.Utils
|
|||
return timespan.TotalSeconds;
|
||||
}
|
||||
|
||||
public static string GetLatestModCacheTimeFile(string modId, bool isSotF) => IOUtils.NormalizePath(Path.Combine(GetModCachePath(modId, isSotF), Config.Default.LastUpdatedTimeFile));
|
||||
public static string GetLatestModCacheTimeFile(string modId, string appId) => IOUtils.NormalizePath(Path.Combine(GetModCachePath(modId, appId), Config.Default.LastUpdatedTimeFile));
|
||||
|
||||
public static string GetLatestModTimeFile(string installDirectory, string modId) => IOUtils.NormalizePath(Path.Combine(installDirectory, Config.Default.ServerModsRelativePath, modId, Config.Default.LastUpdatedTimeFile));
|
||||
|
||||
|
|
@ -228,12 +228,10 @@ namespace ServerManagerTool.Utils
|
|||
return mapNames != null && mapNames.Count > 0 ? mapNames[0] : string.Empty;
|
||||
}
|
||||
|
||||
public static string GetModCachePath(string modId, bool isSotF)
|
||||
public static string GetModCachePath(string modId, string appId)
|
||||
{
|
||||
if (isSotF)
|
||||
return IOUtils.NormalizePath(Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir, Config.Default.AppSteamWorkshopFolderRelativePath_SotF, modId));
|
||||
|
||||
return IOUtils.NormalizePath(Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir, Config.Default.AppSteamWorkshopFolderRelativePath, modId));
|
||||
var workshopPath = string.Format(Config.Default.AppSteamWorkshopFolderRelativePath, appId);
|
||||
return IOUtils.NormalizePath(Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir, workshopPath, modId));
|
||||
}
|
||||
|
||||
public static List<string> GetModIdList(string modIds)
|
||||
|
|
@ -272,27 +270,21 @@ namespace ServerManagerTool.Utils
|
|||
var modFolder = GetModPath(installDirectory, modId);
|
||||
var modFile = $"{modFolder}.mod";
|
||||
|
||||
Dictionary<string, string> metaInformation;
|
||||
List<string> mapNames;
|
||||
ReadModFile(modFile, out modId, out metaInformation, out mapNames);
|
||||
ReadModFile(modFile, out _, out Dictionary<string, string> metaInformation, out _);
|
||||
|
||||
return metaInformation != null && metaInformation.ContainsKey("ModType") ? metaInformation["ModType"] : MODTYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
public static string GetSteamManifestFile(string installDirectory, bool isSotF)
|
||||
public static string GetSteamManifestFile(string installDirectory, string appIdServer)
|
||||
{
|
||||
if (isSotF)
|
||||
return IOUtils.NormalizePath(Path.Combine(installDirectory, Config.Default.SteamManifestFolderRelativePath, Config.Default.AppSteamManifestFile_SotF));
|
||||
|
||||
return IOUtils.NormalizePath(Path.Combine(installDirectory, Config.Default.SteamManifestFolderRelativePath, Config.Default.AppSteamManifestFile));
|
||||
var fileName = string.Format(Config.Default.AppSteamManifestFile, appIdServer);
|
||||
return IOUtils.NormalizePath(Path.Combine(installDirectory, Config.Default.SteamManifestFolderRelativePath, fileName));
|
||||
}
|
||||
|
||||
public static string GetSteamWorkshopFile(bool isSotF)
|
||||
public static string GetSteamWorkshopFile(string appId)
|
||||
{
|
||||
if (isSotF)
|
||||
return IOUtils.NormalizePath(Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir, Config.Default.SteamWorkshopFolderRelativePath, Config.Default.AppSteamWorkshopFile_SotF));
|
||||
|
||||
return IOUtils.NormalizePath(Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir, Config.Default.SteamWorkshopFolderRelativePath, Config.Default.AppSteamWorkshopFile));
|
||||
var fileName = string.Format(Config.Default.AppSteamWorkshopFile, appId);
|
||||
return IOUtils.NormalizePath(Path.Combine(Config.Default.DataDir, Config.Default.SteamCmdDir, Config.Default.SteamWorkshopFolderRelativePath, fileName));
|
||||
}
|
||||
|
||||
public static int GetSteamWorkshopLatestTime(string workshopFile, string modId)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,29 @@
|
|||
<link href="https://arkservermanager.freeforums.net/" />
|
||||
<updated>2022-07-25T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:84E1DDF9-EFA4-4A8B-90DE-564AE3B3B633</id>
|
||||
<title>1.1.437 (1.1.437.1)</title>
|
||||
<summary>1.1.437.1</summary>
|
||||
<link href="" />
|
||||
<updated>2022-08-07T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Server Update - updated the code to simplify which set of dedicated server files (Ark Survival Evolved or Ark: SotF) is required when performing server and mod file updates. Separate Cache folders will be maintained for each.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B</id>
|
||||
<title>1.1.436 (1.1.436.4)</title>
|
||||
|
|
|
|||
|
|
@ -5,96 +5,21 @@
|
|||
<title>Ark Server Manager Version Feed</title>
|
||||
<subtitle>This is the Ark Server Manager beta version feed.</subtitle>
|
||||
<link href="https://arkservermanager.freeforums.net/" />
|
||||
<updated>2022-07-25T00:00:00Z</updated>
|
||||
<updated>2022-08-07T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B</id>
|
||||
<title>1.1.436 (1.1.436.4)</title>
|
||||
<summary>1.1.436.4</summary>
|
||||
<id>urn:uuid:84E1DDF9-EFA4-4A8B-90DE-564AE3B3B633</id>
|
||||
<title>1.1.437 (1.1.437.1)</title>
|
||||
<summary>1.1.437.1</summary>
|
||||
<link href="" />
|
||||
<updated>2022-07-25T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">BUGFIX</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Fixed a crash bug when trying to set the logging folder.</li>
|
||||
</ul>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>zh-CN Translation file updated.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B</id>
|
||||
<title>1.1.436 (1.1.436.3)</title>
|
||||
<summary>1.1.436.3</summary>
|
||||
<link href="" />
|
||||
<updated>2022-07-21T00:00:00Z</updated>
|
||||
<updated>2022-08-07T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>ru-RU Translation file updated.</li>
|
||||
<li>tr-TR Translation file updated.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B</id>
|
||||
<title>1.1.436 (1.1.436.2)</title>
|
||||
<summary>1.1.436.2</summary>
|
||||
<link href="" />
|
||||
<updated>2022-07-16T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">BUGFIX</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Added a check for a valid configuration file when starting the server manager.\r\nIf config file is not valid, then it will delete the config file and shutdown the manager, with a message to restart the manager.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B</id>
|
||||
<title>1.1.436 (1.1.436.1)</title>
|
||||
<summary>1.1.436.1</summary>
|
||||
<link href="" />
|
||||
<updated>2022-07-15T00:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">BUGFIX</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Server Status - changed the server status code to stop the status cycling and to be more accurate.</li>
|
||||
<li>Server Update - updated the code to simplify which set of dedicated server files (Ark Survival Evolved or Ark: SotF) is required when performing server and mod file updates. Separate Cache folders will be maintained for each.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ namespace ServerManagerTool
|
|||
{
|
||||
try
|
||||
{
|
||||
WorkshopFiles = await LoadWorkshopItemsAsync(_profile.SOTF_Enabled);
|
||||
WorkshopFiles = await LoadWorkshopItemsAsync();
|
||||
await LoadModsFromProfile();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -156,7 +156,7 @@ namespace ServerManagerTool
|
|||
|
||||
try
|
||||
{
|
||||
WorkshopFiles = await LoadWorkshopItemsAsync(_profile.SOTF_Enabled);
|
||||
WorkshopFiles = await LoadWorkshopItemsAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -506,12 +506,15 @@ namespace ServerManagerTool
|
|||
ModDetailsChanged = true;
|
||||
}
|
||||
|
||||
private async Task<WorkshopFileList> LoadWorkshopItemsAsync(bool isSotF)
|
||||
private async Task<WorkshopFileList> LoadWorkshopItemsAsync()
|
||||
{
|
||||
WorkshopFileDetailResponse localCache = null;
|
||||
|
||||
var appId = _profile.SOTF_Enabled ? Config.Default.AppId_SotF : Config.Default.AppId;
|
||||
var workshopCacheFile = string.Format(Config.Default.WorkshopCacheFile, appId);
|
||||
|
||||
await Task.Run(() => {
|
||||
var file = Path.Combine(Config.Default.DataDir, isSotF ? Config.Default.WorkshopCacheFile_SotF : Config.Default.WorkshopCacheFile);
|
||||
var file = Path.Combine(Config.Default.DataDir, workshopCacheFile);
|
||||
|
||||
// try to load the cache file.
|
||||
localCache = WorkshopFileDetailResponse.Load(file);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ namespace ServerManagerTool
|
|||
private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance;
|
||||
private readonly ServerProfile _profile = null;
|
||||
private ModDetailList _modDetails = null;
|
||||
private readonly bool _isSotF = false;
|
||||
|
||||
private readonly ModDetailsWindow _window = null;
|
||||
|
||||
|
|
@ -40,7 +39,6 @@ namespace ServerManagerTool
|
|||
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
|
||||
|
||||
_profile = profile;
|
||||
_isSotF = _profile?.SOTF_Enabled ?? false;
|
||||
this.Title = string.Format(_globalizer.GetResourceString("WorkshopFiles_ProfileTitle"), _profile?.ProfileName);
|
||||
|
||||
UpdateModDetailsList(modDetails);
|
||||
|
|
@ -55,7 +53,6 @@ namespace ServerManagerTool
|
|||
|
||||
_window = window;
|
||||
_profile = profile;
|
||||
_isSotF = _profile?.SOTF_Enabled ?? false;
|
||||
this.Title = string.Format(_globalizer.GetResourceString("WorkshopFiles_ProfileTitle"), _profile?.ProfileName);
|
||||
|
||||
UpdateModDetailsList(window?.ModDetails);
|
||||
|
|
@ -164,8 +161,11 @@ namespace ServerManagerTool
|
|||
WorkshopFileDetailResponse localCache = null;
|
||||
WorkshopFileDetailResponse steamCache = null;
|
||||
|
||||
var appId = _profile.SOTF_Enabled ? Config.Default.AppId_SotF : Config.Default.AppId;
|
||||
var workshopCacheFile = string.Format(Config.Default.WorkshopCacheFile, appId);
|
||||
|
||||
await Task.Run( () => {
|
||||
var file = Path.Combine(Config.Default.DataDir, _isSotF ? Config.Default.WorkshopCacheFile_SotF : Config.Default.WorkshopCacheFile);
|
||||
var file = Path.Combine(Config.Default.DataDir, workshopCacheFile);
|
||||
|
||||
// try to load the cache file.
|
||||
localCache = WorkshopFileDetailResponse.Load(file);
|
||||
|
|
@ -178,7 +178,7 @@ namespace ServerManagerTool
|
|||
// check if the cache exists
|
||||
if (steamCache == null)
|
||||
{
|
||||
steamCache = SteamUtils.GetSteamModDetails(_isSotF ? Config.Default.AppId_SotF : Config.Default.AppId);
|
||||
steamCache = SteamUtils.GetSteamModDetails(appId);
|
||||
if (steamCache != null)
|
||||
steamCache.Save(file);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue