public static CompareMD5 ( string file, string hash ) : bool | ||
file | string | |
hash | string | |
return | bool |
/// <summary> /// Compares MD5 hash from given mul file with hash in responsible hash-file /// </summary> /// <param name="what"></param> /// <returns></returns> public static bool CompareHashFile(string what, string path) { string FileName = Path.Combine(path, $"UOFiddler{what}.hash"); if (File.Exists(FileName)) { try { using (BinaryReader bin = new BinaryReader(new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read))) { int length = bin.ReadInt32(); byte[] buffer = new byte[length]; bin.Read(buffer, 0, length); string hashold = BitConverter.ToString(buffer).Replace("-", "").ToLower(); return(Files.CompareMD5(Files.GetFilePath($"{what}.mul"), hashold)); } } catch { return(false); } } return(false); }
/// <summary> /// Compares MD5 hash from given mul file with hash in responsible hash-file /// </summary> /// <param name="what"></param> /// <returns></returns> public static bool CompareHashFile(string what) { string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; string FileName = Path.Combine(path, String.Format("UOFiddler{0}.hash", what)); if (File.Exists(FileName)) { try { using (BinaryReader bin = new BinaryReader(new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read))) { int length = bin.ReadInt32(); byte[] buffer = new byte[length]; bin.Read(buffer, 0, length); string hashold = BitConverter.ToString(buffer).Replace("-", "").ToLower(); return(Files.CompareMD5(Files.GetFilePath(String.Format("{0}.mul", what)), hashold)); } } catch { return(false); } } return(false); }