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()); }
private bool CrcCheck() { var crcInputBytes = InputToCrcCheck(); return(PngCrc.Calculate(crcInputBytes) == this.Crc); }