예제 #1
0
        internal virtual byte[] Encode()
        {
            var result = new List <byte>();

            var dataLength = (uint)Data.Length;
            var dataCrc    = PngCrc.Calculate(InputToCrcCheck());

            result.AddRange(dataLength.ToByteArray());
            result.AddRange(GetChunkTypeBytes(Type));
            result.AddRange(Data);
            result.AddRange(dataCrc.ToByteArray());

            return(result.ToArray());
        }
예제 #2
0
        private bool CrcCheck()
        {
            var crcInputBytes = InputToCrcCheck();

            return(PngCrc.Calculate(crcInputBytes) == Crc);
        }