Removed old, crusty stat tracker.

This commit is contained in:
Lucas Nicodemus 2013-08-22 22:50:59 -06:00
parent 66483e0325
commit 8fb046f5b3
4 changed files with 1 additions and 107 deletions

View file

@ -242,8 +242,6 @@ namespace TShockAPI
[Description("Displays chat messages above players' heads, but will disable chat prefixes to compensate.")] public
bool EnableChatAboveHeads = false;
[Description("Hide stat tracker console messages.")] public bool HideStatTrackerDebugMessages = true;
[Description("Force Christmas only events to occur all year.")] public bool ForceXmas = false;
[Description("Allows groups on the banned item allowed list to spawn banned items.")] public bool AllowAllowedGroupsToSpawnBannedItems = false;

View file

@ -1,100 +0,0 @@
/*
TShock, a server mod for Terraria
Copyright (C) 2011-2013 Nyx Studios (fka. The TShock Team)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.IO;
using System.Net;
using System.Threading;
using Terraria;
namespace TShockAPI
{
public class StatTracker
{
private Utils Utils = TShock.Utils;
public DateTime lastcheck = DateTime.MinValue;
private readonly int checkinFrequency = 5;
public void CheckIn()
{
if ((DateTime.Now - lastcheck).TotalMinutes >= checkinFrequency)
{
ThreadPool.QueueUserWorkItem(CallHome);
lastcheck = DateTime.Now;
}
}
private void CallHome(object state)
{
string fp;
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(lolpath, Netplay.serverPort + ".fingerprint"));
tw.Write(fp);
tw.Close();
}
else
{
fp = "";
TextReader tr = new StreamReader(Path.Combine(lolpath, Netplay.serverPort + ".fingerprint"));
fp = tr.ReadToEnd();
tr.Close();
}
using (var client = new WebClient())
{
client.Headers.Add("user-agent",
"TShock (" + TShock.VersionNum + ")");
try
{
string response;
if (TShock.Config.DisablePlayerCountReporting)
{
response =
client.DownloadString("http://tshock.co/tickto.php?do=log&fp=" + fp + "&ver=" + TShock.VersionNum + "&os=" +
Environment.OSVersion + "&mono=" + Main.runningMono + "&port=" + Netplay.serverPort +
"&plcount=0");
}
else
{
response =
client.DownloadString("http://tshock.co/tickto.php?do=log&fp=" + fp + "&ver=" + TShock.VersionNum + "&os=" +
Environment.OSVersion + "&mono=" + Main.runningMono + "&port=" + Netplay.serverPort +
"&plcount=" + TShock.Utils.ActivePlayers());
}
if (!TShock.Config.HideStatTrackerDebugMessages)
Log.ConsoleInfo("Stat Tracker: " + response);
}
catch (Exception e)
{
Log.Error(e.ToString());
}
}
}
}
}

View file

@ -69,7 +69,6 @@ namespace TShockAPI
public static SecureRest RestApi;
public static RestManager RestManager;
public static Utils Utils = Utils.Instance;
public static StatTracker StatTracker = new StatTracker();
/// <summary>
/// Used for implementing REST Tokens prior to the REST system starting up.
/// </summary>
@ -545,7 +544,6 @@ namespace TShockAPI
Regions.ReloadAllRegions();
Lighting.lightMode = 2;
StatTracker.CheckIn();
FixChestStacks();
@ -575,7 +573,6 @@ namespace TShockAPI
private void OnUpdate()
{
UpdateManager.UpdateProcedureCheck();
StatTracker.CheckIn();
if (Backups.IsBackupTime)
Backups.Backup();
//call these every second, not every update

View file

@ -134,7 +134,6 @@
<Compile Include="Rest\RestObject.cs" />
<Compile Include="Rest\RestVerbs.cs" />
<Compile Include="Rest\SecureRest.cs" />
<Compile Include="StatTracker.cs" />
<Compile Include="Utils.cs" />
<Compile Include="TShock.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -192,7 +191,7 @@
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildAction="Both" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_StartDate="2011/6/17" BuildVersion_IncrementBeforeBuild="False" />
<UserProperties BuildVersion_IncrementBeforeBuild="False" BuildVersion_StartDate="2011/6/17" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_BuildAction="Both" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.