Example #1
0
        internal static EDIDDescriptor FromData(EDID edid, BitAwareReader reader, int offset)
        {
            var types =
                Assembly.GetAssembly(typeof(EDIDDescriptor))
                .GetTypes()
                .Where(t => t.IsSubclassOf(typeof(EDIDDescriptor)));

            foreach (var type in types)
            {
                try
                {
                    var value = Activator.CreateInstance(type, BindingFlags.NonPublic | BindingFlags.Instance, null,
                                                         new object[] { edid, reader, offset }, null) as EDIDDescriptor;
                    if (value?.IsValid == true)
                    {
                        return(value);
                    }
                }
                catch
                {
                    // ignored
                }
            }
            return(null);
        }
Example #2
0
 internal EDIDExtension(EDID edid, BitAwareReader reader, int offset)
 {
     EDID   = edid;
     Reader = reader;
     Offset = offset;
     if (reader.Data.Length - offset < 128)
     {
         throw new InvalidExtensionException("Extension data must be exactly 128 bytes.");
     }
     if (reader.Data.Skip(offset).Take(128).Aggregate(0, (i, b) => (i + b) % 256) > 0)
     {
         throw new InvalidExtensionException("Extension checksum failed.");
     }
 }
Example #3
0
 internal DisplayParameters(EDID edid, BitAwareReader reader)
 {
     _edid   = edid;
     _reader = reader;
 }
Example #4
0
 internal EDIDDescriptor(EDID edid, BitAwareReader reader, int offset)
 {
     EDID   = edid;
     Reader = reader;
     Offset = offset;
 }