This commit is contained in:
AffectedArc07
2022-10-08 15:07:20 +01:00
parent 6fc13cff70
commit a68073769b
+3 -6
View File
@@ -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())