Skip to content

Commit

Permalink
- Adds Many structures, enumerations, win32 native methods have been …
Browse files Browse the repository at this point in the history
…added to iTin.Core.Interop project, for video cards, video modes, monitors, storage, etc...

- Adds two new properties have been added (to meet the specification),
  a.WeekOfManufactureOrModelYearFlag
  b.YearOfManufactureOrModelYear
- Due to a problem with duplicate properties of the same type, the data type for storing the properties has been changed in iTin.Core.Hardware project.
- Updates README.md / txt files.
- Updates CHANGELOG.md file.
- Minor changes.
- Nuget package created (1.0.3)
  • Loading branch information
iAJTin committed Sep 2, 2019
1 parent aa28788 commit 6e94ccd
Show file tree
Hide file tree
Showing 88 changed files with 9,716 additions and 4,583 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.0.3] - 2019-09-02

### Added

- **iTin.Core.Interop**:
- Many structures, enumerations, win32 native methods have been added to project, for video cards, video modes, monitors, storage, etc ...

- **iTin.Core.Hardware.Specification.Eedid**:
- Two new properties have been added (to meet the specification),
1. WeekOfManufactureOrModelYearFlag
2. YearOfManufactureOrModelYear

- Minor changes.

### Changed

- **iTin.Core.Hardware**:
- Due to a problem with duplicate properties of the same type, the data type for storing the properties has been changed. (This change should not affect current behavior).

### Fixed

- **iTin.Core.Hardware.Specification.Eedid**:
- Fixed an issue that did not allow you to correctly calculate the value of the property **ManufactureDate** of the section **Vendor**

- Fixed an issue that did not allow the property value **IdSerialNumber** of the **Vendor** section to be calculated correctly

## [1.0.2] - 2019-08-28

### Added
Expand All @@ -23,6 +49,7 @@ All notable changes to this project will be documented in this file.
- Minor changes.

### Changed

- The solution has been migrated to **.NetStandard**.

- The supported targets are:
Expand All @@ -41,6 +68,7 @@ All notable changes to this project will be documented in this file.
### Added
- Create project and first commit

[1.0.3]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.3
[1.0.2]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.2
[1.0.1]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.1
[1.0.0]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.0
351 changes: 176 additions & 175 deletions README.md

Large diffs are not rendered by default.

62 changes: 30 additions & 32 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,28 @@ Examples

3. Prints all EEDID blocks properties.

EEDID eedid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable);
DataBlockCollection blocks = eedid.Blocks;
EEDID edid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable);
DataBlockCollection blocks = edid.Blocks;
foreach (DataBlock block in blocks)
{
{
Console.WriteLine();
Console.WriteLine(@" ——————————————————————————————————————————————————————————————");
Console.WriteLine($@" {block.Key} Block");
Console.WriteLine(@" ——————————————————————————————————————————————————————————————");
Console.WriteLine($@" > {block.Key} Block");

var implSections = eedid.Blocks[block.Key].Sections.ImplementedSections;
Console.WriteLine();
Console.WriteLine(" > Implemented Sections");
Console.WriteLine(@" > Implemented Sections");
foreach (Enum section in implSections)
{
Console.WriteLine($@" > {GetFriendlyName(section)}");
Console.WriteLine($@" > {GetFriendlyName(section)}");
}

Console.WriteLine();
Console.WriteLine(" > Sections detail");
Console.WriteLine(@" > Sections detail");
BaseDataSectionCollection sections = block.Sections;
foreach (DataSection section in sections)
{
Console.WriteLine();
Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section");
Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section");

SectionPropertiesTable sectionProperties = section.Properties.Values;
foreach (KeyValuePair<IPropertyKey, object> property in sectionProperties)
Expand All @@ -76,79 +74,79 @@ Examples

if (value == null)
{
Console.WriteLine($@" > {friendlyName} > NULL");
Console.WriteLine($@" > {friendlyName} > NULL");
continue;
}

if (value is string)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit}");
Console.WriteLine($@" > {friendlyName} > {value}{unit}");
}
else if (value is bool)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit}");
Console.WriteLine($@" > {friendlyName} > {value}{unit}");
}
else if (value is double)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit}");
Console.WriteLine($@" > {friendlyName} > {value}{unit}");
}
else if (value is byte)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]");
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]");
}
else if (value is short)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]");
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]");
}
else if (value is ushort)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]");
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]");
}
else if (value is int)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]");
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]");
}
else if (value is uint)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]");
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]");
}
else if (value is long)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]");
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]");
}
else if (value is ulong)
{
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]");
Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]");
}
else if (value is PointF)
{
Console.WriteLine($@" > {friendlyName}");
Console.WriteLine($@" > X > {((PointF)value).X}");
Console.WriteLine($@" > Y > {((PointF)value).Y}");
Console.WriteLine($@" > {friendlyName}");
Console.WriteLine($@" > X > {((PointF)value).X}");
Console.WriteLine($@" > Y > {((PointF)value).Y}");
}
else if (value.GetType() == typeof(ReadOnlyCollection<string>))
{
Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection<string>)value)}");
Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection<string>)value)}");
}
else if (value.GetType() == typeof(ReadOnlyCollection<byte>))
{
Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection<byte>)value)}");
Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection<byte>)value)}");
}
else if (value is StandardTimingIdentifierDescriptorItem)
{
Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}");
Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}");
}
else if (value.GetType() == typeof(ReadOnlyCollection<MonitorResolutionInfo>))
{
var resolutions = (ReadOnlyCollection<MonitorResolutionInfo>)value;
foreach (MonitorResolutionInfo resolution in resolutions)
foreach (MonitorResolutionInfo resolution in resolutions)
{
Console.WriteLine($@" > {resolution}");
Console.WriteLine($@" > {resolution}");
}
}
else if (value.GetType() == typeof(SectionPropertiesTable))
{
Console.WriteLine($@" > {friendlyName}");
Console.WriteLine($@" > {friendlyName}");
var dataBlockProperties = (SectionPropertiesTable)value;
foreach (KeyValuePair<IPropertyKey, object> dataBlockProperty in dataBlockProperties)
{
Expand All @@ -162,12 +160,12 @@ Examples
? string.Empty
: dataBlockUnit.ToString();

Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}");
Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}");
}
}
else
{
Console.WriteLine($@" > {friendlyName} > {value}{unit}");
Console.WriteLine($@" > {friendlyName} > {value}{unit}");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion nuget/BuildNuGet.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
CLS

..\src\.nuget\nuget Pack iEEDID.1.0.2.nuspec -NoDefaultExcludes -NoPackageAnalysis -OutputDirectory ..\deployment\nuget
..\src\.nuget\nuget Pack iEEDID.1.0.3.nuspec -NoDefaultExcludes -NoPackageAnalysis -OutputDirectory ..\deployment\nuget

pause

2 changes: 1 addition & 1 deletion nuget/iEEDID.1.0.2.nuspec → nuget/iEEDID.1.0.3.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>iEEDID</id>
<version>1.0.2</version>
<version>1.0.3</version>
<title>iEEDID</title>
<authors>iAJTin</authors>
<owners>iAJTin</owners>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ namespace iTin.Core.Hardware.Specification

using Eedid;

using Interop.Edid;

/// <summary>
/// Implementation of the <strong>E-EDID</strong> (Extended Display Identification Data) specification.
/// </summary>
Expand Down Expand Up @@ -203,9 +201,22 @@ private static IEnumerable<ReadOnlyCollection<byte>> GetExtensionDataBlocks(Read
var extensionBlockCount = edidData[0x7e];
var dataBlocks = new List<ReadOnlyCollection<byte>>();

for (int n = 0x01, i = 0x00; i < extensionBlockCount; i++, n++)
if (extensionBlockCount == 0)
{
for (int n = 0x01, i = 0x00; i < extensionBlockCount; i++, n++)
{
dataBlocks.Add(edidData.Extract((byte) (n * 0x80), 0x80));
}
}
else
{
dataBlocks.Add(edidData.Extract((byte)(n * 0x80), 0x80));
if (edidData.Count > 0x80)
{
for (int n = 0x01, i = 0x00; i < extensionBlockCount; i++, n++)
{
dataBlocks.Add(edidData.Extract((byte)(n * 0x80), 0x80));
}
}
}

return dataBlocks;
Expand Down Expand Up @@ -263,10 +274,5 @@ private void InitBlockTable(IDictionary<KnownDataBlock, BaseDataBlock> blockDict
#endregion

#endregion

public static void EnumMonitorDevices()
{
SafeNativeMethods.EnumMonitorDevices();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal enum EdidVendorProperty
IdManufacturerName,

[PropertyDescription("")]
[PropertyType(typeof(int))]
[PropertyType(typeof(string))]
[PropertyName("Product Code")]
IdProductCode,

Expand All @@ -48,11 +48,16 @@ internal enum EdidVendorProperty

[PropertyDescription("")]
[PropertyType(typeof(byte?))]
[PropertyName("Week Of Manufacture")]
WeekOfManufacture,
[PropertyName("Week Of Manufacture Or Model Year Flag")]
WeekOfManufactureOrModelYear,

[PropertyDescription("")]
[PropertyType(typeof(byte))]
[PropertyType(typeof(byte?))]
[PropertyName("Year Of Manufacture Or Model Year")]
YearOfManufactureOrModelYear,

[PropertyDescription("")]
[PropertyType(typeof(string))]
[PropertyName("Manufacturer Date")]
ManufactureDate,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,29 @@ public VendorEdidSection(ReadOnlyCollection<byte> sectionData) : base(sectionDat
/// Property value.
/// </value>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private uint IdSerialNumber => (uint)RawData.GetWord(0x04);
private uint IdSerialNumber => (uint)RawData.GetDoubleWord(0x04);
#endregion

#region [private] (byte) WeekOfManufacture: Gets a value representing the 'Week Of Manufacture' field.
#region [private] (byte) WeekOfManufactureOrModelYearFlag: Gets a value representing the 'Week Of Manufacture' field.
/// <summary>
/// Gets a value representing the <c>Week Of Manufacture</c> field.
/// </summary>
/// <value>
/// Property value.
/// </value>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private byte WeekOfManufacture => RawData[0x08];
private byte WeekOfManufactureOrModelYearFlag => RawData[0x08];
#endregion

#region [private] (byte) ManufactureDate: Gets a value representing the 'Manufacture Date' field
#region [private] (byte) YearOfManufactureOrModelYear: Gets a value representing the 'Year Of Manufacture' field.
/// <summary>
/// Gets a value representing the <c>Manufacture Date</c> field.
/// Gets a value representing the <c>Year Of Manufacture</c> field.
/// </summary>
/// <value>
/// Property value.
/// </value>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private byte ManufactureDate => (byte) (1990 + RawData[0x09]);
private byte YearOfManufactureOrModelYear => RawData[0x09];
#endregion

#endregion
Expand All @@ -131,28 +131,27 @@ public VendorEdidSection(ReadOnlyCollection<byte> sectionData) : base(sectionDat
protected override void PopulateProperties(SectionPropertiesTable properties)
{
properties.Add(EedidProperty.Edid.Vendor.IdManufacturerName, IdManufacturerName);
properties.Add(EedidProperty.Edid.Vendor.IdProductCode, IdProductCode);
properties.Add(EedidProperty.Edid.Vendor.IdProductCode, $"{IdProductCode:X4}");

var idSerialNumber = IdSerialNumber;
if (idSerialNumber != 0x0000)
{
properties.Add(EedidProperty.Edid.Vendor.IdSerialNumber, (int?)IdSerialNumber);
}

var weekOfManufacture = WeekOfManufacture;
if (weekOfManufacture != 0x00)
properties.Add(EedidProperty.Edid.Vendor.WeekOfManufactureOrModelYear, WeekOfManufactureOrModelYearFlag);
properties.Add(EedidProperty.Edid.Vendor.YearOfManufactureOrModelYear, YearOfManufactureOrModelYear);
var modelYearStrategy = WeekOfManufactureOrModelYearFlag == 0xff || WeekOfManufactureOrModelYearFlag == 0x00 ? KnownModelYearStrategy.ModelYear : KnownModelYearStrategy.YearOfManufacture;
properties.Add(EedidProperty.Edid.Vendor.ModelYearStrategy, modelYearStrategy);

if (modelYearStrategy == KnownModelYearStrategy.ModelYear)
{
if (weekOfManufacture != 0xff)
{
if (weekOfManufacture >= 0x01 && weekOfManufacture <= 0x36)
{
properties.Add(EedidProperty.Edid.Vendor.WeekOfManufacture, WeekOfManufacture);
}
}
properties.Add(EedidProperty.Edid.Vendor.ManufactureDate, 1990 + YearOfManufactureOrModelYear);
}
else
{
properties.Add(EedidProperty.Edid.Vendor.ManufactureDate, $"{WeekOfManufactureOrModelYearFlag} / {1990 + YearOfManufactureOrModelYear}");
}

properties.Add(EedidProperty.Edid.Vendor.ManufactureDate, ManufactureDate);
properties.Add(EedidProperty.Edid.Vendor.ModelYearStrategy, weekOfManufacture == 0xff ? KnownModelYearStrategy.ModelYear : KnownModelYearStrategy.YearOfManufacture);
}
#endregion

Expand Down
Loading

0 comments on commit 6e94ccd

Please sign in to comment.