/// <summary> /// Read Bytes Routine /// </summary> /// <param name="buffer">The buffer.</param> /// <param name="pos">The position.</param> /// <param name="len">The length.</param> /// <param name="endOfFile">if set to <c>true</c> [end of file].</param> /// <returns></returns> protected override int ReadBytes(byte[] buffer, int pos, int len, out bool endOfFile) { len = len > _readRemain ? (int)_readRemain : len; _readRemain -= (uint)len; endOfFile = _readRemain == 0; _readFile.Read(buffer, pos, len); _readCrc32 = CRC32.Checksum(_readCrc32, buffer, pos, len); return(len); }
//////////////////////////////////////////////////////////////////// // Write Bytes Routine //////////////////////////////////////////////////////////////////// public override void WriteBytes ( Byte[] Buffer, Int32 Pos, Int32 Len ) { WriteCRC32 = CRC32.Checksum(WriteCRC32, Buffer, Pos, Len); WriteFile.Write(Buffer, Pos, Len); return; }
//////////////////////////////////////////////////////////////////// // Read Bytes Routine //////////////////////////////////////////////////////////////////// public override Int32 ReadBytes ( Byte[] Buffer, Int32 Pos, Int32 Len, out Boolean EndOfFile ) { Len = Len > ReadRemain ? (Int32)ReadRemain : Len; ReadRemain -= (UInt32)Len; EndOfFile = ReadRemain == 0; ReadFile.Read(Buffer, Pos, Len); ReadCRC32 = CRC32.Checksum(ReadCRC32, Buffer, Pos, Len); return(Len); }
/// <summary> /// Write Bytes Routine /// </summary> /// <param name="buffer">The buffer.</param> /// <param name="pos">The position.</param> /// <param name="len">The length.</param> protected override void WriteBytes(Byte[] buffer, int pos, int len) { _writeCrc32 = CRC32.Checksum(_writeCrc32, buffer, pos, len); _writeFile.Write(buffer, pos, len); }