mirror of
https://github.com/stuff-by-3-random-dudes/UWUVCI-AIO-WPF
synced 2024-11-10 13:44:13 +00:00
Revert "Converted items that could be in a using statement"
This reverts commit 3372052131
.
This commit is contained in:
parent
5de52b2b59
commit
21940cf211
1 changed files with 15 additions and 11 deletions
|
@ -4,7 +4,6 @@ using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace UWUVCI_AIO_WPF.Classes
|
namespace UWUVCI_AIO_WPF.Classes
|
||||||
{
|
{
|
||||||
|
@ -64,22 +63,26 @@ namespace UWUVCI_AIO_WPF.Classes
|
||||||
|
|
||||||
public static bool DoesToolsFolderExist()
|
public static bool DoesToolsFolderExist()
|
||||||
{
|
{
|
||||||
return Directory.Exists(FolderName);
|
if (Directory.Exists(FolderName))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<bool> IsToolRight(string name)
|
public static bool IsToolRight(string name)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
using (var client = new WebClient())
|
WebClient client = new WebClient();
|
||||||
|
client.DownloadFile(backupulr + name + ".md5", name + ".md5");
|
||||||
|
StreamReader sr = new StreamReader(name + ".md5");
|
||||||
|
var md5 = sr.ReadLine();
|
||||||
|
if(CalculateMD5(name) == md5)
|
||||||
{
|
{
|
||||||
await client.DownloadFile(backupulr + name + ".md5", name + ".md5");
|
ret = true;
|
||||||
using (var sr = new StreamReader(name + ".md5"))
|
|
||||||
{
|
|
||||||
var md5 = sr.ReadLine();
|
|
||||||
ret = CalculateMD5(name) == md5;
|
|
||||||
}
|
|
||||||
File.Delete(name + ".md5");
|
|
||||||
}
|
}
|
||||||
|
sr.Close();
|
||||||
|
File.Delete(name + ".md5");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
static string CalculateMD5(string filename)
|
static string CalculateMD5(string filename)
|
||||||
|
@ -89,6 +92,7 @@ namespace UWUVCI_AIO_WPF.Classes
|
||||||
using (var stream = File.OpenRead(filename))
|
using (var stream = File.OpenRead(filename))
|
||||||
{
|
{
|
||||||
string ret = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower();
|
string ret = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower();
|
||||||
|
stream.Close();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue