예제 #1
0
        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);
        }
예제 #2
0
파일: Writer.cs 프로젝트: PluMGMK/Ray1Map
        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++;
            }
        }