Put the stat tracker in a place where it isn't going to be deleted.
This commit is contained in:
parent
7ad353000e
commit
b321a10be6
1 changed files with 8 additions and 3 deletions
|
|
@ -221,20 +221,25 @@ namespace TShockAPI
|
||||||
private void callHome()
|
private void callHome()
|
||||||
{
|
{
|
||||||
string fp;
|
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 = "";
|
fp = "";
|
||||||
int random = Utils.Random.Next(500000, 1000000);
|
int random = Utils.Random.Next(500000, 1000000);
|
||||||
fp += random;
|
fp += random;
|
||||||
|
|
||||||
fp = Utils.HashPassword(Netplay.serverIP + fp + Netplay.serverPort + Netplay.serverListenIP);
|
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.Write(fp);
|
||||||
tw.Close();
|
tw.Close();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
fp = "";
|
fp = "";
|
||||||
TextReader tr = new StreamReader(Path.Combine(SavePath, "fingerprint"));
|
TextReader tr = new StreamReader(Path.Combine(lolpath, Netplay.serverPort + ".fingerprint"));
|
||||||
fp = tr.ReadToEnd();
|
fp = tr.ReadToEnd();
|
||||||
tr.Close();
|
tr.Close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue