private void ValidateHeader() { ByteVector data = ReadBlock(8); if (data.Count != 8) { throw new CorruptFileException("Unexpected end of header"); } if (!data.Equals(new ByteVector(HEADER))) { throw new CorruptFileException("PNG Header was expected"); } }