private static UInt32 InternalProcessStream(Stream stream, long?maxLength, int?bufferSize) { Crc32Processor processor = new Crc32Processor(); byte[] buffer = new byte[bufferSize.GetValueOrDefault(4096)]; long totalBytesRead = 0; while (true) { int bytesRead = stream.Read(buffer, 0, maxLength.HasValue ? (int)Math.Min(buffer.Length, maxLength.Value - totalBytesRead) : buffer.Length); processor.Process(buffer, 0, bytesRead); if (maxLength.HasValue) { totalBytesRead += bytesRead; if (totalBytesRead >= maxLength.Value) { break; } } else if (bytesRead == 0) { break; } } return(processor.Current); }
public static UInt32 Process(byte[] buffer, int startIndex, int length) { Crc32Processor processor = new Crc32Processor(); processor.Process(buffer, startIndex, length); return(processor.Current); }
public static UInt32 Process(byte[] bytes) { Crc32Processor processor = new Crc32Processor(); processor.Process(bytes); return(processor.Current); }
private static UInt32 InternalProcessStream(Stream stream, long? maxLength, int? bufferSize) { Crc32Processor processor = new Crc32Processor(); byte[] buffer = new byte[bufferSize.GetValueOrDefault(4096)]; long totalBytesRead = 0; while (true) { int bytesRead = stream.Read(buffer, 0, maxLength.HasValue ? (int)Math.Min(buffer.Length, maxLength.Value - totalBytesRead) : buffer.Length); processor.Process(buffer, 0, bytesRead); if (maxLength.HasValue) { totalBytesRead += bytesRead; if (totalBytesRead >= maxLength.Value) break; } else if (bytesRead == 0) { break; } } return processor.Current; }
public static UInt32 Process(byte[] buffer, int startIndex, int length) { Crc32Processor processor = new Crc32Processor(); processor.Process(buffer, startIndex, length); return processor.Current; }
public static UInt32 Process(byte[] bytes) { Crc32Processor processor = new Crc32Processor(); processor.Process(bytes); return processor.Current; }