/// <summary> /// Creates a new EDID instance with the provided EDID binary data /// </summary> /// <param name="data">An array of bytes holding the EDID binary data</param> /// <exception cref="InvalidEDIDException">Invalid EDID binary data.</exception> public EDID(byte[] data) { if (data.Length < 128) { throw new InvalidEDIDException("EDID data must be at least 128 bytes."); } _reader = new BitAwareReader(data); if (!_reader.ReadBytes(0, 8).SequenceEqual(FixedHeader)) { throw new InvalidEDIDException("EDID header missing."); } if (_reader.Data.Take(128).Aggregate(0, (i, b) => (i + b) % 256) > 0) { throw new InvalidEDIDException("EDID checksum failed."); } if (EDIDVersion.Major != 1) { throw new InvalidEDIDException("Invalid EDID major version."); } if (EDIDVersion.Minor == 0) { throw new InvalidEDIDException("Invalid EDID minor version."); } DisplayParameters = new DisplayParameters(this, _reader); }
/// <inheritdoc /> public bool Equals(EDIDExtension other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Reader.ReadBytes(Offset, 128).SequenceEqual(other.Reader.ReadBytes(other.Offset, 128))); }
/// <inheritdoc /> public bool Equals(EDID other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(_reader.ReadBytes(0, 128).SequenceEqual(other._reader.ReadBytes(0, 128))); }
/// <inheritdoc /> public bool Equals(ChromaticityCoordinates other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(_reader.ReadBytes(25, 10).SequenceEqual(other._reader.ReadBytes(25, 10))); }
/// <inheritdoc /> public bool Equals(DisplayParameters other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(_reader.ReadBytes(20, 15).SequenceEqual(other._reader.ReadBytes(20, 15))); }
/// <inheritdoc /> public override int GetHashCode() { return(Reader?.ReadBytes(Offset, 128).GetHashCode() ?? 0); }
/// <inheritdoc /> public override int GetHashCode() { return(_reader?.ReadBytes(0, 128).GetHashCode() ?? 0); }