Server Status Detection Changes

- changed the way the commandline is checked for the server.
This commit is contained in:
Brett Hewitson 2022-05-15 21:50:58 +10:00
parent 0402a732e6
commit 48f9824146
2 changed files with 4 additions and 2 deletions

View file

@ -107,7 +107,8 @@ namespace ServerManagerTool.Lib
{
var commandLine = ProcessUtils.GetCommandLineForProcess(process.Id)?.ToLower();
if (commandLine != null && commandLine.Contains(updateContext.InstallDirectory.ToLower()) && commandLine.Contains(Config.Default.ServerExe.ToLower()))
if (commandLine != null &&
(commandLine.StartsWith(serverExePath, StringComparison.OrdinalIgnoreCase) || commandLine.StartsWith($"\"{serverExePath}\"", StringComparison.OrdinalIgnoreCase)))
{
// Does this match our server exe and port?
var serverArgMatch = String.Format(Config.Default.ServerCommandLineArgsMatchFormat, updateContext.LocalEndpoint.Port).ToLower();

View file

@ -109,7 +109,8 @@ namespace ServerManagerTool.Lib
{
var commandLine = ProcessUtils.GetCommandLineForProcess(process.Id)?.ToLower();
if (commandLine != null && commandLine.Contains(updateContext.InstallDirectory.ToLower()) && commandLine.Contains(Config.Default.ServerExeFile.ToLower()))
if (commandLine != null &&
(commandLine.StartsWith(serverExePath, StringComparison.OrdinalIgnoreCase) || commandLine.StartsWith($"\"{serverExePath}\"", StringComparison.OrdinalIgnoreCase)))
{
// Does this match our server exe and port?
var serverArgMatch = String.Format(Config.Default.ServerCommandLineArgsPortMatchFormat, updateContext.LocalEndpoint.Port).ToLower();