Exemplo n.º 1
0
        private void WriteCrc(int offset)
        {
            _stream.BaseStream.Position = offset + IntegerByteSize;

            var crc = Crc32Provider.ComputeHash(_stream.BaseStream.ToEnumerable());

            _stream.BaseStream.Position = offset;
            _stream.Write(crc);
        }
Exemplo n.º 2
0
        public uint Crc()
        {
            var currentPosition = BaseStream.Position;

            try {
                BaseStream.Position = 0;
                return(Crc32Provider.Compute(ReadToEnd()));
            } finally {
                BaseStream.Position = currentPosition;
            }
        }
Exemplo n.º 3
0
        public byte[] CrcHash(int?size = null)
        {
            var currentPosition = BaseStream.Position;

            try {
                if (size.HasValue)
                {
                    return(Crc32Provider.ComputeHash(RawRead(size.Value)));
                }
                else
                {
                    BaseStream.Position = 0;
                    return(Crc32Provider.ComputeHash(ReadToEnd()));
                }
            } finally {
                BaseStream.Position = currentPosition;
            }
        }