From 9ffa0046e8f67a996a0046f4c8de58e16cfaa5d5 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 13 Jul 2011 00:47:52 -0600 Subject: [PATCH] Server creates Process ID File (./tshock/tshock.pid) for GSPs --- TShockAPI/TShock.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 0c26b0a1..23b88d50 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -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