Ejemplo n.º 1
0
        public ControlFile(Stream stream)
        {
            // Read stream in (could be from any source)
            var returned = SplitFileRead(stream.ToByteArray());

            _header    = new Header(returned.first);
            _blockSums = BlockSum.ReadBlockSums(returned.last, _header.GetNumberOfBlocks(), _header.WeakChecksumLength,
                                                _header.StrongChecksumLength);
            NLog.LogManager.GetCurrentClassLogger().Info($"Total blocks for {_header.Filename}: {_blockSums.Count}, expected {_header.GetNumberOfBlocks()}");
            if (_header.GetNumberOfBlocks() != _blockSums.Count)
            {
                throw new Exception();
            }
        }
Ejemplo n.º 2
0
 public bool ChecksumsMatch(BlockSum other)
 {
     return(GetRsum() == other.GetRsum() && GetChecksum().SequenceEqual(other.GetChecksum()));
 }
Ejemplo n.º 3
0
 protected bool Equals(BlockSum other)
 {
     return(_rsum == other._rsum);
 }