diff --git a/TGServerService/Compiler.cs b/TGServerService/Compiler.cs index 05f580af7b..352c99db7c 100644 --- a/TGServerService/Compiler.cs +++ b/TGServerService/Compiler.cs @@ -383,12 +383,12 @@ namespace TGServerService } } - if (!PrecompileHook()) - { - lastCompilerError = "The precompile hook failed"; - compilerCurrentStatus = TGCompilerStatus.Initialized; //still fairly valid - return; - } + if (!PrecompileHook()) + { + lastCompilerError = "The precompile hook failed"; + compilerCurrentStatus = TGCompilerStatus.Initialized; //still fairly valid + return; + } using (var DM = new Process()) //will kill the process if the thread is terminated { diff --git a/TGServerService/PreactionHandler.cs b/TGServerService/PreactionHandler.cs index ac71129f24..9b7ef88da0 100644 --- a/TGServerService/PreactionHandler.cs +++ b/TGServerService/PreactionHandler.cs @@ -4,62 +4,62 @@ using System.IO; namespace TGServerService { - // Some useful functions for triggering pre action events - partial class TGStationServer - { - const string EventFolder = "EventHandlers/"; + // Some useful functions for triggering pre action events + partial class TGStationServer + { + const string EventFolder = "EventHandlers/"; - string GetPath(string eventName) - { - return string.Format("{}{}.bat", EventFolder, eventName); - } + string GetPath(string eventName) + { + return string.Format("{}{}.bat", EventFolder, eventName); + } - bool EventHandlerExists(string eventName) - { - return File.Exists(GetPath(eventName)); - } + bool EventHandlerExists(string eventName) + { + return File.Exists(GetPath(eventName)); + } - bool HandleEvent(string eventName) - { - if (!EventHandlerExists(eventName)) - { - // We don't need a handler, so let's just fail silently. - return true; - } + bool HandleEvent(string eventName) + { + if (!EventHandlerExists(eventName)) + { + // We don't need a handler, so let's just fail silently. + return true; + } - var process = new Process - { - StartInfo = new ProcessStartInfo - { - FileName = GetPath(eventName), - UseShellExecute = false, - RedirectStandardOutput = true, - RedirectStandardError = true, - CreateNoWindow = true - } - }; - process.Start(); - process.WaitForExit(); + var process = new Process + { + StartInfo = new ProcessStartInfo + { + FileName = GetPath(eventName), + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = true + } + }; + process.Start(); + process.WaitForExit(); - var stdout = process.StandardOutput.ReadToEnd(); - var stderr = process.StandardError.ReadToEnd(); + var stdout = process.StandardOutput.ReadToEnd(); + var stderr = process.StandardError.ReadToEnd(); - TGServerService.WriteInfo( - String.Format("Preaction Event ran. Stdout:\n{}\nStderr:\n{}", stdout, stderr), - process.ExitCode == 0 ? TGServerService.EventID.PreactionEvent : TGServerService.EventID.PreactionFail - ); + TGServerService.WriteInfo( + String.Format("Preaction Event ran. Stdout:\n{}\nStderr:\n{}", stdout, stderr), + process.ExitCode == 0 ? TGServerService.EventID.PreactionEvent : TGServerService.EventID.PreactionFail + ); - return process.ExitCode == 0 ? true : false; - } + return process.ExitCode == 0 ? true : false; + } - public bool PrecompileHook() - { - return HandleEvent("precompile"); - } + public bool PrecompileHook() + { + return HandleEvent("precompile"); + } - public bool PostcompileHook() - { - return HandleEvent("postcompile"); - } - } + public bool PostcompileHook() + { + return HandleEvent("postcompile"); + } + } } diff --git a/TGServerService/ServerService.cs b/TGServerService/ServerService.cs index 0a74f09c92..68efab2c10 100644 --- a/TGServerService/ServerService.cs +++ b/TGServerService/ServerService.cs @@ -77,7 +77,7 @@ namespace TGServerService IRCLogModes = 6500, SubmoduleReclone = 6600, PreactionEvent = 6700, - PreactionFail = 6800 + PreactionFail = 6800 } static TGServerService ActiveService; //So everyone else can write to our eventlog