Fixed SCA warnings

This commit is contained in:
high 2011-08-06 16:49:40 -04:00
parent 72d49d421c
commit 56eca71853
13 changed files with 299 additions and 236 deletions

View file

@ -55,26 +55,28 @@ namespace TShockAPI
/// <returns></returns>
private static bool ServerIsOutOfDate()
{
WebClient client = new WebClient();
client.Headers.Add("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705;)");
try
using (var client = new WebClient())
{
string updateString = client.DownloadString(updateUrl);
string[] changes = updateString.Split(',');
Version updateVersion = new Version(Convert.ToInt32(changes[0]), Convert.ToInt32(changes[1]),
Convert.ToInt32(changes[2]), Convert.ToInt32(changes[3]));
if (TShock.VersionNum.CompareTo(updateVersion) < 0)
client.Headers.Add("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705;)");
try
{
globalChanges = changes;
return true;
string updateString = client.DownloadString(updateUrl);
string[] changes = updateString.Split(',');
Version updateVersion = new Version(Convert.ToInt32(changes[0]), Convert.ToInt32(changes[1]),
Convert.ToInt32(changes[2]), Convert.ToInt32(changes[3]));
if (TShock.VersionNum.CompareTo(updateVersion) < 0)
{
globalChanges = changes;
return true;
}
}
catch (Exception e)
{
Log.Error(e.ToString());
}
return false;
}
catch (Exception e)
{
Log.Error(e.ToString());
}
return false;
}
private static void NotifyAdministrators(string[] changes)