/// <summary> /// Return file crc of the specified file /// </summary> public static uint GetCRC(Stream stream) { Fesersoft.Hashing.crc32 crc32 = new Fesersoft.Hashing.crc32(); uint crchash = (uint)crc32.CRC(stream); return(crchash); }
/// <summary> /// Returns the checksum of a file. /// </summary> /// <param name="filePath"></param> /// <returns></returns> public static long GetCheckSum(string filePath) { long crc = 0; Fesersoft.Hashing.crc32 cr = new Fesersoft.Hashing.crc32(); //System.IO.StreamReader sr = new StreamReader(filePath); using (System.IO.Stream st = new System.IO.FileStream(filePath, FileMode.Open)) { crc = cr.CRC(st); st.Close(); } return crc; }
/// <summary> /// Returns the checksum of a file. /// </summary> /// <param name="filePath"></param> /// <returns></returns> public static long GetCheckSum(string filePath) { long crc = 0; Fesersoft.Hashing.crc32 cr = new Fesersoft.Hashing.crc32(); //System.IO.StreamReader sr = new StreamReader(filePath); using (System.IO.Stream st = new System.IO.FileStream(filePath, FileMode.Open)) { crc = cr.CRC(st); st.Close(); } return(crc); }
/// <summary> /// Return file crc of the specified file /// </summary> public static string GetFileCRC(string filename) { if (!FileEx.Exists(filename)) { return(""); } Fesersoft.Hashing.crc32 crc32 = new Fesersoft.Hashing.crc32(); using (FileStreamEx stmcheck = FileEx.OpenRead(filename)) { uint crchash = (uint)crc32.CRC(stmcheck); stmcheck.Close(); return(ConvertToHex(crchash)); } }
/// <summary> /// Return file crc of the specified file /// </summary> public static string GetFileCRC(string filename) { if (!FileEx.Exists(filename)) return ""; Fesersoft.Hashing.crc32 crc32 = new Fesersoft.Hashing.crc32(); using (FileStreamEx stmcheck = FileEx.OpenRead(filename)) { uint crchash = (uint)crc32.CRC(stmcheck); stmcheck.Close(); return (ConvertToHex(crchash)); } }
/// <summary> /// Return file crc of the specified file /// </summary> public static uint GetCRC(Stream stream) { Fesersoft.Hashing.crc32 crc32 = new Fesersoft.Hashing.crc32(); uint crchash = (uint)crc32.CRC(stream); return crchash; }