diff --git a/src/Tgstation.Server.Client/Tgstation.Server.Client.csproj b/src/Tgstation.Server.Client/Tgstation.Server.Client.csproj
index db9df23a8e..b6bb7947ea 100644
--- a/src/Tgstation.Server.Client/Tgstation.Server.Client.csproj
+++ b/src/Tgstation.Server.Client/Tgstation.Server.Client.csproj
@@ -25,7 +25,7 @@
true
-
+ D:\tgstation-server\src\Tgstation.Server.Client\Tgstation.Server.Client.xml
1701;1702
diff --git a/src/Tgstation.Server.Host.Console/Program.cs b/src/Tgstation.Server.Host.Console/Program.cs
index 3e9b566774..9437569d9f 100644
--- a/src/Tgstation.Server.Host.Console/Program.cs
+++ b/src/Tgstation.Server.Host.Console/Program.cs
@@ -37,6 +37,7 @@ namespace Tgstation.Server.Host.Console
loggerFactory.CreateLogger(nameof(Program)).LogCritical("Please specify only 1 of --trace-host-watchdog or --debug-host-watchdog!");
return;
}
+
using (var cts = new CancellationTokenSource())
{
void AppDomainHandler(object a, EventArgs b) => cts.Cancel();
diff --git a/src/Tgstation.Server.Host.Service/GlobalSuppressions.cs b/src/Tgstation.Server.Host.Service/GlobalSuppressions.cs
index 47f7930b2a..dfc5c7f3e3 100644
Binary files a/src/Tgstation.Server.Host.Service/GlobalSuppressions.cs and b/src/Tgstation.Server.Host.Service/GlobalSuppressions.cs differ
diff --git a/src/Tgstation.Server.Host.Service/Program.cs b/src/Tgstation.Server.Host.Service/Program.cs
index 0c758c4de7..6e519cc9d9 100644
--- a/src/Tgstation.Server.Host.Service/Program.cs
+++ b/src/Tgstation.Server.Host.Service/Program.cs
@@ -20,6 +20,13 @@ namespace Tgstation.Server.Host.Service
///
sealed class Program
{
+#pragma warning disable SA1401 // Fields should be private
+ ///
+ /// The for the
+ ///
+ internal static IWatchdogFactory WatchdogFactory = new WatchdogFactory();
+#pragma warning restore SA1401 // Fields should be private
+
///
/// The --uninstall or -u option
///
@@ -50,8 +57,6 @@ namespace Tgstation.Server.Host.Service
[Option(ShortName = "d")]
public bool Debug { get; set; }
- static readonly IWatchdogFactory watchdogFactory = new WatchdogFactory();
-
///
/// Check if the running user is a system administrator
///
@@ -63,9 +68,15 @@ namespace Tgstation.Server.Host.Service
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
+ ///
+ /// Entrypoint for the application
+ ///
+ static Task Main(string[] args) => CommandLineApplication.ExecuteAsync(args);
+
///
/// Command line handler, always runs
///
+ /// A representing the running operation
public async Task OnExecuteAsync()
{
if (Environment.UserInteractive)
@@ -81,8 +92,8 @@ namespace Tgstation.Server.Host.Service
if (!IsAdministrator())
{
- //try to restart as admin
- //its windows, first arg is .exe name guaranteed
+ // try to restart as admin
+ // its windows, first arg is .exe name guaranteed
var exe = Environment.GetCommandLineArgs().First();
var startInfo = new ProcessStartInfo
{
@@ -100,13 +111,12 @@ namespace Tgstation.Server.Host.Service
using (var loggerFactory = new LoggerFactory())
{
if (Configure)
- await watchdogFactory.CreateWatchdog(loggerFactory).RunAsync(true, Array.Empty(), default).ConfigureAwait(false);
+ await WatchdogFactory.CreateWatchdog(loggerFactory).RunAsync(true, Array.Empty(), default).ConfigureAwait(false);
if (Install)
{
if (Uninstall)
- //oh no, it's retarded...
- return;
+ return; // oh no, it's retarded...
using (var processInstaller = new ServiceProcessInstaller())
using (var installer = new ServiceInstaller())
{
@@ -132,14 +142,9 @@ namespace Tgstation.Server.Host.Service
installer.ServiceName = ServerService.Name;
installer.Uninstall(null);
}
- else if(!Configure)
- ServiceBase.Run(new ServerService(watchdogFactory, loggerFactory, Trace ? LogLevel.Trace : Debug ? LogLevel.Debug : LogLevel.Information));
+ else if (!Configure)
+ ServiceBase.Run(new ServerService(WatchdogFactory, loggerFactory, Trace ? LogLevel.Trace : Debug ? LogLevel.Debug : LogLevel.Information));
}
}
-
- ///
- /// Entrypoint for the application
- ///
- static Task Main(string[] args) => CommandLineApplication.ExecuteAsync(args);
}
}
diff --git a/src/Tgstation.Server.Host.Service/ServerService.cs b/src/Tgstation.Server.Host.Service/ServerService.cs
index 0758c021a3..f92e3c3375 100644
--- a/src/Tgstation.Server.Host.Service/ServerService.cs
+++ b/src/Tgstation.Server.Host.Service/ServerService.cs
@@ -88,11 +88,12 @@ namespace Tgstation.Server.Host.Service
EventLog.WriteEntry(String.Format(CultureInfo.InvariantCulture, "Error stopping service! Exception: {0}", e));
}
}
+
StopServiceAsync();
}
///
- [SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "cancellationTokenSource")]
+ [SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "cancellationTokenSource", Justification = "IT'S DISPOSED RIGHT THERE YOU FUCCBOI!")]
protected override void Dispose(bool disposing)
{
cancellationTokenSource?.Dispose();
diff --git a/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj b/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj
index eb704ca548..cae21d786c 100644
--- a/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj
+++ b/src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj
@@ -40,7 +40,7 @@
DEBUG;TRACE
prompt
- SA1652
+ SA1101;SA1121;SA1200;SA1202;SA1208;SA1400;SA1413;SA1501;SA1503;SA1519;SA1520;SA1623;SA1629;SA1633;SA1642
pdbonly
@@ -51,6 +51,7 @@
true
bin\Release\Tgstation.Server.Host.Service.xml
+ SA1101;SA1121;SA1200;SA1202;SA1208;SA1400;SA1413;SA1501;SA1503;SA1519;SA1520;SA1623;SA1629;SA1633;SA1642
Tgstation.Server.Host.Service.Program
diff --git a/src/Tgstation.Server.Host.Watchdog/Watchdog.cs b/src/Tgstation.Server.Host.Watchdog/Watchdog.cs
index 9dce48ac35..9fce44bfbf 100644
--- a/src/Tgstation.Server.Host.Watchdog/Watchdog.cs
+++ b/src/Tgstation.Server.Host.Watchdog/Watchdog.cs
@@ -15,7 +15,6 @@ namespace Tgstation.Server.Host.Watchdog
///
sealed class Watchdog : IWatchdog
{
-
///
/// The for the
///
@@ -31,6 +30,7 @@ namespace Tgstation.Server.Host.Watchdog
}
///
+ #pragma warning disable CA1502 // TODO: Decomplexify
public async Task RunAsync(bool runConfigure, string[] args, CancellationToken cancellationToken)
{
logger.LogInformation("Host watchdog starting...");
@@ -67,17 +67,18 @@ namespace Tgstation.Server.Host.Watchdog
logger.LogCritical("Unable to locate dotnet executable in PATH! Please ensure the .NET Core runtime is installed and is in your PATH!");
return;
}
+
logger.LogInformation("Detected dotnet executable at {0}", dotnetPath);
var rootLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
- var assemblyStoragePath = Path.Combine(rootLocation, "lib"); //always always next to watchdog
+ var assemblyStoragePath = Path.Combine(rootLocation, "lib"); // always always next to watchdog
#if DEBUG
Directory.CreateDirectory(assemblyStoragePath);
#endif
var defaultAssemblyPath = Path.GetFullPath(Path.Combine(assemblyStoragePath, "Default"));
#if DEBUG
- //just copy the shit where it belongs
+ // just copy the shit where it belongs
Directory.Delete(assemblyStoragePath, true);
Directory.CreateDirectory(defaultAssemblyPath);
@@ -117,7 +118,7 @@ namespace Tgstation.Server.Host.Watchdog
using (var process = new Process())
{
process.StartInfo.FileName = dotnetPath;
- process.StartInfo.WorkingDirectory = rootLocation; //for appsettings
+ process.StartInfo.WorkingDirectory = rootLocation; // for appsettings
var arguments = new List
{
@@ -138,7 +139,7 @@ namespace Tgstation.Server.Host.Watchdog
process.StartInfo.Arguments = String.Join(" ", arguments);
- process.StartInfo.UseShellExecute = false; //runs in the same console
+ process.StartInfo.UseShellExecute = false; // runs in the same console
var tcs = new TaskCompletionSource