From b321a10be6a280ae721b2793b47245cbde262484 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 5 Dec 2011 16:41:25 -0700 Subject: [PATCH] Put the stat tracker in a place where it isn't going to be deleted. --- TShockAPI/TShock.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 7d6eab51..196c7a12 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -221,20 +221,25 @@ namespace TShockAPI private void callHome() { string fp; - if (!File.Exists(Path.Combine(SavePath, "fingerprint"))) + string lolpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/.tshock/"; + if (!Directory.Exists(lolpath)) + { + Directory.CreateDirectory(lolpath); + } + if (!File.Exists(Path.Combine(lolpath, Netplay.serverPort + ".fingerprint"))) { fp = ""; int random = Utils.Random.Next(500000, 1000000); fp += random; fp = Utils.HashPassword(Netplay.serverIP + fp + Netplay.serverPort + Netplay.serverListenIP); - TextWriter tw = new StreamWriter(Path.Combine(SavePath, "fingerprint")); + TextWriter tw = new StreamWriter(Path.Combine(lolpath, Netplay.serverPort + ".fingerprint")); tw.Write(fp); tw.Close(); } else { fp = ""; - TextReader tr = new StreamReader(Path.Combine(SavePath, "fingerprint")); + TextReader tr = new StreamReader(Path.Combine(lolpath, Netplay.serverPort + ".fingerprint")); fp = tr.ReadToEnd(); tr.Close(); }