diff --git a/src/Tgstation.Server.Host.Service/Program.cs b/src/Tgstation.Server.Host.Service/Program.cs index fa7c05e672..e1e6e2f992 100644 --- a/src/Tgstation.Server.Host.Service/Program.cs +++ b/src/Tgstation.Server.Host.Service/Program.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using McMaster.Extensions.CommandLineUtils; + using Microsoft.Extensions.Logging; using Tgstation.Server.Host.Watchdog; @@ -100,30 +101,26 @@ namespace Tgstation.Server.Host.Service } // And remove it - using (ServiceInstaller si = new ServiceInstaller()) - { - si.Context = new InstallContext($"old-{sc.ServiceName}-uninstall.log", null); - si.ServiceName = sc.ServiceName; - si.Uninstall(null); - } + using var serviceInstaller = new ServiceInstaller(); + serviceInstaller.Context = new InstallContext($"old-{sc.ServiceName}-uninstall.log", null); + serviceInstaller.ServiceName = sc.ServiceName; + serviceInstaller.Uninstall(null); } - using (var processInstaller = new ServiceProcessInstaller()) - using (var installer = new ServiceInstaller()) - { - processInstaller.Account = ServiceAccount.LocalSystem; + using var processInstaller = new ServiceProcessInstaller(); + using var installer = new ServiceInstaller(); + processInstaller.Account = ServiceAccount.LocalSystem; - installer.Context = new InstallContext("tgs-install.log", new string[] { String.Format(CultureInfo.InvariantCulture, "/assemblypath={0}", Assembly.GetEntryAssembly().Location) }); - installer.Description = "/tg/station 13 server running as a windows service"; - installer.DisplayName = "/tg/station server"; - installer.StartType = ServiceStartMode.Automatic; - installer.ServicesDependedOn = new string[] { "Tcpip", "Dhcp", "Dnscache" }; - installer.ServiceName = ServerService.Name; - installer.Parent = processInstaller; + installer.Context = new InstallContext("tgs-install.log", new string[] { String.Format(CultureInfo.InvariantCulture, "/assemblypath={0}", Assembly.GetEntryAssembly().Location) }); + installer.Description = "/tg/station 13 server running as a windows service"; + installer.DisplayName = "/tg/station server"; + installer.StartType = ServiceStartMode.Automatic; + installer.ServicesDependedOn = new string[] { "Tcpip", "Dhcp", "Dnscache" }; + installer.ServiceName = ServerService.Name; + installer.Parent = processInstaller; - var state = new ListDictionary(); - installer.Install(state); - } + var state = new ListDictionary(); + installer.Install(state); } /// @@ -183,14 +180,15 @@ namespace Tgstation.Server.Host.Service } else if (!Configure) { - using (var service = new ServerService(WatchdogFactory, Trace ? LogLevel.Trace : Debug ? LogLevel.Debug : LogLevel.Information)) - ServiceBase.Run(service); + using var service = new ServerService(WatchdogFactory, Trace ? LogLevel.Trace : Debug ? LogLevel.Debug : LogLevel.Information); + ServiceBase.Run(service); } if (Configure) { - using (var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole())) - await WatchdogFactory.CreateWatchdog(loggerFactory).RunAsync(true, Array.Empty(), CancellationToken.None); // DCT: None available + using var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); + await WatchdogFactory.CreateWatchdog(loggerFactory) + .RunAsync(true, Array.Empty(), CancellationToken.None); // DCT: None available } } }