Added better status detection for stopping servers

This commit is contained in:
Brett Hewitson 2021-12-20 18:37:11 +10:00
parent 034a6228d7
commit 3c822fa982
14 changed files with 183 additions and 46 deletions

View file

@ -256,6 +256,8 @@ namespace ServerManagerTool.Lib
return;
}
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped);
// make a backup of the current profile and config files.
CreateProfileBackupArchiveFile(_profile);
@ -408,6 +410,7 @@ namespace ServerManagerTool.Lib
}
_serverRunning = true;
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopping);
LogProfileMessage($"Server process found PID {process.Id}.");
QueryMaster.Server gameServer = null;
@ -1207,6 +1210,8 @@ namespace ServerManagerTool.Lib
if (ExitCode != EXITCODE_NORMALEXIT)
return;
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped);
emailMessage.AppendLine("Update Summary:");
emailMessage.AppendLine();
emailMessage.AppendLine($"Server Manager version: {App.Instance.Version}");
@ -2542,7 +2547,7 @@ namespace ServerManagerTool.Lib
_loggerBranch?.Info(message);
if (includeProgressCallback)
ProgressCallback?.Invoke(0, $"[INFO] {message}");
ProgressCallback?.Invoke(0, $"{message}");
Debug.WriteLine($"[INFO] (Branch {GetBranchName(branchName) ?? "unknown"}) {message}");
}
@ -2567,7 +2572,7 @@ namespace ServerManagerTool.Lib
_loggerProfile?.Info(message);
if (includeProgressCallback)
ProgressCallback?.Invoke(0, $"[INFO] {message}");
ProgressCallback?.Invoke(0, $"{message}");
Debug.WriteLine($"[INFO] (Profile {_profile?.ProfileName ?? "unknown"}) {message}");
}
@ -2816,6 +2821,8 @@ namespace ServerManagerTool.Lib
}
}
ServerStatusChangeCallback?.Invoke(ServerStatus.Unknown);
LogProfileMessage("");
LogProfileMessage($"Exitcode = {ExitCode}");
return ExitCode;
@ -2913,6 +2920,8 @@ namespace ServerManagerTool.Lib
}
}
ServerStatusChangeCallback?.Invoke(ServerStatus.Unknown);
LogProfileMessage("");
LogProfileMessage($"Exitcode = {ExitCode}");
return ExitCode;
@ -2993,6 +3002,8 @@ namespace ServerManagerTool.Lib
}
}
ServerStatusChangeCallback?.Invoke(ServerStatus.Unknown);
LogProfileMessage("");
LogProfileMessage($"Exitcode = {ExitCode}");
return ExitCode;

View file

@ -275,20 +275,32 @@ namespace ServerManagerTool.Lib
case WatcherServerStatus.RunningLocalCheck:
if (oldStatus != ServerStatus.Stopping)
{
UpdateServerStatus(ServerStatus.Running, this.Availability != AvailabilityStatus.Available ? AvailabilityStatus.Waiting : this.Availability, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
}
else
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Stop();
break;
case WatcherServerStatus.RunningExternalCheck:
if (oldStatus != ServerStatus.Stopping)
{
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.Waiting, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
}
else
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Stop();
break;
case WatcherServerStatus.Published:
if (oldStatus != ServerStatus.Stopping)
{
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.Available, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
}
else
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Stop();
break;
default:
@ -977,7 +989,23 @@ namespace ServerManagerTool.Lib
public void UpdateServerStatus(ServerStatus serverStatus, bool sendAlert)
{
UpdateServerStatus(serverStatus, Availability, sendAlert);
var availability = Availability;
switch (serverStatus)
{
case ServerStatus.Stopped:
case ServerStatus.Stopping:
case ServerStatus.Uninstalled:
case ServerStatus.Updating:
availability = AvailabilityStatus.Unavailable;
break;
case ServerStatus.Unknown:
availability = AvailabilityStatus.Unknown;
sendAlert = false;
break;
}
UpdateServerStatus(serverStatus, availability, sendAlert);
}
public void UpdateServerStatus(ServerStatus serverStatus, AvailabilityStatus availabilityStatus, bool sendAlert)

View file

@ -110,8 +110,8 @@ namespace ServerManagerTool.Utils
TaskUtils.RunOnUIThreadAsync(() =>
{
var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
var serverList = ServerManager.Instance.Servers.Where(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
if (serverList.IsEmpty())
@ -307,7 +307,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -408,7 +408,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -509,7 +509,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -611,7 +611,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -713,7 +713,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -810,14 +810,14 @@ namespace ServerManagerTool.Utils
SendAlerts = true,
SendEmails = false,
ServerProcess = ServerProcessType.Update,
ServerStatusChangeCallback = (ServerStatus serverStatus) =>
ServerStatusChangeCallback = (ServerStatus serverStatus) =>
{
TaskUtils.RunOnUIThreadAsync(() =>
{
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};

View file

@ -9,8 +9,8 @@
<entry>
<id>urn:uuid:3E33DCB2-ECFE-4489-B1A4-56F5D386F9DC</id>
<title>1.1.413 (1.1.413.16)</title>
<summary>1.1.413.16</summary>
<title>1.1.413 (1.1.413.17)</title>
<summary>1.1.413.17</summary>
<link href="" />
<updated>2021-12-20T00:00:00Z</updated>
<content type="xhtml">

View file

@ -7,6 +7,29 @@
<link href="http://arkservermanager.freeforums.net/" />
<updated>2021-12-20T00:00:00Z</updated>
<entry>
<id>urn:uuid:B08AA2A8-9E9C-4CD2-8992-6848AA5F0757</id>
<title>1.1.413 (1.1.413.17)</title>
<summary>1.1.413.17</summary>
<link href="" />
<updated>2021-12-20T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Added better status detection for stopping servers.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:D8C3D087-64DB-4FB8-829F-7FA665F77309</id>
<title>1.1.413 (1.1.413.16)</title>

View file

@ -435,7 +435,7 @@
<Setter Property="ToolTip" Value="{DynamicResource ServerSettings_RuntimeStatusRunningLabel}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Runtime.Status}" Value="{x:Static enum:ServerStatus.Stopping}">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusOn.ico,Size=32}"/>
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusStarting.ico,Size=32}"/>
<Setter Property="ToolTip" Value="{DynamicResource ServerSettings_RuntimeStatusStoppingLabel}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Runtime.Status}" Value="{x:Static enum:ServerStatus.Stopped}">

View file

@ -1,15 +1,15 @@
using ServerManagerTool.Common;
using ServerManagerTool.Common.Utils;
using ServerManagerTool.Enums;
using ServerManagerTool.Lib;
using ServerManagerTool.Plugin.Common;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using ServerManagerTool.Common;
using ServerManagerTool.Common.Utils;
using ServerManagerTool.Enums;
using ServerManagerTool.Lib;
using ServerManagerTool.Plugin.Common;
using WPFSharp.Globalizer;
namespace ServerManagerTool
@ -230,6 +230,13 @@ namespace ServerManagerTool
SendAlerts = true,
ServerProcess = RestartServer ? ServerProcessType.Restart : ServerProcessType.Shutdown,
ProgressCallback = (p, m, n) => { TaskUtils.RunOnUIThreadAsync(() => { this.AddMessage(m, n); }).DoNotWait(); },
ServerStatusChangeCallback = (ServerStatus serverStatus) =>
{
TaskUtils.RunOnUIThreadAsync(() =>
{
Server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
// if restarting the serverm, then check and update the public IP address

View file

@ -257,6 +257,8 @@ namespace ServerManagerTool.Lib
return;
}
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped);
// make a backup of the current profile and config files.
CreateProfileBackupArchiveFile(_profile);
@ -404,6 +406,7 @@ namespace ServerManagerTool.Lib
}
_serverRunning = true;
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopping);
LogProfileMessage($"Server process found PID {process.Id}.");
QueryMaster.Server gameServer = null;
@ -1165,6 +1168,8 @@ namespace ServerManagerTool.Lib
if (ExitCode != EXITCODE_NORMALEXIT)
return;
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped);
emailMessage.AppendLine("Update Summary:");
emailMessage.AppendLine();
emailMessage.AppendLine($"Server Manager version: {App.Instance.Version}");
@ -2435,7 +2440,7 @@ namespace ServerManagerTool.Lib
_loggerBranch?.Info(message);
if (includeProgressCallback)
ProgressCallback?.Invoke(0, $"[INFO] {message}");
ProgressCallback?.Invoke(0, $"{message}");
Debug.WriteLine($"[INFO] (Branch {GetBranchName(branchName) ?? "unknown"}) {message}");
}
@ -2460,7 +2465,7 @@ namespace ServerManagerTool.Lib
_loggerProfile?.Info(message);
if (includeProgressCallback)
ProgressCallback?.Invoke(0, $"[INFO] {message}");
ProgressCallback?.Invoke(0, $"{message}");
Debug.WriteLine($"[INFO] (Profile {_profile?.ProfileName ?? "unknown"}) {message}");
}
@ -2709,6 +2714,8 @@ namespace ServerManagerTool.Lib
}
}
ServerStatusChangeCallback?.Invoke(ServerStatus.Unknown);
LogProfileMessage("");
LogProfileMessage($"Exitcode = {ExitCode}");
return ExitCode;
@ -2806,6 +2813,8 @@ namespace ServerManagerTool.Lib
}
}
ServerStatusChangeCallback?.Invoke(ServerStatus.Unknown);
LogProfileMessage("");
LogProfileMessage($"Exitcode = {ExitCode}");
return ExitCode;
@ -2886,6 +2895,8 @@ namespace ServerManagerTool.Lib
}
}
ServerStatusChangeCallback?.Invoke(ServerStatus.Unknown);
LogProfileMessage("");
LogProfileMessage($"Exitcode = {ExitCode}");
return ExitCode;

View file

@ -274,20 +274,32 @@ namespace ServerManagerTool.Lib
case WatcherServerStatus.RunningLocalCheck:
if (oldStatus != ServerStatus.Stopping)
{
UpdateServerStatus(ServerStatus.Running, this.Availability != AvailabilityStatus.Available ? AvailabilityStatus.Waiting : this.Availability, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
}
else
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Stop();
break;
case WatcherServerStatus.RunningExternalCheck:
if (oldStatus != ServerStatus.Stopping)
{
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.Waiting, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
}
else
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Stop();
break;
case WatcherServerStatus.Published:
if (oldStatus != ServerStatus.Stopping)
{
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.Available, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
}
else
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Stop();
break;
default:
@ -965,7 +977,23 @@ namespace ServerManagerTool.Lib
public void UpdateServerStatus(ServerStatus serverStatus, bool sendAlert)
{
UpdateServerStatus(serverStatus, Availability, sendAlert);
var availability = Availability;
switch (serverStatus)
{
case ServerStatus.Stopped:
case ServerStatus.Stopping:
case ServerStatus.Uninstalled:
case ServerStatus.Updating:
availability = AvailabilityStatus.Unavailable;
break;
case ServerStatus.Unknown:
availability = AvailabilityStatus.Unknown;
sendAlert = false;
break;
}
UpdateServerStatus(serverStatus, availability, sendAlert);
}
public void UpdateServerStatus(ServerStatus serverStatus, AvailabilityStatus availabilityStatus, bool sendAlert)

View file

@ -307,7 +307,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -408,7 +408,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -509,7 +509,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -611,7 +611,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -713,7 +713,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
@ -817,7 +817,7 @@ namespace ServerManagerTool.Utils
var server = ServerManager.Instance.Servers.First(s => string.Equals(channelId, s.Profile.DiscordChannelId, StringComparison.OrdinalIgnoreCase)
&& (string.Equals(profileIdOrAlias, s.Profile.ProfileID, StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrWhiteSpace(s.Profile.DiscordAlias) && string.Equals(profileIdOrAlias, s.Profile.DiscordAlias, StringComparison.OrdinalIgnoreCase)));
server.Runtime.UpdateServerStatus(serverStatus, true);
server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};

View file

@ -9,8 +9,8 @@
<entry>
<id>urn:uuid:19B09A66-43F2-4D5F-AF33-5C77D7EA9A6B</id>
<title>1.1.58 (1.1.58.16)</title>
<summary>1.1.58.16</summary>
<title>1.1.58 (1.1.58.17)</title>
<summary>1.1.58.17</summary>
<link href="" />
<updated>2021-12-20T00:00:00Z</updated>
<content type="xhtml">

View file

@ -7,6 +7,29 @@
<link href="http://servermanagers.freeforums.net/" />
<updated>2021-12-20T00:00:00Z</updated>
<entry>
<id>urn:uuid:25F39F6F-E7FE-417D-9BC9-EC6EF7DEC1BC</id>
<title>1.1.58 (1.1.58.17)</title>
<summary>1.1.58.17</summary>
<link href="" />
<updated>2021-12-20T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Added better status detection for stopping servers.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:0C184A8F-803D-4AC6-B9CB-599810F9AD29</id>
<title>1.1.58 (1.1.58.16)</title>

View file

@ -433,7 +433,7 @@
<Setter Property="ToolTip" Value="{DynamicResource ServerSettings_RuntimeStatusRunningLabel}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Runtime.Status}" Value="{x:Static enum:ServerStatus.Stopping}">
<Setter Property="Source" Value="{com:Icon Path=/ConanServerManager;component/Art/StatusOn.ico,Size=32}"/>
<Setter Property="Source" Value="{com:Icon Path=/ConanServerManager;component/Art/StatusStarting.ico,Size=32}"/>
<Setter Property="ToolTip" Value="{DynamicResource ServerSettings_RuntimeStatusStoppingLabel}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Runtime.Status}" Value="{x:Static enum:ServerStatus.Stopped}">

View file

@ -1,17 +1,16 @@
using ServerManagerTool.Common;
using ServerManagerTool.Common.Utils;
using ServerManagerTool.Enums;
using ServerManagerTool.Lib;
using ServerManagerTool.Plugin.Common;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using ServerManagerTool.Common;
using ServerManagerTool.Common.Utils;
using ServerManagerTool.Enums;
using ServerManagerTool.Lib;
using ServerManagerTool.Plugin.Common;
using WPFSharp.Globalizer;
using static ServerManagerTool.Lib.ServerApp;
namespace ServerManagerTool
{
@ -228,6 +227,13 @@ namespace ServerManagerTool
SendAlerts = true,
ServerProcess = RestartServer ? ServerProcessType.Restart : ServerProcessType.Shutdown,
ProgressCallback = (p, m, n) => { TaskUtils.RunOnUIThreadAsync(() => { this.AddMessage(m, n); }).DoNotWait(); },
ServerStatusChangeCallback = (ServerStatus serverStatus) =>
{
TaskUtils.RunOnUIThreadAsync(() =>
{
Server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
// if restarting the serverm, then check and update the public IP address