Finished BackupServer and UpdateServer

This commit is contained in:
Brett Hewitson 2021-12-05 01:56:11 +10:00
parent 824daed0d1
commit 0f3c6e6be9
28 changed files with 618 additions and 216 deletions

View file

@ -2,6 +2,7 @@
using ServerManagerTool.Common.Lib;
using ServerManagerTool.Common.Model;
using ServerManagerTool.Common.Utils;
using ServerManagerTool.Delegates;
using ServerManagerTool.Enums;
using ServerManagerTool.Plugin.Common;
using ServerManagerTool.Utils;
@ -105,6 +106,7 @@ namespace ServerManagerTool.Lib
public int ShutdownInterval = Config.Default.ServerShutdown_GracePeriod;
public ProgressDelegate ProgressCallback = null;
public ProcessWindowStyle SteamCMDProcessWindowStyle = ProcessWindowStyle.Minimized;
public ServerStatusChangeDelegate ServerStatusChangeCallback = null;
public ServerApp(bool resetStartTime = false)
{
@ -264,7 +266,15 @@ namespace ServerManagerTool.Lib
if (updateServer)
{
UpgradeLocal(true, cancellationToken, true);
try
{
ServerStatusChangeCallback?.Invoke(ServerStatus.Updating);
UpgradeLocal(true, cancellationToken, true);
}
finally
{
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped);
}
}
if (ExitCode != EXITCODE_NORMALEXIT)
@ -2869,7 +2879,7 @@ namespace ServerManagerTool.Lib
return ExitCode;
}
public int PerformProfileUpdate(ServerBranchSnapshot branch, ServerProfileSnapshot profile)
public int PerformProfileUpdate(BranchSnapshot branch, ServerProfileSnapshot profile)
{
_profile = profile;
@ -2945,7 +2955,7 @@ namespace ServerManagerTool.Lib
return ExitCode;
}
public int PerformServerBranchUpdate(ServerBranchSnapshot branch)
public int PerformServerBranchUpdate(BranchSnapshot branch)
{
if (branch == null)
return EXITCODE_NORMALEXIT;
@ -3233,8 +3243,8 @@ namespace ServerManagerTool.Lib
if (exitCode == EXITCODE_NORMALEXIT)
{
var branches = _profiles.Keys.Where(p => p.EnableAutoUpdate).Select(p => new ServerBranchSnapshot() { BranchName = p.BranchName, BranchPassword = p.BranchPassword}).Distinct(new ServerBranchSnapshotComparer()).ToArray();
var exitCodes = new ConcurrentDictionary<ServerBranchSnapshot, int>();
var branches = _profiles.Keys.Where(p => p.EnableAutoUpdate).Select(p => BranchSnapshot.Create(p)).Distinct(new BranchSnapshotComparer()).ToArray();
var exitCodes = new ConcurrentDictionary<BranchSnapshot, int>();
// update the server cache for each branch
if (Config.Default.AutoUpdate_ParallelUpdate)