示例#1
0
文件: Helper.cs 项目: Starwer/Lime
        /// <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);
        }
示例#2
0
 /// <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;
 }
示例#3
0
        /// <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);
        }
示例#4
0
文件: Helper.cs 项目: Starwer/Lime
        /// <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));
            }
        }
示例#5
0
        /// <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));
            }
        }
示例#6
0
 /// <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;
 }