Spaces to Tabs

This commit is contained in:
Jamie Hankins
2017-09-10 01:41:11 +01:00
parent 5aac1d0483
commit 63added211
3 changed files with 56 additions and 56 deletions
+6 -6
View File
@@ -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
{
+49 -49
View File
@@ -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");
}
}
}
+1 -1
View File
@@ -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