public bool DownloadUpdate(DirectoryInfo TempDir) { try { var Client = new WebClient(); if (!TempDir.Exists) { TempDir.Create(); } addText(UpdateData.Instance.Url + UpdateData.Instance.File); Client.DownloadFile(UpdateData.Instance.Url + UpdateData.Instance.File, string.Format("{0}\\Package", TempDir.FullName)); return(DTHasher.GetMD5Hash(string.Format("{0}\\Package", TempDir.FullName)) == UpdateData.Instance.Hash); } catch { return(false); } }
public bool DownloadUpdate(string file, string hash) { try { var client = new WebClient(); var tempDir = new DirectoryInfo(UpdateConstants.UpdateFolder); if (!tempDir.Exists) { tempDir.Create(); } client.DownloadFile(UpdateConstants.UpdateUrl + "\\" + file, string.Format("{0}\\Package", tempDir)); client.Dispose(); return(DTHasher.GetMD5Hash(string.Format("{0}\\Package\\", tempDir)) == hash); } catch { return(false); } }