Automatic Management Changes

- rearranged the options so they are grouped correctly.
- added RestartIfShutdown property to ServerApp and changed to use when checking to restart server.
This commit is contained in:
Brett Hewitson 2022-08-08 20:01:42 +10:00
parent d9571943ad
commit 5532050c04
20 changed files with 157 additions and 92 deletions

View file

@ -107,6 +107,7 @@ namespace ServerManagerTool.Lib
public bool OutputLogs { get; set; } = false;
public bool PerformWorldSave { get; set; } = Config.Default.ServerShutdown_EnableWorldSave;
public ProgressDelegate ProgressCallback { get; set; } = null;
public bool RestartIfShutdown { get; set; } = false;
public bool SendAlerts { get; set; } = false;
public bool SendEmails { get; set; } = false;
public bool SendShutdownMessages { get; set; } = Config.Default.ServerShutdown_SendShutdownMessages;
@ -332,7 +333,7 @@ namespace ServerManagerTool.Lib
// check if the server was previously running.
if (!_serverRunning)
{
if (_profile.AutoRestartIfShutdown)
if (RestartIfShutdown)
{
LogProfileMessage("Server was not running, server will be started as the setting to restart if shutdown is TRUE.");
}
@ -3295,7 +3296,8 @@ namespace ServerManagerTool.Lib
SendAlerts = SendAlerts,
SendEmails = SendEmails,
ServerProcess = ServerProcess,
SteamCMDProcessWindowStyle = ProcessWindowStyle.Hidden
SteamCMDProcessWindowStyle = ProcessWindowStyle.Hidden,
RestartIfShutdown = profile.AutoRestartIfShutdown,
};
app.PerformProfileUpdate(branch, profile);
profileExitCodes.TryAdd(profile, app.ExitCode);
@ -3316,7 +3318,8 @@ namespace ServerManagerTool.Lib
SendAlerts = SendAlerts,
SendEmails = SendEmails,
ServerProcess = ServerProcess,
SteamCMDProcessWindowStyle = ProcessWindowStyle.Hidden
SteamCMDProcessWindowStyle = ProcessWindowStyle.Hidden,
RestartIfShutdown = profile.AutoRestartIfShutdown,
};
app.PerformProfileUpdate(branch, profile);
profileExitCodes.TryAdd(profile, app.ExitCode);
@ -3483,7 +3486,8 @@ namespace ServerManagerTool.Lib
SendAlerts = true,
SendEmails = true,
ServerProcess = type,
SteamCMDProcessWindowStyle = ProcessWindowStyle.Hidden
SteamCMDProcessWindowStyle = ProcessWindowStyle.Hidden,
RestartIfShutdown = performRestart,
};
exitCode = app.PerformProfileShutdown(profile, performRestart, performUpdate ? ServerUpdateType.ServerAndMods : ServerUpdateType.None, true, false, CancellationToken.None);