From 48f982414614c807df7870473c58427686abc83e Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Sun, 15 May 2022 21:50:58 +1000 Subject: [PATCH] Server Status Detection Changes - changed the way the commandline is checked for the server. --- src/ARKServerManager/Lib/ServerStatusWatcher.cs | 3 ++- src/ConanServerManager/Lib/ServerStatusWatcher.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ARKServerManager/Lib/ServerStatusWatcher.cs b/src/ARKServerManager/Lib/ServerStatusWatcher.cs index b8dc73ac..60a2cf36 100644 --- a/src/ARKServerManager/Lib/ServerStatusWatcher.cs +++ b/src/ARKServerManager/Lib/ServerStatusWatcher.cs @@ -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(); diff --git a/src/ConanServerManager/Lib/ServerStatusWatcher.cs b/src/ConanServerManager/Lib/ServerStatusWatcher.cs index e97de630..2e32d5ea 100644 --- a/src/ConanServerManager/Lib/ServerStatusWatcher.cs +++ b/src/ConanServerManager/Lib/ServerStatusWatcher.cs @@ -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();