public override byte ReadByte() { byte result = base.ReadByte(); if (autoAlignOn) { bytesSinceAlignStart++; } if (checksumCalculator?.CalculateForDecryptedData == false) { checksumCalculator?.AddByte(result); } if (xorKey.HasValue) { result = (byte)(result ^ xorKey.Value); } if (checksumCalculator?.CalculateForDecryptedData == true) { checksumCalculator?.AddByte(result); } return(result); }
public override void Write(byte value) { if (checksumCalculator?.CalculateForDecryptedData == true) { checksumCalculator?.AddByte(value); } if (xorKey.HasValue) { value = (byte)(value ^ xorKey.Value); } if (checksumCalculator?.CalculateForDecryptedData == false) { checksumCalculator?.AddByte(value); } base.Write(value); if (autoAlignOn) { bytesSinceAlignStart++; } }