Server creates Process ID File (./tshock/tshock.pid) for GSPs

This commit is contained in:
Lucas Nicodemus 2011-07-13 00:47:52 -06:00
parent cbc6bd2751
commit 9ffa0046e8

View file

@ -64,6 +64,8 @@ namespace TShockAPI
public static IDbConnection DB;
public static Process p;
public override Version Version
{
get { return VersionNum; }
@ -93,6 +95,17 @@ namespace TShockAPI
public override void Initialize()
{
if (File.Exists(Path.Combine(SavePath + "tshock.pid")))
{
File.Delete(Path.Combine(SavePath + "tshock.pid"));
}
p = Process.GetCurrentProcess();
int pid = p.Id;
TextWriter tw = new StreamWriter(Path.Combine(SavePath + "tshock.pid"));
tw.Write(pid);
tw.Close();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
#if DEBUG