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

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

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

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

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