diff --git a/src/ARKServerManager/App.config b/src/ARKServerManager/App.config
index 09547b9e..173f4c09 100644
--- a/src/ARKServerManager/App.config
+++ b/src/ARKServerManager/App.config
@@ -71,9 +71,6 @@
.profile
-
- Ark Server Manager
- ShooterGameServer
@@ -110,12 +107,6 @@
https://survivetheark.com/index.php?/forums/forum/9-changelog-patch-notes/
-
- https://store.steampowered.com/app/346110/
-
-
- https://store.steampowered.com/app/407530/
- LastUpdatedASM.txt
@@ -126,7 +117,7 @@
+login {0} +workshop_download_item {1} {2} +quit
- steamapps\workshop\content\346110\
+ steamapps\workshop\content\{0}\ShooterGame\Content\Mods
@@ -138,7 +129,7 @@
ShooterGame\Saved
- workshopcache_346110.json
+ workshopcache_{0}.jsonanonymous
@@ -150,16 +141,7 @@
steamapps\workshop
- appworkshop_346110.acf
-
-
- appworkshop_407530.acf
-
-
- steamapps\workshop\content\407530\
-
-
- workshopcache_407530.json
+ appworkshop_{0}.acf346110
@@ -303,10 +285,7 @@
__
- appmanifest_376030.acf
-
-
- appmanifest_407530.acf
+ appmanifest_{0}.acfsteamapps
diff --git a/src/ARKServerManager/Config.Designer.cs b/src/ARKServerManager/Config.Designer.cs
index 19f9eea0..e2136a7b 100644
--- a/src/ARKServerManager/Config.Designer.cs
+++ b/src/ARKServerManager/Config.Designer.cs
@@ -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")]
diff --git a/src/ARKServerManager/Config.settings b/src/ARKServerManager/Config.settings
index db6412d8..3245b804 100644
--- a/src/ARKServerManager/Config.settings
+++ b/src/ARKServerManager/Config.settings
@@ -56,9 +56,6 @@
-
- Ark Server Manager
- ShooterGameServer
@@ -164,12 +161,6 @@
https://survivetheark.com/index.php?/forums/forum/9-changelog-patch-notes/
-
- https://store.steampowered.com/app/346110/
-
-
- https://store.steampowered.com/app/407530/
- True
@@ -207,7 +198,7 @@
+login {0} +workshop_download_item {1} {2} +quit
- steamapps\workshop\content\346110\
+ steamapps\workshop\content\{0}\ShooterGame\Content\Mods
@@ -240,7 +231,7 @@
- workshopcache_346110.json
+ workshopcache_{0}.json
@@ -288,7 +279,7 @@
steamapps\workshop
- appworkshop_346110.acf
+ appworkshop_{0}.acf
@@ -305,15 +296,6 @@
False
-
- appworkshop_407530.acf
-
-
- steamapps\workshop\content\407530\
-
-
- workshopcache_407530.json
- 346110
@@ -585,10 +567,7 @@
__
- appmanifest_376030.acf
-
-
- appmanifest_407530.acf
+ appmanifest_{0}.acfsteamapps
diff --git a/src/ARKServerManager/Lib/BranchSnapshot.cs b/src/ARKServerManager/Lib/BranchSnapshot.cs
index fea33d85..8707aa13 100644
--- a/src/ARKServerManager/Lib/BranchSnapshot.cs
+++ b/src/ARKServerManager/Lib/BranchSnapshot.cs
@@ -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();
}
}
}
diff --git a/src/ARKServerManager/Lib/ServerApp.cs b/src/ARKServerManager/Lib/ServerApp.cs
index b4206b50..6949fded 100644
--- a/src/ARKServerManager/Lib/ServerApp.cs
+++ b/src/ARKServerManager/Lib/ServerApp.cs
@@ -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();
- 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();
+ var updateMods = new List<(string AppId, List 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 { 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 { 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 { 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 ?? ""}");
-
- 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 ?? ""}");
+
+ 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 GetModList()
+ private List<(string AppId, List ModIdList)> GetModList()
{
- var modIdList = new List();
+ var appMods = new List<(string AppId, List 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();
+
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();
+
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();
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;
}
diff --git a/src/ARKServerManager/Lib/ServerProfile.cs b/src/ARKServerManager/Lib/ServerProfile.cs
index 1bffbf7e..3bc67640 100644
--- a/src/ARKServerManager/Lib/ServerProfile.cs
+++ b/src/ARKServerManager/Lib/ServerProfile.cs
@@ -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;
diff --git a/src/ARKServerManager/Lib/ServerProfileSnapshot.cs b/src/ARKServerManager/Lib/ServerProfileSnapshot.cs
index 86c3acdf..f56218f5 100644
--- a/src/ARKServerManager/Lib/ServerProfileSnapshot.cs
+++ b/src/ARKServerManager/Lib/ServerProfileSnapshot.cs
@@ -29,13 +29,15 @@ namespace ServerManagerTool.Lib
public string ServerMap;
public string ServerMapModId;
public string TotalConversionModId;
- public IEnumerable ServerModIds;
+ public List 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,
diff --git a/src/ARKServerManager/Lib/ServerRuntime.cs b/src/ARKServerManager/Lib/ServerRuntime.cs
index 00a6f3d6..7e956240 100644
--- a/src/ARKServerManager/Lib/ServerRuntime.cs
+++ b/src/ARKServerManager/Lib/ServerRuntime.cs
@@ -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.
diff --git a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml
index 55638f78..6d05d915 100644
--- a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml
+++ b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml
@@ -6497,9 +6497,6 @@
-
diff --git a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs
index 84adc532..a6766b9d 100644
--- a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs
+++ b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs
@@ -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
}
// \SteamCMD\steamapps\workshop\content\
- 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))
diff --git a/src/ARKServerManager/Utils/ModUtils.cs b/src/ARKServerManager/Utils/ModUtils.cs
index 89d6828d..1e74a68a 100644
--- a/src/ARKServerManager/Utils/ModUtils.cs
+++ b/src/ARKServerManager/Utils/ModUtils.cs
@@ -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 GetModIdList(string modIds)
@@ -272,27 +270,21 @@ namespace ServerManagerTool.Utils
var modFolder = GetModPath(installDirectory, modId);
var modFile = $"{modFolder}.mod";
- Dictionary metaInformation;
- List mapNames;
- ReadModFile(modFile, out modId, out metaInformation, out mapNames);
+ ReadModFile(modFile, out _, out Dictionary 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)
diff --git a/src/ARKServerManager/VersionFeed.xml b/src/ARKServerManager/VersionFeed.xml
index 36c19a1c..6ba5d3f0 100644
--- a/src/ARKServerManager/VersionFeed.xml
+++ b/src/ARKServerManager/VersionFeed.xml
@@ -7,6 +7,29 @@
2022-07-25T00:00:00Z
+
+ urn:uuid:84E1DDF9-EFA4-4A8B-90DE-564AE3B3B633
+ 1.1.437 (1.1.437.1)
+ 1.1.437.1
+
+ 2022-08-07T00:00:00Z
+
+
+
+ CHANGE
+
+
+
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.
+
+
+
+
+
+ bletch
+ bletch1971@hotmail.com
+
+
+
urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B1.1.436 (1.1.436.4)
diff --git a/src/ARKServerManager/VersionFeedBeta.xml b/src/ARKServerManager/VersionFeedBeta.xml
index 10ed4247..244e2b01 100644
--- a/src/ARKServerManager/VersionFeedBeta.xml
+++ b/src/ARKServerManager/VersionFeedBeta.xml
@@ -5,96 +5,21 @@
Ark Server Manager Version FeedThis is the Ark Server Manager beta version feed.
- 2022-07-25T00:00:00Z
+ 2022-08-07T00:00:00Z
- urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B
- 1.1.436 (1.1.436.4)
- 1.1.436.4
+ urn:uuid:84E1DDF9-EFA4-4A8B-90DE-564AE3B3B633
+ 1.1.437 (1.1.437.1)
+ 1.1.437.1
- 2022-07-25T00:00:00Z
-
-
-
- BUGFIX
-
-
-
Fixed a crash bug when trying to set the logging folder.
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.
Server Status - changed the server status code to stop the status cycling and to be more accurate.
+
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.
diff --git a/src/ARKServerManager/Windows/ModDetailsWindow.xaml.cs b/src/ARKServerManager/Windows/ModDetailsWindow.xaml.cs
index 861d682b..6b4956fb 100644
--- a/src/ARKServerManager/Windows/ModDetailsWindow.xaml.cs
+++ b/src/ARKServerManager/Windows/ModDetailsWindow.xaml.cs
@@ -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 LoadWorkshopItemsAsync(bool isSotF)
+ private async Task 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);
diff --git a/src/ARKServerManager/Windows/WorkshopFilesWindow.xaml.cs b/src/ARKServerManager/Windows/WorkshopFilesWindow.xaml.cs
index 2252abb0..adfd392e 100644
--- a/src/ARKServerManager/Windows/WorkshopFilesWindow.xaml.cs
+++ b/src/ARKServerManager/Windows/WorkshopFilesWindow.xaml.cs
@@ -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
diff --git a/src/ConanServerManager/App.config b/src/ConanServerManager/App.config
index 6154eb44..da2c6d77 100644
--- a/src/ConanServerManager/App.config
+++ b/src/ConanServerManager/App.config
@@ -74,9 +74,6 @@
https://forums.funcom.com/c/conan-exiles/Patch-Notes
-
- https://store.steampowered.com/app/440900/
- LastUpdatedSM.txt
@@ -87,7 +84,7 @@
+login {0} +workshop_download_item {1} {2} +quit
- steamapps\workshop\content\440900\
+ steamapps\workshop\content\{0}\ConanSandbox\Mods
@@ -96,7 +93,7 @@
ConanSandbox\Saved
- workshopcache_440900.json
+ workshopcache_{0}.jsonanonymous
@@ -105,7 +102,7 @@
steamapps\workshop
- appworkshop_440900.acf
+ appworkshop_{0}.acf440900
@@ -219,7 +216,7 @@
__
- appmanifest_443030.acf
+ appmanifest_{0}.acfsteamapps
@@ -287,6 +284,15 @@
3072
+
+ 931180
+
+
+ 931580
+
+
+ https://forums.funcom.com/c/conan-exiles/exiles-pc/testlive
+
diff --git a/src/ConanServerManager/Config.Designer.cs b/src/ConanServerManager/Config.Designer.cs
index d2b7858a..255f3bfc 100644
--- a/src/ConanServerManager/Config.Designer.cs
+++ b/src/ConanServerManager/Config.Designer.cs
@@ -273,15 +273,6 @@ namespace ServerManagerTool {
}
}
- [global::System.Configuration.ApplicationScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("https://store.steampowered.com/app/440900/")]
- public string AppUrl {
- get {
- return ((string)(this["AppUrl"]));
- }
- }
-
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
@@ -421,7 +412,7 @@ namespace ServerManagerTool {
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("steamapps\\workshop\\content\\440900\\")]
+ [global::System.Configuration.DefaultSettingValueAttribute("steamapps\\workshop\\content\\{0}\\")]
public string AppSteamWorkshopFolderRelativePath {
get {
return ((string)(this["AppSteamWorkshopFolderRelativePath"]));
@@ -532,7 +523,7 @@ namespace ServerManagerTool {
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("workshopcache_440900.json")]
+ [global::System.Configuration.DefaultSettingValueAttribute("workshopcache_{0}.json")]
public string WorkshopCacheFile {
get {
return ((string)(this["WorkshopCacheFile"]));
@@ -703,7 +694,7 @@ namespace ServerManagerTool {
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("appworkshop_440900.acf")]
+ [global::System.Configuration.DefaultSettingValueAttribute("appworkshop_{0}.acf")]
public string AppSteamWorkshopFile {
get {
return ((string)(this["AppSteamWorkshopFile"]));
@@ -1485,7 +1476,7 @@ namespace ServerManagerTool {
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("appmanifest_443030.acf")]
+ [global::System.Configuration.DefaultSettingValueAttribute("appmanifest_{0}.acf")]
public string AppSteamManifestFile {
get {
return ((string)(this["AppSteamManifestFile"]));
@@ -2444,5 +2435,32 @@ namespace ServerManagerTool {
return ((int)(this["ServicePointManager_SecurityProtocol"]));
}
}
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("931180")]
+ public string AppId_Testlive {
+ get {
+ return ((string)(this["AppId_Testlive"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("931580")]
+ public string AppIdServer_Testlive {
+ get {
+ return ((string)(this["AppIdServer_Testlive"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("https://forums.funcom.com/c/conan-exiles/exiles-pc/testlive")]
+ public string AppPatchNotesUrl_Testlive {
+ get {
+ return ((string)(this["AppPatchNotesUrl_Testlive"]));
+ }
+ }
}
}
diff --git a/src/ConanServerManager/Config.settings b/src/ConanServerManager/Config.settings
index 8349b5f1..3bbc978f 100644
--- a/src/ConanServerManager/Config.settings
+++ b/src/ConanServerManager/Config.settings
@@ -77,9 +77,6 @@
https://forums.funcom.com/c/conan-exiles/Patch-Notes
-
- https://store.steampowered.com/app/440900/
- True
@@ -117,7 +114,7 @@
+login {0} +workshop_download_item {1} {2} +quit
- steamapps\workshop\content\440900\
+ steamapps\workshop\content\{0}\ConanSandbox\Mods
@@ -147,7 +144,7 @@
- workshopcache_440900.json
+ workshopcache_{0}.json
@@ -192,7 +189,7 @@
steamapps\workshop
- appworkshop_440900.acf
+ appworkshop_{0}.acf
@@ -414,7 +411,7 @@
__
- appmanifest_443030.acf
+ appmanifest_{0}.acfsteamapps
@@ -671,5 +668,14 @@
3072
+
+ 931180
+
+
+ 931580
+
+
+ https://forums.funcom.com/c/conan-exiles/exiles-pc/testlive
+
\ No newline at end of file
diff --git a/src/ConanServerManager/Globalization/en-US/en-US.xaml b/src/ConanServerManager/Globalization/en-US/en-US.xaml
index e54bdc83..2f24f2ee 100644
--- a/src/ConanServerManager/Globalization/en-US/en-US.xaml
+++ b/src/ConanServerManager/Globalization/en-US/en-US.xaml
@@ -1276,6 +1276,9 @@
Server Details
+ Use Testlive Dedicated Server Files
+ If enabled, will use the testlive dedicated server files instead of the testlive branch. Leave the branch as default, do not set to Testlive.
+
Branch DetailsBranch Name:The name of the branch to download (leave blank to use the release branch).
diff --git a/src/ConanServerManager/Lib/BranchSnapshot.cs b/src/ConanServerManager/Lib/BranchSnapshot.cs
index fea33d85..ba0fb765 100644
--- a/src/ConanServerManager/Lib/BranchSnapshot.cs
+++ b/src/ConanServerManager/Lib/BranchSnapshot.cs
@@ -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.UseTestlive ? Config.Default.AppIdServer_Testlive : 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();
}
}
}
diff --git a/src/ConanServerManager/Lib/ServerApp.cs b/src/ConanServerManager/Lib/ServerApp.cs
index d445215a..4e05fb91 100644
--- a/src/ConanServerManager/Lib/ServerApp.cs
+++ b/src/ConanServerManager/Lib/ServerApp.cs
@@ -787,7 +787,7 @@ namespace ServerManagerTool.Lib
}
}
- steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallServerArgsFormat, Config.Default.SteamCmd_AnonymousUsername, _profile.InstallDirectory, 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;
@@ -882,8 +882,8 @@ namespace ServerManagerTool.Lib
LogProfileMessage($"{modDetail.title}.\r\n");
}
- var modCachePath = ModUtils.GetModCachePath(modId);
- var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId);
+ 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);
@@ -963,13 +963,9 @@ namespace ServerManagerTool.Lib
steamCmdArgs = string.Empty;
if (Config.Default.SteamCmd_UseAnonymousCredentials)
- {
- steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_AnonymousUsername, Config.Default.AppId, modId);
- }
+ steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_AnonymousUsername, _profile.AppId, modId);
else
- {
- steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_Username, Config.Default.AppId, modId);
- }
+ steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_Username, _profile.AppId, modId);
modSuccess = ServerUpdater.UpgradeModsAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, Config.Default.SteamCmdRedirectOutput ? modOutputHandler : null, cancellationToken, SteamCMDProcessWindowStyle).Result;
if (modSuccess && downloadSuccessful)
@@ -988,7 +984,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(), modId).ToString();
+ steamLastUpdated = ModUtils.GetSteamWorkshopLatestTime(ModUtils.GetSteamWorkshopFile(_profile.AppId), modId).ToString();
}
// update the last updated file with the steam updated time.
@@ -1156,26 +1152,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();
- 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));
- 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)
@@ -1272,7 +1274,7 @@ namespace ServerManagerTool.Lib
try
{
- var cacheFolder = GetServerCacheFolder(_profile?.BranchName);
+ var cacheFolder = GetServerCacheFolder(_profile?.AppIdServer, _profile?.BranchName);
if (Directory.Exists(cacheFolder))
{
@@ -1293,14 +1295,14 @@ namespace ServerManagerTool.Lib
_profile.LastInstalledVersion = GetServerVersion(GetServerVersionFile()).ToString();
LogProfileMessage("Updated server from cache. See patch notes.");
- LogProfileMessage(Config.Default.AppPatchNotesUrl);
+ LogProfileMessage(_profile.UseTestlive ? Config.Default.AppPatchNotesUrl_Testlive : 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.UseTestlive ? Config.Default.AppPatchNotesUrl_Testlive : Config.Default.AppPatchNotesUrl);
_profile.ServerUpdated = true;
}
@@ -1346,7 +1348,7 @@ namespace ServerManagerTool.Lib
for (var index = 0; index < updateModIds.Count; index++)
{
var modId = updateModIds[index];
- var modCachePath = ModUtils.GetModCachePath(modId);
+ 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;
@@ -1431,7 +1433,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.");
}
@@ -1464,7 +1466,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.");
@@ -1500,10 +1502,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;
@@ -1515,12 +1517,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)
@@ -1538,19 +1541,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();
+ var updateMods = new List<(string AppId, List 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();
}
}
@@ -1559,46 +1562,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);
-
- // 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 { 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 { 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 { 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.");
+ }
}
}
}
@@ -1613,97 +1637,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);
- var modCachePath = ModUtils.GetModCachePath(modId);
-
- 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 ?? ""}");
-
- 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.DataPath;
-
- 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 ?? ""}");
+
+ 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.DataPath;
+
+ 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(), 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("---------------------------");
@@ -1713,13 +1745,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;
@@ -1727,7 +1759,7 @@ namespace ServerManagerTool.Lib
var steamCmdFile = SteamCmdUpdater.GetSteamCmdFile(Config.Default.DataPath);
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;
}
@@ -1735,7 +1767,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;
@@ -1758,9 +1790,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)
@@ -1771,7 +1803,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.DataPath;
var success = ServerUpdater.UpgradeServerAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, cacheFolder, Config.Default.SteamCmdRedirectOutput ? serverOutputHandler : null, CancellationToken.None, SteamCMDProcessWindowStyle).Result;
@@ -1783,7 +1815,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)
@@ -1791,8 +1823,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;
@@ -1810,24 +1842,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;
}
@@ -2207,7 +2239,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));
@@ -2254,9 +2293,9 @@ namespace ServerManagerTool.Lib
return LogManager.GetLogger(loggerName);
}
- private List GetModList()
+ private List<(string AppId, List ModIdList)> GetModList()
{
- var modIdList = new List();
+ var appMods = new List<(string AppId, List ModIdList)>();
// check if we need to update the mods.
if (Config.Default.ServerUpdate_UpdateModsWhenUpdatingServer)
@@ -2270,17 +2309,36 @@ namespace ServerManagerTool.Lib
if (!profile.EnableAutoUpdate)
continue;
+ var modIdList = new List();
+
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();
+
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)
@@ -2337,11 +2395,15 @@ namespace ServerManagerTool.Lib
return IOUtils.NormalizePath(Path.Combine(Config.Default.BackupPath, Config.Default.ServersInstallPath, 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.ServerBinaryRelativePath, Config.Default.ServerExeFile));
+ private static string GetServerCacheVersionFile(string appIdServer, string branchName) => IOUtils.NormalizePath(Path.Combine(GetServerCacheFolder(appIdServer, branchName), Config.Default.ServerBinaryRelativePath, Config.Default.ServerExeFile));
private string GetServerExecutableFile() => IOUtils.NormalizePath(Path.Combine(_profile.InstallDirectory, Config.Default.ServerBinaryRelativePath, Config.Default.ServerExeFile));
@@ -2516,7 +2578,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;
@@ -2526,10 +2588,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;
@@ -2538,7 +2602,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)
@@ -2957,16 +3023,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);
@@ -2987,7 +3054,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)
{
@@ -3000,7 +3067,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)
@@ -3047,47 +3114,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();
if (Config.Default.AutoUpdate_ParallelUpdate)
@@ -3132,27 +3202,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;
}
@@ -3169,8 +3239,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;
}
diff --git a/src/ConanServerManager/Lib/ServerProfile.cs b/src/ConanServerManager/Lib/ServerProfile.cs
index e5bd8ea8..7de09b30 100644
--- a/src/ConanServerManager/Lib/ServerProfile.cs
+++ b/src/ConanServerManager/Lib/ServerProfile.cs
@@ -650,6 +650,14 @@ namespace ServerManagerTool.Lib
#endregion
#region Server Details
+ public static readonly DependencyProperty UseTestliveProperty = DependencyProperty.Register(nameof(UseTestlive), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
+ [DataMember]
+ public bool UseTestlive
+ {
+ get { return (bool)GetValue(UseTestliveProperty); }
+ set { SetValue(UseTestliveProperty, value); }
+ }
+
public static readonly DependencyProperty BranchNameProperty = DependencyProperty.Register(nameof(BranchName), typeof(string), typeof(ServerProfile), new PropertyMetadata(String.Empty));
[DataMember]
public string BranchName
@@ -786,7 +794,8 @@ namespace ServerManagerTool.Lib
try
{
- var manifestFile = ModUtils.GetSteamManifestFile(InstallDirectory);
+ var appIdServer = UseTestlive ? Config.Default.AppIdServer_Testlive : Config.Default.AppIdServer;
+ var manifestFile = ModUtils.GetSteamManifestFile(InstallDirectory, appIdServer);
if (string.IsNullOrWhiteSpace(manifestFile) || !File.Exists(manifestFile))
return;
@@ -1256,7 +1265,7 @@ namespace ServerManagerTool.Lib
validationMessage = string.Empty;
StringBuilder result = new StringBuilder();
- var appId = Config.Default.AppId;
+ var appId = UseTestlive ? Config.Default.AppId_Testlive : Config.Default.AppId;
// checking the port values are within the valid range
if (ServerPort < ushort.MinValue || ServerPort > ushort.MaxValue)
@@ -1593,6 +1602,7 @@ namespace ServerManagerTool.Lib
public void ResetServerDetailsSection()
{
+ this.ClearValue(UseTestliveProperty);
this.ClearValue(BranchNameProperty);
this.ClearValue(BranchPasswordProperty);
}
@@ -1680,6 +1690,7 @@ namespace ServerManagerTool.Lib
private void SyncServerDetails(ServerProfile sourceProfile)
{
+ this.SetValue(UseTestliveProperty, sourceProfile.UseTestlive);
this.SetValue(BranchNameProperty, sourceProfile.BranchName);
this.SetValue(BranchPasswordProperty, sourceProfile.BranchPassword);
}
diff --git a/src/ConanServerManager/Lib/ServerProfileSnapshot.cs b/src/ConanServerManager/Lib/ServerProfileSnapshot.cs
index e74521b8..67b39026 100644
--- a/src/ConanServerManager/Lib/ServerProfileSnapshot.cs
+++ b/src/ConanServerManager/Lib/ServerProfileSnapshot.cs
@@ -32,6 +32,9 @@ namespace ServerManagerTool.Lib
public bool MOTDIntervalEnabled;
public int MOTDInterval;
+ public string AppId;
+ public string AppIdServer;
+ public bool UseTestlive;
public string BranchName;
public string BranchPassword;
@@ -75,6 +78,9 @@ namespace ServerManagerTool.Lib
MOTDIntervalEnabled = profile.MOTDIntervalEnabled && !string.IsNullOrWhiteSpace(profile.MOTD),
MOTDInterval = Math.Max(1, Math.Min(int.MaxValue, profile.MOTDInterval)),
+ AppId = profile.UseTestlive ? Config.Default.AppId_Testlive : Config.Default.AppId,
+ AppIdServer = profile.UseTestlive ? Config.Default.AppIdServer_Testlive : Config.Default.AppIdServer,
+ UseTestlive = profile.UseTestlive,
BranchName = profile.BranchName,
BranchPassword = profile.BranchPassword,
diff --git a/src/ConanServerManager/Lib/ServerRuntime.cs b/src/ConanServerManager/Lib/ServerRuntime.cs
index 3ae37ad7..026e3796 100644
--- a/src/ConanServerManager/Lib/ServerRuntime.cs
+++ b/src/ConanServerManager/Lib/ServerRuntime.cs
@@ -659,8 +659,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
@@ -678,8 +680,7 @@ namespace ServerManagerTool.Lib
// Check if this is a new server installation.
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))
@@ -718,7 +719,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.DataPath;
success = await ServerUpdater.UpgradeServerAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, this.ProfileSnapshot.InstallDirectory, Config.Default.SteamCmdRedirectOutput ? serverOutputHandler : null, cancellationToken, steamCmdRemoveQuit ? ProcessWindowStyle.Normal : ProcessWindowStyle.Minimized);
@@ -811,16 +812,27 @@ namespace ServerManagerTool.Lib
progressCallback?.Invoke(0, $"{SteamCmdUpdater.OUTPUT_PREFIX} Mod {modTitle}.");
- var modCachePath = ModUtils.GetModCachePath(modId);
- var cacheTimeFile = ModUtils.GetLatestModCacheTimeFile(modId);
- 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.
@@ -893,9 +905,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, 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, Config.Default.AppId, modId);
+ steamCmdArgs = SteamUtils.BuildSteamCmdArguments(steamCmdRemoveQuit, Config.Default.SteamCmdInstallModArgsFormat, Config.Default.SteamCmd_Username, this.ProfileSnapshot.AppId, modId);
var workingDirectory = Config.Default.DataPath;
modSuccess = await ServerUpdater.UpgradeModsAsync(steamCmdFile, steamCmdArgs, workingDirectory, null, null, Config.Default.SteamCmdRedirectOutput ? modOutputHandler : null, cancellationToken, steamCmdRemoveQuit ? ProcessWindowStyle.Normal : ProcessWindowStyle.Minimized);
@@ -915,7 +927,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(), modId).ToString();
+ steamLastUpdated = ModUtils.GetSteamWorkshopLatestTime(ModUtils.GetSteamWorkshopFile(this.ProfileSnapshot.AppId), modId).ToString();
}
// update the last updated file with the steam updated time.
diff --git a/src/ConanServerManager/UserControls/ServerSettingsControl.xaml b/src/ConanServerManager/UserControls/ServerSettingsControl.xaml
index aed7cf00..199e0db0 100644
--- a/src/ConanServerManager/UserControls/ServerSettingsControl.xaml
+++ b/src/ConanServerManager/UserControls/ServerSettingsControl.xaml
@@ -21,7 +21,7 @@
-
+
@@ -55,6 +55,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -410,7 +444,12 @@
@@ -903,7 +942,12 @@
@@ -1070,7 +1114,12 @@
@@ -1135,7 +1184,12 @@
@@ -1154,7 +1208,40 @@
-
+
+
+
+
+
+
+
diff --git a/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs b/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs
index 490dffe7..9b23ee2a 100644
--- a/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs
+++ b/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs
@@ -440,10 +440,11 @@ namespace ServerManagerTool
private void PatchNotes_Click(object sender, RoutedEventArgs e)
{
- if (string.IsNullOrWhiteSpace(Config.Default.AppPatchNotesUrl))
+ var url = this.Settings.UseTestlive ? Config.Default.AppPatchNotesUrl_Testlive : Config.Default.AppPatchNotesUrl;
+ if (string.IsNullOrWhiteSpace(url))
return;
- Process.Start(Config.Default.AppPatchNotesUrl);
+ Process.Start(url);
}
private void NeedAdmin_Click(object sender, RoutedEventArgs e)
@@ -588,7 +589,8 @@ namespace ServerManagerTool
}
// \SteamCMD\steamapps\workshop\content\
- folder = Path.Combine(Config.Default.DataPath, CommonConfig.Default.SteamCmdRelativePath, Config.Default.AppSteamWorkshopFolderRelativePath);
+ var workshopPath = string.Format(Config.Default.AppSteamWorkshopFolderRelativePath, this.Settings.UseTestlive ? Config.Default.AppId_Testlive : Config.Default.AppId);
+ folder = Path.Combine(Config.Default.DataPath, CommonConfig.Default.SteamCmdRelativePath, workshopPath);
if (Directory.Exists(folder))
{
foreach (var modFolder in Directory.GetDirectories(folder))
diff --git a/src/ConanServerManager/Utils/ModUtils.cs b/src/ConanServerManager/Utils/ModUtils.cs
index f5496cef..4043ae34 100644
--- a/src/ConanServerManager/Utils/ModUtils.cs
+++ b/src/ConanServerManager/Utils/ModUtils.cs
@@ -92,7 +92,7 @@ namespace ServerManagerTool.Utils
}
}
- public static string GetLatestModCacheTimeFile(string modId) => IOUtils.NormalizePath(Path.Combine(GetModCachePath(modId), 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}.txt"));
@@ -104,7 +104,11 @@ namespace ServerManagerTool.Utils
return serverMap.Trim();
}
- public static string GetModCachePath(string modId) => IOUtils.NormalizePath(Path.Combine(Config.Default.DataPath, CommonConfig.Default.SteamCmdRelativePath, Config.Default.AppSteamWorkshopFolderRelativePath, modId));
+ public static string GetModCachePath(string modId, string appId)
+ {
+ var workshopPath = string.Format(Config.Default.AppSteamWorkshopFolderRelativePath, appId);
+ return IOUtils.NormalizePath(Path.Combine(Config.Default.DataPath, CommonConfig.Default.SteamCmdRelativePath, workshopPath, modId));
+ }
public static List GetModIdList(string modIds)
{
@@ -136,9 +140,17 @@ namespace ServerManagerTool.Utils
public static string GetModPath(string installDirectory, string modId) => GetModRootPath(installDirectory);
- public static string GetSteamManifestFile(string installDirectory) => IOUtils.NormalizePath(Path.Combine(installDirectory, Config.Default.SteamManifestFolderRelativePath, Config.Default.AppSteamManifestFile));
+ public static string GetSteamManifestFile(string installDirectory, string appIdServer)
+ {
+ var fileName = string.Format(Config.Default.AppSteamManifestFile, appIdServer);
+ return IOUtils.NormalizePath(Path.Combine(installDirectory, Config.Default.SteamManifestFolderRelativePath, fileName));
+ }
- public static string GetSteamWorkshopFile() => IOUtils.NormalizePath(Path.Combine(Config.Default.DataPath, CommonConfig.Default.SteamCmdRelativePath, Config.Default.SteamWorkshopFolderRelativePath, Config.Default.AppSteamWorkshopFile));
+ public static string GetSteamWorkshopFile(string appId)
+ {
+ var fileName = string.Format(Config.Default.AppSteamWorkshopFile, appId);
+ return IOUtils.NormalizePath(Path.Combine(Config.Default.DataPath, CommonConfig.Default.SteamCmdRelativePath, Config.Default.SteamWorkshopFolderRelativePath, fileName));
+ }
public static int GetSteamWorkshopLatestTime(string workshopFile, string modId)
{
diff --git a/src/ConanServerManager/VersionFeed.xml b/src/ConanServerManager/VersionFeed.xml
index fd69fc74..ed05793b 100644
--- a/src/ConanServerManager/VersionFeed.xml
+++ b/src/ConanServerManager/VersionFeed.xml
@@ -7,6 +7,30 @@
2022-07-15T00:00:00Z
+
+ urn:uuid:6D1F49A0-06E6-415F-AA92-AACD598BC50C
+ 1.1.80 (1.1.80.1)
+ 1.1.80.1
+
+ 2022-08-07T00:00:00Z
+
+
+
+ CHANGE
+
+
+
Server Details Section - added new option to use the Conan Testlive Dedicated Server files. This new option will switch the steam application id of the server files to use the Conan Testlive Dedicated Server files, instead of the Conan Dedicated Server files.
+
Server Update - updated the code to determine which set of dedicated server files (Conan or Conan Testlive) is required when performing server and mod file updates. Separate Cache folders will be maintained for each.
+
+
+
+
+
+ bletch
+ bletch1971@hotmail.com
+
+
+
urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B1.1.79 (1.1.79.3)
diff --git a/src/ConanServerManager/VersionFeedBeta.xml b/src/ConanServerManager/VersionFeedBeta.xml
index ae4edfc5..d763c25a 100644
--- a/src/ConanServerManager/VersionFeedBeta.xml
+++ b/src/ConanServerManager/VersionFeedBeta.xml
@@ -5,67 +5,22 @@
Conan Server Manager Version FeedThis is the Conan Server Manager beta version feed.
- 2022-07-25T00:00:00Z
+ 2022-08-07T00:00:00Z
- urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B
- 1.1.79 (1.1.79.3)
- 1.1.79.3
+ urn:uuid:6D1F49A0-06E6-415F-AA92-AACD598BC50C
+ 1.1.80 (1.1.80.1)
+ 1.1.80.1
- 2022-07-25T00:00:00Z
+ 2022-08-07T00:00:00Z
- BUGFIX
+ CHANGE
-
Fixed a crash bug when trying to set the logging folder.
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.
Server Status - changed the server status code to stop the status cycling and to be more accurate.
+
Server Details Section - added new option to use the Conan Testlive Dedicated Server files. This new option will switch the steam application id of the server files to use the Conan Testlive Dedicated Server files, instead of the Conan Dedicated Server files.
+
Server Update - updated the code to determine which set of dedicated server files (Conan or Conan Testlive) is required when performing server and mod file updates. Separate Cache folders will be maintained for each.
diff --git a/src/ConanServerManager/Windows/ModDetailsWindow.xaml.cs b/src/ConanServerManager/Windows/ModDetailsWindow.xaml.cs
index b9b9f068..aedd2185 100644
--- a/src/ConanServerManager/Windows/ModDetailsWindow.xaml.cs
+++ b/src/ConanServerManager/Windows/ModDetailsWindow.xaml.cs
@@ -479,8 +479,11 @@ namespace ServerManagerTool
{
WorkshopFileDetailResponse localCache = null;
+ var appId = _profile.UseTestlive ? Config.Default.AppId_Testlive : Config.Default.AppId;
+ var workshopCacheFile = string.Format(Config.Default.WorkshopCacheFile, appId);
+
await Task.Run(() => {
- var file = Path.Combine(Config.Default.DataPath, Config.Default.WorkshopCacheFile);
+ var file = Path.Combine(Config.Default.DataPath, workshopCacheFile);
// try to load the cache file.
localCache = WorkshopFileDetailResponse.Load(file);
diff --git a/src/ConanServerManager/Windows/WorkshopFilesWindow.xaml.cs b/src/ConanServerManager/Windows/WorkshopFilesWindow.xaml.cs
index eb7c2755..307682af 100644
--- a/src/ConanServerManager/Windows/WorkshopFilesWindow.xaml.cs
+++ b/src/ConanServerManager/Windows/WorkshopFilesWindow.xaml.cs
@@ -160,8 +160,11 @@ namespace ServerManagerTool
WorkshopFileDetailResponse localCache = null;
WorkshopFileDetailResponse steamCache = null;
+ var appId = _profile.UseTestlive ? Config.Default.AppId_Testlive : Config.Default.AppId;
+ var workshopCacheFile = string.Format(Config.Default.WorkshopCacheFile, appId);
+
await Task.Run( () => {
- var file = Path.Combine(Config.Default.DataPath, Config.Default.WorkshopCacheFile);
+ var file = Path.Combine(Config.Default.DataPath, workshopCacheFile);
// try to load the cache file.
localCache = WorkshopFileDetailResponse.Load(file);
@@ -174,7 +177,7 @@ namespace ServerManagerTool
// check if the cache exists
if (steamCache == null)
{
- steamCache = SteamUtils.GetSteamModDetails(Config.Default.AppId);
+ steamCache = SteamUtils.GetSteamModDetails(appId);
if (steamCache != null)
steamCache.Save(file);
else
diff --git a/src/ServerManager.Common/Utils/SteamUtils.cs b/src/ServerManager.Common/Utils/SteamUtils.cs
index 0af660d2..77aeb06e 100644
--- a/src/ServerManager.Common/Utils/SteamUtils.cs
+++ b/src/ServerManager.Common/Utils/SteamUtils.cs
@@ -74,6 +74,14 @@ namespace ServerManagerTool.Common.Utils
}
public static PublishedFileDetailsResponse GetSteamModDetails(List modIdList)
+ {
+ return GetSteamModDetails(new List<(string AppId, List ModIdList)>()
+ {
+ ("", modIdList),
+ });
+ }
+
+ public static PublishedFileDetailsResponse GetSteamModDetails(List<(string AppId, List ModIdList)> appMods)
{
const int MAX_IDS = 20;
@@ -83,57 +91,63 @@ namespace ServerManagerTool.Common.Utils
try
{
- if (modIdList == null || modIdList.Count == 0)
+ if (appMods == null || appMods.Count == 0)
return new PublishedFileDetailsResponse();
- int remainder;
- var totalRequests = Math.DivRem(modIdList.Count, MAX_IDS, out remainder);
- if (remainder > 0)
- totalRequests++;
-
- var requestIndex = 0;
- while (requestIndex < totalRequests)
+ foreach (var appMod in appMods)
{
- var count = 0;
- var postData = "";
- for (var index = requestIndex * MAX_IDS; count < MAX_IDS && index < modIdList.Count; index++)
+ if (appMod.ModIdList.Count == 0)
+ continue;
+
+ int remainder;
+ var totalRequests = Math.DivRem(appMod.ModIdList.Count, MAX_IDS, out remainder);
+ if (remainder > 0)
+ totalRequests++;
+
+ var requestIndex = 0;
+ while (requestIndex < totalRequests)
{
- postData += $"&publishedfileids[{count}]={modIdList[index]}";
- count++;
- }
-
- postData = $"key={SteamWebApiKey}&format=json&itemcount={count}{postData}";
-
- var data = Encoding.ASCII.GetBytes(postData);
-
- var httpRequest = WebRequest.Create("https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/");
- httpRequest.Timeout = 30000;
- httpRequest.Method = "POST";
- httpRequest.ContentType = "application/x-www-form-urlencoded";
- httpRequest.ContentLength = data.Length;
-
- using (var stream = httpRequest.GetRequestStream())
- {
- stream.Write(data, 0, data.Length);
- }
-
- var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
- var responseString = new StreamReader(httpResponse.GetResponseStream()).ReadToEnd();
-
- var result = JsonUtils.Deserialize(responseString);
- if (result != null && result.response != null)
- {
- if (response == null)
- response = result.response;
- else
+ var count = 0;
+ var postData = "";
+ for (var index = requestIndex * MAX_IDS; count < MAX_IDS && index < appMod.ModIdList.Count; index++)
{
- response.resultcount += result.response.resultcount;
- response.publishedfiledetails.AddRange(result.response.publishedfiledetails);
+ postData += $"&publishedfileids[{count}]={appMod.ModIdList[index]}";
+ count++;
}
- }
- requestIndex++;
- };
+ postData = $"key={SteamWebApiKey}&format=json&itemcount={count}{postData}";
+
+ var data = Encoding.ASCII.GetBytes(postData);
+
+ var httpRequest = WebRequest.Create("https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/");
+ httpRequest.Timeout = 30000;
+ httpRequest.Method = "POST";
+ httpRequest.ContentType = "application/x-www-form-urlencoded";
+ httpRequest.ContentLength = data.Length;
+
+ using (var stream = httpRequest.GetRequestStream())
+ {
+ stream.Write(data, 0, data.Length);
+ }
+
+ var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
+ var responseString = new StreamReader(httpResponse.GetResponseStream()).ReadToEnd();
+
+ var result = JsonUtils.Deserialize(responseString);
+ if (result != null && result.response != null)
+ {
+ if (response == null)
+ response = result.response;
+ else
+ {
+ response.resultcount += result.response.resultcount;
+ response.publishedfiledetails.AddRange(result.response.publishedfiledetails);
+ }
+ }
+
+ requestIndex++;
+ };
+ }
return response ?? new PublishedFileDetailsResponse();
}