Write() публичный Метод

public Write ( byte p, int offset, int count ) : void
p byte
offset int
count int
Результат void
Пример #1
0
        /// <summary>
        /// 计算字节数据的crc32值
        /// </summary>
        /// <param name="data">二进制数据</param>
        /// <param name="length">长度</param>
        /// <returns>crc32值</returns>
        public static UInt32 CheckSumBytes(byte[] data)
        {
            CRC32 crc = new CRC32();

            crc.Write(data, 0, data.Length);
            return(crc.Sum32());
        }
Пример #2
0
        public static UInt32 CheckSumSlice(byte[] data, int offset, int count)
        {
            CRC32 crc = new CRC32();

            crc.Write(data, offset, count);
            return(crc.Sum32());
        }
Пример #3
0
 public static UInt32 CheckSumFile(string fileName)
 {
     CRC32 crc = new CRC32 ();
     int bufferLen = 32 * 1024;
     using (FileStream fs = File.OpenRead(fileName)) {
         byte[] buffer = new byte[bufferLen];
         while (true) {
             int n = fs.Read (buffer, 0, bufferLen);
             if (n == 0)
                 break;
             crc.Write (buffer, 0, n);
         }
     }
     return crc.Sum32 ();
 }
Пример #4
0
 /// <summary>
 /// 计算沙盒文件的crc32值
 /// </summary>
 /// <param name="filePath">沙盒文件全路径</param>
 /// <returns>crc32值</returns>
 public static UInt32 CheckSumFile(string filePath)
 {
     CRC32 crc = new CRC32();
     int bufferLen = 32 * 1024;
     using (FileStream fs = IsolatedStorageFile.GetUserStoreForApplication().OpenFile(filePath, FileMode.Open, FileAccess.Read))
     {
         byte[] buffer = new byte[bufferLen];
         while (true)
         {
             int n = fs.Read(buffer, 0, bufferLen);
             if (n == 0)
                 break;
             crc.Write(buffer, 0, n);
         }
     }
     return crc.Sum32();
 }
Пример #5
0
        public static UInt32 CheckSumFile(string fileName)
        {
            CRC32 crc       = new CRC32();
            int   bufferLen = 32 * 1024;

            using (FileStream fs = File.OpenRead(fileName)) {
                byte[] buffer = new byte[bufferLen];
                while (true)
                {
                    int n = fs.Read(buffer, 0, bufferLen);
                    if (n == 0)
                    {
                        break;
                    }
                    crc.Write(buffer, 0, n);
                }
            }
            return(crc.Sum32());
        }
Пример #6
0
        /// <summary>
        /// 计算沙盒文件的crc32值
        /// </summary>
        /// <param name="filePath">沙盒文件全路径</param>
        /// <returns>crc32值</returns>
        public static UInt32 CheckSumFile(string filePath)
        {
            CRC32 crc       = new CRC32();
            int   bufferLen = 32 * 1024;

            using (FileStream fs = IsolatedStorageFile.GetUserStoreForApplication().OpenFile(filePath, FileMode.Open, FileAccess.Read))
            {
                byte[] buffer = new byte[bufferLen];
                while (true)
                {
                    int n = fs.Read(buffer, 0, bufferLen);
                    if (n == 0)
                    {
                        break;
                    }
                    crc.Write(buffer, 0, n);
                }
            }
            return(crc.Sum32());
        }
Пример #7
0
        /// <summary>
        /// 计算沙盒文件的crc32值
        /// </summary>
        /// <param name="filePath">沙盒文件全路径</param>
        /// <returns>crc32值</returns>
        public static uint checkSumFile(string filePath)
        {
            CRC32 crc       = new CRC32();
            int   bufferLen = 32 * 1024;

            using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                byte[] buffer = new byte[bufferLen];
                while (true)
                {
                    int n = fs.Read(buffer, 0, bufferLen);
                    if (n == 0)
                    {
                        break;
                    }
                    crc.Write(buffer, 0, n);
                }
            }
            return(crc.Sum());
        }
Пример #8
0
 public static UInt32 CheckSumSlice(byte[] data, int offset, int count)
 {
     CRC32 crc = new CRC32();
     crc.Write(data, offset, count);
     return crc.Sum32();
 }
Пример #9
0
 /// <summary>
 /// 计算字节数据的crc32值
 /// </summary>
 /// <param name="data">二进制数据</param>
 /// <param name="length">长度</param>
 /// <returns>crc32值</returns>
 public static UInt32 CheckSumBytes(byte[] data)
 {
     CRC32 crc = new CRC32();
     crc.Write(data, 0, data.Length);
     return crc.Sum32();
 }