Server Monitor Changes

- added shutdown reason to window.
This commit is contained in:
Brett Hewitson 2022-06-16 00:43:53 +10:00
parent b24904d13c
commit 10506765fb
10 changed files with 143 additions and 39 deletions

View file

@ -99,6 +99,7 @@ namespace ServerManagerTool.Lib
private QueryMaster.Rcon _rconConsole = null;
private bool _serverRunning = false;
public bool AllMessagesShowShutdownReason { get; set; } = Config.Default.ServerShutdown_AllMessagesShowReason;
public bool BackupWorldFile { get; set; } = Config.Default.BackupWorldFile;
public bool CheckForOnlinePlayers { get; set; } = Config.Default.ServerShutdown_CheckForOnlinePlayers;
public bool DeleteOldBackupFiles { get; set; } = Config.Default.AutoBackup_DeleteOldFiles;
@ -430,7 +431,7 @@ namespace ServerManagerTool.Lib
gameServer = QueryMaster.ServerQuery.GetServerInstance(QueryMaster.EngineType.Source, endPoint);
// check if there is a shutdown reason
if (!string.IsNullOrWhiteSpace(ShutdownReason) && !Config.Default.ServerShutdown_AllMessagesShowReason)
if (!string.IsNullOrWhiteSpace(ShutdownReason) && !AllMessagesShowShutdownReason)
{
LogProfileMessage("Sending shutdown reason...");
@ -541,7 +542,7 @@ namespace ServerManagerTool.Lib
ProcessAlert(AlertType.ShutdownMessage, message);
// check if there is a shutdown reason
if (!string.IsNullOrWhiteSpace(ShutdownReason) && Config.Default.ServerShutdown_AllMessagesShowReason)
if (!string.IsNullOrWhiteSpace(ShutdownReason) && AllMessagesShowShutdownReason)
{
ProcessAlert(AlertType.ShutdownReason, ShutdownReason);
@ -569,12 +570,22 @@ namespace ServerManagerTool.Lib
// // perform a world save
// if (!string.IsNullOrWhiteSpace(Config.Default.ServerShutdown_WorldSaveMessage))
// {
// LogProfileMessage(Config.Default.ServerShutdown_WorldSaveMessage);
// ProcessAlert(AlertType.ShutdownMessage, Config.Default.ServerShutdown_WorldSaveMessage);
// SendMessage(Config.Default.ServerShutdown_WorldSaveMessage, cancellationToken);
// var message = Config.Default.ServerShutdown_WorldSaveMessage;
// LogProfileMessage(message);
// ProcessAlert(AlertType.ShutdownMessage, message);
// if (!string.IsNullOrWhiteSpace(ShutdownReason) && AllMessagesShowShutdownReason)
// {
// ProcessAlert(AlertType.ShutdownReason, ShutdownReason);
// message = $"{message}\r\n{ShutdownReason}";
// }
// SendMessage(message, cancellationToken);
// }
// if (SendCommandAsync(Config.Default.ServerSaveCommand).Result)
// if (SendCommand(Config.Default.ServerSaveCommand, cancellationToken))
// {
// try
// {
@ -610,7 +621,7 @@ namespace ServerManagerTool.Lib
ProcessAlert(AlertType.ShutdownMessage, message);
// check if there is a shutdown reason
if (!string.IsNullOrWhiteSpace(ShutdownReason) && Config.Default.ServerShutdown_AllMessagesShowReason)
if (!string.IsNullOrWhiteSpace(ShutdownReason) && AllMessagesShowShutdownReason)
{
ProcessAlert(AlertType.ShutdownReason, ShutdownReason);