private void ValidateHeader() { if (!_colorTypes.ContainsKey(_header.ColorType)) { throw new ImageFormatException("Color type is not supported or not valid."); } //if (!_colorTypes[_header.ColorType].SupportedBitDepths.Contains(_header.BitDepth)) if (!IEnum.Contains(_colorTypes[_header.ColorType].SupportedBitDepths, _header.BitDepth)) { throw new ImageFormatException("Bit depth is not supported or not valid."); } if (_header.FilterMethod != 0) { throw new ImageFormatException("The png specification only defines 0 as filter method."); } if (_header.InterlaceMethod != 0) { throw new ImageFormatException("Interlacing is not supported."); } }