public static uint GetCrc(string path) { BestHTTP.Decompression.Crc.CRC32 checker = new BestHTTP.Decompression.Crc.CRC32(); using (FileStream stream = File.OpenRead(path)) { return((uint)checker.GetCrc32(stream)); } }
public static bool CheckCrc(string path, uint crc) { if (crc == 0) { return(true); } BestHTTP.Decompression.Crc.CRC32 checker = new BestHTTP.Decompression.Crc.CRC32(); using (FileStream stream = File.OpenRead(path)) { uint result = (uint)checker.GetCrc32(stream); //Debug.Log("CheckCrc " + path + " " + result + " " + crc + " " + (int)result + " " + (int)crc); if (result == crc) { return(true); } } return(false); }