From a68073769bbfa8fffe8f1c8db2b5e00f83cdf2ba Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Sat, 8 Oct 2022 15:07:20 +0100 Subject: [PATCH] Nits --- src/Tgstation.Server.Host.Service/Program.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Tgstation.Server.Host.Service/Program.cs b/src/Tgstation.Server.Host.Service/Program.cs index 40baaadd9d..33f40c9ba2 100644 --- a/src/Tgstation.Server.Host.Service/Program.cs +++ b/src/Tgstation.Server.Host.Service/Program.cs @@ -121,20 +121,19 @@ namespace Tgstation.Server.Host.Service // First check if the service already exists if (Environment.UserInteractive) - { foreach (ServiceController sc in ServiceController.GetServices()) - { if (sc.ServiceName == "tgstation-server" || sc.ServiceName == "tgstation-server-4") { DialogResult result = MessageBox.Show($"You already have another TGS service installed ({sc.ServiceName}). Would you like to uninstall it now? Pressing \"No\" will cancel this install.", "TGS Service", MessageBoxButtons.YesNo); if (result != DialogResult.Yes) - { return; // is this needed after exit? - } // Stop it first to give it some cleanup time if (sc.Status == ServiceControllerStatus.Running) + { sc.Stop(); + sc.WaitForStatus(ServiceControllerStatus.Stopped); + } // And remove it using (ServiceInstaller si = new ServiceInstaller()) @@ -144,8 +143,6 @@ namespace Tgstation.Server.Host.Service si.Uninstall(null); } } - } - } using (var processInstaller = new ServiceProcessInstaller()) using (var installer = new ServiceInstaller())