diff --git a/CHANGELOG.md b/CHANGELOG.md index 422526d..9c68241 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,22 @@ # Changelog All notable changes to this project will be documented in this file. -## [1.0.6] - +## [1.0.6] - 2020-10-12 ### Changed +- Library versions for this version + +|Library|Version|Description| +|:------|:------|:----------| +|iTin.Core| **2.0.0.1** | Base library containing various extensions, helpers, common constants | +|iTin.Core.Hardware.Common| **1.0.0.1** | Common Hardware Infrastructure | +|iTin.Core.Hardware.Specification.Eedid|**1.0.0.6**| Implementation of the E-EDID (Extended Display Identification Data) specification | +|iTin.Logging| 1.0.0.0 | Logging library | -### Added - - +### Removed +- Removed **netcoreapp** targets. Current supported targets, **net461** and **netstandard20** ## [1.0.5] - 2020-10-07 @@ -125,6 +132,7 @@ All notable changes to this project will be documented in this file. ### Added - Create project and first commit +[1.0.6]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.6 [1.0.5]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.5 [1.0.4]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.4 [1.0.3]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.3 diff --git a/README.md b/README.md index 47feaee..ae90608 100644 --- a/README.md +++ b/README.md @@ -44,215 +44,192 @@ 1. Gets and prints all **EEDID** implemented blocks. - EEDID edid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); - DataBlockCollection blocks = edid.Blocks; - foreach (KnownDataBlock block in blocks.ImplementedBlocks) - { - Console.WriteLine($@" > {block}"); - } + EEDID edid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); + DataBlockCollection blocks = edid.Blocks; + foreach (KnownDataBlock block in blocks.ImplementedBlocks) + { + Console.WriteLine($@" > {block}"); + } 2. Gets a specific **EEDID** block. - EEDID edid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); - DataBlockCollection blocks = edid.Blocks; - DataBlock edid = blocks[KnownDataBlock.EDID]; - if (edid != null) - { - /// block exist!!! - } + EEDID edid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); + DataBlockCollection blocks = edid.Blocks; + DataBlock edid = blocks[KnownDataBlock.EDID]; + if (edid != null) + { + /// block exist!!! + } 3. Prints all **EEDID** blocks properties. - { - EEDID edid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); - DataBlockCollection blocks = edid.Blocks; - foreach (DataBlock block in blocks) - { - Console.WriteLine(); - Console.WriteLine($@" > {block.Key} Block"); - - Console.WriteLine(); - Console.WriteLine(@" > Implemented Sections"); - ReadOnlyCollection implSections = eedid.Blocks[block.Key].Sections.ImplementedSections; - foreach (Enum section in implSections) - { - Console.WriteLine($@" > {GetFriendlyName(section)}"); - } - - Console.WriteLine(); - Console.WriteLine(@" > Sections detail"); - BaseDataSectionCollection sections = block.Sections; - foreach (DataSection section in sections) - { - Console.WriteLine(); - Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section"); - - IEnumerable properties = section.ImplementedProperties; - foreach (IPropertyKey property in properties) - { - string friendlyName = GetFriendlyName(property); - - QueryPropertyResult queryResult = section.GetProperty(property); - PropertyItem propertyItem = queryResult.Value; - object value = propertyItem.Value; - - PropertyUnit valueUnit = property.PropertyUnit; - string unit = valueUnit == PropertyUnit.None ? string.Empty : valueUnit.ToString(); - - if (value == null) - { - Console.WriteLine($@" > {friendlyName} > NULL"); - continue; - } - - if (value is string) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); - } - else if (value is bool) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); - } - else if (value is double) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); - } - else if (value is byte) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]"); - } - else if (value is short) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); - } - else if (value is ushort) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); - } - else if (value is int) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); - } - else if (value is uint) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); - } - else if (value is long) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); - } - else if (value is ulong) - { - 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}"); - } - else if (value.GetType() == typeof(ReadOnlyCollection)) - { - Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); - } - else if (value.GetType() == typeof(ReadOnlyCollection)) - { - Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); - } - else if (value is StandardTimingIdentifierDescriptorItem) - { - Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}"); - } - else if (value.GetType() == typeof(ReadOnlyCollection)) - { - var resolutions = (ReadOnlyCollection)value; - foreach (MonitorResolutionInfo resolution in resolutions) - { + { + EEDID eedid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); + DataBlockCollection blocks = eedid.Blocks; + foreach (DataBlock block in blocks) + { + var implSections = eedid.Blocks[block.Key].Sections.ImplementedSections; + BaseDataSectionCollection sections = block.Sections; + foreach (DataSection section in sections) + { + Console.WriteLine(); + Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section"); + + IEnumerable properties = section.ImplementedProperties; + foreach (IPropertyKey property in properties) + { + QueryPropertyResult queryResult = section.GetProperty(property); + PropertyItem propertyItem = queryResult.Value; + object value = propertyItem.Value; + PropertyUnit valueUnit = property.PropertyUnit; + string friendlyName = property.GetPropertyName(); + string unit = valueUnit == PropertyUnit.None ? string.Empty : valueUnit.ToString(); + + if (value == null) + { + Console.WriteLine($@" > {friendlyName} > NULL"); + continue; + } + + if (value is string) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + } + else if (value is bool) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + } + else if (value is double) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + } + else if (value is byte) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]"); + } + else if (value is short) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + } + else if (value is ushort) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + } + else if (value is int) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + } + else if (value is uint) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + } + else if (value is long) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); + } + else if (value is ulong) + { + 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}"); + } + else if (value.GetType() == typeof(ReadOnlyCollection)) + { + Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); + } + else if (value.GetType() == typeof(ReadOnlyCollection)) + { + Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); + } + else if (value is StandardTimingIdentifierDescriptorItem) + { + Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}"); + } + else if (value.GetType() == typeof(ReadOnlyCollection)) + { + var resolutions = (ReadOnlyCollection)value; + foreach (MonitorResolutionInfo resolution in resolutions) + { Console.WriteLine($@" > {resolution}"); - } - } - else if (value.GetType() == typeof(SectionPropertiesTable)) - { - Console.WriteLine($@" > {friendlyName}"); - var dataBlockProperties = (SectionPropertiesTable)value; - foreach (PropertyItem dataBlockProperty in dataBlockProperties) - { - object dataValue = dataBlockProperty.Value; - - IPropertyKey dataBlockKey = (PropertyKey)dataBlockProperty.Key; - string dataName = GetFriendlyName(dataBlockKey); - PropertyUnit dataBlockUnit = dataBlockKey.PropertyUnit; - string dataUnit = dataBlockUnit == PropertyUnit.None ? string.Empty : dataBlockUnit.ToString(); - Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); - } - } - else - { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); - } - } - } - } - } - - ... - ... - ... - - private static string GetFriendlyName(Enum value) - { - string friendlyName = value.GetPropertyName(); - - return string.IsNullOrEmpty(friendlyName) - ? value.ToString() - : friendlyName; - } - - private static string GetFriendlyName(IPropertyKey value) - { - string friendlyName = value.GetPropertyName(); - - return string.IsNullOrEmpty(friendlyName) - ? value.PropertyId.ToString() - : friendlyName; - } - - - // nested classes - private class MacBookPro2018 - { - public static readonly byte[] IntegratedLaptopPanelEdidTable = - { - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x42, 0x4c, 0x00, 0x50, 0x89, 0x13, 0x00, 0x00, - 0x06, 0x17, 0x01, 0x03, 0x0e, 0x21, 0x14, 0x78, - 0x6f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, - 0x0f, 0x50, 0x54, 0x21, 0x08, 0x00, 0x81, 0x80, - 0x81, 0x40, 0x81, 0x00, 0x90, 0x40, 0x95, 0x00, - 0xa9, 0x40, 0xb3, 0x00, 0xd1, 0x00, 0xe5, 0xa7, - 0x20, 0x00, 0xd0, 0x34, 0x20, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, - 0x00, 0x00, 0x00, 0xfd, 0x00, 0x38, 0x40, 0x05, - 0xfa, 0xfa, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x50, - 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x73, - 0x20, 0x56, 0x75, 0x0a, 0x00, 0x00, 0x00, 0x10, - 0x00, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, - 0x6c, 0x73, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0xc0 - }; - } + } + } + else if (value.GetType() == typeof(SectionPropertiesTable)) + { + Console.WriteLine($@" > {friendlyName}"); + var dataBlockProperties = (SectionPropertiesTable)value; + foreach (PropertyItem dataBlockProperty in dataBlockProperties) + { + object dataValue = dataBlockProperty.Value; + + IPropertyKey dataBlockKey = (PropertyKey)dataBlockProperty.Key; + string dataName = dataBlockKey.GetPropertyName(); + PropertyUnit dataBlockUnit = dataBlockKey.PropertyUnit; + string dataUnit = dataBlockUnit == PropertyUnit.None ? string.Empty : dataBlockUnit.ToString(); + Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); + } + } + else + { + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + } + } + } + } + } + + ... + ... + ... + + private static string GetFriendlyName(Enum value) + { + string friendlyName = value.GetPropertyName(); + + return string.IsNullOrEmpty(friendlyName) + ? value.ToString() + : friendlyName; + } + + + // nested classes + private class MacBookPro2018 + { + public static readonly byte[] IntegratedLaptopPanelEdidTable = + { + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x42, 0x4c, 0x00, 0x50, 0x89, 0x13, 0x00, 0x00, + 0x06, 0x17, 0x01, 0x03, 0x0e, 0x21, 0x14, 0x78, + 0x6f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, + 0x0f, 0x50, 0x54, 0x21, 0x08, 0x00, 0x81, 0x80, + 0x81, 0x40, 0x81, 0x00, 0x90, 0x40, 0x95, 0x00, + 0xa9, 0x40, 0xb3, 0x00, 0xd1, 0x00, 0xe5, 0xa7, + 0x20, 0x00, 0xd0, 0x34, 0x20, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, + 0x00, 0x00, 0x00, 0xfd, 0x00, 0x38, 0x40, 0x05, + 0xfa, 0xfa, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x50, + 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x73, + 0x20, 0x56, 0x75, 0x0a, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, + 0x6c, 0x73, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0xc0 + }; + } 4. Gets a **single property** directly. - DataBlock edidBlock = eedid.Blocks[KnownDataBlock.EDID]; - BaseDataSectionCollection edidSections = edidBlock.Sections; - DataSection basicDisplaySection = edidSections[(int)KnownEdidSection.BasicDisplay]; - QueryPropertyResult gammaResult = basicDisplaySection.GetProperty(EedidProperty.Edid.BasicDisplay.Gamma); - if (gammaResult.Success) - { - Console.WriteLine($@" > Gamma > {gammaResult.Value.Value}"); - } + DataBlock edidBlock = eedid.Blocks[KnownDataBlock.EDID]; + BaseDataSectionCollection edidSections = edidBlock.Sections; + DataSection basicDisplaySection = edidSections[(int)KnownEdidSection.BasicDisplay]; + QueryPropertyResult gammaResult = basicDisplaySection.GetProperty(EedidProperty.Edid.BasicDisplay.Gamma); + if (gammaResult.Success) + { + Console.WriteLine($@" > Gamma > {gammaResult.Value.Value}"); + } # How can I send feedback!!! diff --git a/README.txt b/README.txt index 375ab0d..3fcd67d 100644 --- a/README.txt +++ b/README.txt @@ -4,25 +4,48 @@ What is iEEDID? iEEDID is a lightweight implementation that allows us to obtain the the EEDID information. -Library versions -================ -Library versions for current iEEDID version (1.0.5) - -•——————————————————————————————————————————————————————————————————————————————————————————————• -| Library Version Description | -•——————————————————————————————————————————————————————————————————————————————————————————————• -|iTin.Core 2.0.0.0 Base library containing various | -| extensions, helpers, common constants | -•——————————————————————————————————————————————————————————————————————————————————————————————• -|iTin.Core.Hardware.Common 1.0.0.0 Common Hardware Infrastructure | -•——————————————————————————————————————————————————————————————————————————————————————————————• -|iTin.Core.Hardware.Specification.Eedid 1.0.0.5 Implementation of the E-EDID | -| (Extended Display Identification Data) | -| specification | -•——————————————————————————————————————————————————————————————————————————————————————————————• -|iTin.Logging 1.0.0.0 Logging library | -•——————————————————————————————————————————————————————————————————————————————————————————————• +Changes in this version (v1.0.6) +================================ + +Changed +------- + +library versions +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +| Library Version Description | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +|iTin.Core 2.0.0.1 Base library containing various extensions, helpers, common constants | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +|iTin.Core.Hardware.Common 1.0.0.1 Common Hardware Infrastructure | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +|iTin.Core.Hardware.Specification.Eedid 1.0.0.6 Implementation of the E-EDID (Extended Display Identification Data) specification | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +|iTin.Logging 1.0.0.0 Logging library | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• + +Removed +------- + +- Removed netcoreapp target. Current supported targets, net461 and netstandard20 + + +v1.0.5 +====== + +library versions +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +| Library Version Description | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +|iTin.Core 2.0.0.0 Base library containing various extensions, helpers, common constants | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +|iTin.Core.Hardware.Common 1.0.0.0 Common Hardware Infrastructure | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +|iTin.Core.Hardware.Specification.Eedid 1.0.0.5 Implementation of the E-EDID (Extended Display Identification Data) specification | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• +|iTin.Logging 1.0.0.0 Logging library | +•—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————• + Install via NuGet ================= diff --git a/nuget/BuildNuGet.bat b/nuget/BuildNuGet.bat index b41db63..6ef5be5 100644 --- a/nuget/BuildNuGet.bat +++ b/nuget/BuildNuGet.bat @@ -1,7 +1,7 @@ @ECHO OFF CLS -..\src\.nuget\nuget Pack iEEDID.1.0.5.nuspec -NoDefaultExcludes -NoPackageAnalysis -OutputDirectory ..\deployment\nuget +..\src\.nuget\nuget Pack iEEDID.1.0.6.nuspec -NoDefaultExcludes -NoPackageAnalysis -OutputDirectory ..\deployment\nuget pause diff --git a/nuget/iEEDID.1.0.5.nuspec b/nuget/iEEDID.1.0.6.nuspec similarity index 89% rename from nuget/iEEDID.1.0.5.nuspec rename to nuget/iEEDID.1.0.6.nuspec index 59c39f3..a73fe4f 100644 --- a/nuget/iEEDID.1.0.5.nuspec +++ b/nuget/iEEDID.1.0.6.nuspec @@ -2,7 +2,7 @@ iEEDID - 1.0.5 + 1.0.6 iEEDID iAJTin iAJTin @@ -20,15 +20,11 @@ - - - - - + diff --git a/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/ComponentModel/PropertyItemDictionary.cs b/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/ComponentModel/PropertyItemDictionary.cs new file mode 100644 index 0000000..3acf58b --- /dev/null +++ b/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/ComponentModel/PropertyItemDictionary.cs @@ -0,0 +1,12 @@ + +namespace iTin.Core.Hardware.Common.ComponentModel +{ + using System.Collections.Generic; + + /// + /// Define a suitable generic dictionary to store properties and their position inside a collection. + /// + public class PropertyItemDictionary : Dictionary + { + } +} diff --git a/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/Property.cs b/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/PropertyItem.cs similarity index 100% rename from src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/Property.cs rename to src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/PropertyItem.cs diff --git a/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/PropertyKey.cs b/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/PropertyKey.cs index 903c2ab..a72a7f5 100644 --- a/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/PropertyKey.cs +++ b/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/PropertyKey.cs @@ -119,12 +119,19 @@ public PropertyKey(Enum structureId, Enum propertyId, PropertyUnit propertyUnit) #region [public] (string) GetPropertyName: Returns the property name /// - /// Returns the property name. + /// Returns the property name. If is null or empty then returns this property name. /// /// /// Property name. /// - public string GetPropertyName() => PropertyId.GetPropertyName(); + public string GetPropertyName() + { + string name = PropertyId.GetPropertyName(); + + return string.IsNullOrEmpty(name) + ? PropertyId.ToString() + : name; + } #endregion #region [public] (Type) GetPropertyType: Returns the property type diff --git a/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/Results/QueryPropertyDictionaryResult.cs b/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/Results/QueryPropertyDictionaryResult.cs new file mode 100644 index 0000000..76876ab --- /dev/null +++ b/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/Property/Results/QueryPropertyDictionaryResult.cs @@ -0,0 +1,109 @@ + +namespace iTin.Core.Hardware.Common +{ + using System.Collections.Generic; + + using iTin.Core.ComponentModel; + + using ComponentModel; + + /// + /// Specialization of interface.
+ /// Where T is .
+ /// Represents result after query operation. + ///
+ public class QueryPropertyDictionaryResult : ResultBase + { + /// + /// Returns a new with specified detailed error. + /// + /// Error message + /// Error code + /// + /// A new invalid with specified detailed error. + /// + public new static QueryPropertyDictionaryResult CreateErroResult(string message, string code = "") => CreateErroResult(new IResultError[] { new ResultError { Code = code, Message = message } }); + + /// + /// Returns a new with specified detailed error. + /// + /// Error message + /// Result value + /// Error code + /// + /// A new invalid with specified detailed error. + /// + public new static QueryPropertyDictionaryResult CreateErroResult(string message, PropertyItemDictionary value, string code = "") => CreateErroResult(new IResultError[] { new ResultError { Code = code, Message = message } }, value); + + /// + /// Returns a new with specified detailed errors collection. + /// + /// A errors collection + /// + /// A new invalid with specified detailed errors collection. + /// + public new static QueryPropertyDictionaryResult CreateErroResult(IResultError[] errors) => + new QueryPropertyDictionaryResult + { + Value = default, + Success = false, + Errors = (IResultError[])errors.Clone() + }; + + /// + /// Returns a new with specified detailed errors collection. + /// + /// A errors collection + /// Result value + /// + /// A new invalid with specified detailed errors collection. + /// + public new static QueryPropertyDictionaryResult CreateErroResult(IResultError[] errors, PropertyItemDictionary value) => + new QueryPropertyDictionaryResult + { + Value = value, + Success = false, + Errors = (IResultError[])errors.Clone() + }; + + /// + /// Returns a new success result. + /// + /// Result value + /// + /// A new valid . + /// + public new static QueryPropertyDictionaryResult CreateSuccessResult(PropertyItemDictionary value) => + new QueryPropertyDictionaryResult + { + Value = value, + Success = true, + Errors = new List() + }; + + /// + /// Creates a new instance from known exception. + /// + /// Target exception. + /// + /// A new instance for specified exception. + /// + public new static QueryPropertyDictionaryResult FromException(System.Exception exception) => FromException(exception, default); + + /// + /// Creates a new instance from known exception. + /// + /// Target exception. + /// Result value + /// + /// A new instance for specified exception. + /// + public new static QueryPropertyDictionaryResult FromException(System.Exception exception, PropertyItemDictionary value) => + new QueryPropertyDictionaryResult + { + Value = value, + Success = false, + Errors = new List { new ResultExceptionError { Exception = exception } } + }; + } +} diff --git a/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/iTin.Core.Hardware.Common.csproj b/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/iTin.Core.Hardware.Common.csproj index 29dffe0..cc8cd76 100644 --- a/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/iTin.Core.Hardware.Common.csproj +++ b/src/lib/net/iTin.Core/iTin.Core.Hardware/iTin.Core.Hardware.Common/iTin.Core.Hardware.Common.csproj @@ -1,15 +1,19 @@  - net461;netstandard2.0;netcoreapp2.0;netcoreapp2.1 + net461;netstandard2.0 true key.snk - iTin - Common Hardware Infrastructure - MIT true - 1.0.0.0 + iTin.Core.Hardware.Common + iTin.Core.Hardware.Common + 1.0.0.1 + iTin + iTin + iTin.Core.Hardware.Common + Generic Common Hardware Infrastructure Copyright © 2020 + MIT diff --git a/src/lib/net/iTin.Core/iTin.Core/ComponentModel/Results/Base/ResultBase.cs b/src/lib/net/iTin.Core/iTin.Core/ComponentModel/Results/Base/ResultBase.cs index 8edbe60..2d7c3c2 100644 --- a/src/lib/net/iTin.Core/iTin.Core/ComponentModel/Results/Base/ResultBase.cs +++ b/src/lib/net/iTin.Core/iTin.Core/ComponentModel/Results/Base/ResultBase.cs @@ -29,6 +29,13 @@ protected ResultBase() #region public static properties + #region [public] {static} (IResult) ErrorResult: Returns a new result indicating that output result has not been successfully + /// + /// Returns a new result indicating that output result has not been successfully. + /// + public static IResult ErrorResult => new ResultBase { Success = false }; + #endregion + #region [public] {static} (IResult) NullResult: Returns a new result indicating a null result /// /// Returns a new result indicating a null result. diff --git a/src/lib/net/iTin.Core/iTin.Core/iTin.Core.csproj b/src/lib/net/iTin.Core/iTin.Core/iTin.Core.csproj index 5a2f016..482d0b6 100644 --- a/src/lib/net/iTin.Core/iTin.Core/iTin.Core.csproj +++ b/src/lib/net/iTin.Core/iTin.Core/iTin.Core.csproj @@ -1,17 +1,18 @@  - net461;netcoreapp2.1;netstandard2.0 + net461;netstandard2.0 true - Key.snk + key.snk true - 2.0.0.0 - Base library containing various extensions, helpers, common constants - Copyright © 2020 - + iTin.Core iTin.Core + 2.0.0.1 + iTin iTin iTin.Core + Base library containing various extensions, helpers, common constants + Copyright © 2020 MIT diff --git a/src/lib/net/iTin.Hardware/iTin.Hardware.Specification/iTin.Hardware.Specification.Eedid/iTin.Hardware.Specification.Eedid.csproj b/src/lib/net/iTin.Hardware/iTin.Hardware.Specification/iTin.Hardware.Specification.Eedid/iTin.Hardware.Specification.Eedid.csproj index 700d023..32ec3a2 100644 --- a/src/lib/net/iTin.Hardware/iTin.Hardware.Specification/iTin.Hardware.Specification.Eedid/iTin.Hardware.Specification.Eedid.csproj +++ b/src/lib/net/iTin.Hardware/iTin.Hardware.Specification/iTin.Hardware.Specification.Eedid/iTin.Hardware.Specification.Eedid.csproj @@ -1,14 +1,18 @@  - net461;netstandard2.0;netcoreapp2.0;netcoreapp2.1 - Implementation of the E-EDID (Extended Display Identification Data) specification - Copyright © 2019 - iTin + net461;netstandard2.0 true key.snk true - 1.0.0.5 + iTin.Hardware.Specification.Eedid + iTin.Hardware.Specification.Eedid + 1.0.0.6 + iTin + iTin + iTin.Hardware.Specification.Eedid + Implementation of the E-EDID (Extended Display Identification Data) specification + Copyright © 2020 MIT icon.png diff --git a/src/lib/net/iTin.Logging/iTin.Logging/iTin.Logging.csproj b/src/lib/net/iTin.Logging/iTin.Logging/iTin.Logging.csproj index b50bbd4..8f77b44 100644 --- a/src/lib/net/iTin.Logging/iTin.Logging/iTin.Logging.csproj +++ b/src/lib/net/iTin.Logging/iTin.Logging/iTin.Logging.csproj @@ -1,22 +1,19 @@  - net461;netcoreapp2.1;netstandard2.0 + net461;netstandard2.0 true - Key.snk + key.snk true - 1.0.0.0 - Logging library - Copyright © 2020 - + iTin.Logging iTin.Logging + 1.0.0.0 + iTin iTin iTin.Logging + Logging library + Copyright © 2020 MIT - - - - diff --git a/src/test/iEEDID.ConsoleApp/Program.cs b/src/test/iEEDID.ConsoleApp/Program.cs index 5188d1f..843c212 100644 --- a/src/test/iEEDID.ConsoleApp/Program.cs +++ b/src/test/iEEDID.ConsoleApp/Program.cs @@ -48,13 +48,11 @@ static void Main(string[] args) IEnumerable properties = section.ImplementedProperties; foreach (IPropertyKey property in properties) { - string friendlyName = GetFriendlyName(property); - QueryPropertyResult queryResult = section.GetProperty(property); PropertyItem propertyItem = queryResult.Value; object value = propertyItem.Value; - PropertyUnit valueUnit = property.PropertyUnit; + string friendlyName = property.GetPropertyName(); string unit = valueUnit == PropertyUnit.None ? string.Empty : valueUnit.ToString(); if (value == null) @@ -138,7 +136,7 @@ static void Main(string[] args) object dataValue = dataBlockProperty.Value; IPropertyKey dataBlockKey = (PropertyKey)dataBlockProperty.Key; - string dataName = GetFriendlyName(dataBlockKey); + string dataName = dataBlockKey.GetPropertyName(); PropertyUnit dataBlockUnit = dataBlockKey.PropertyUnit; string dataUnit = dataBlockUnit == PropertyUnit.None ? string.Empty : dataBlockUnit.ToString(); Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); @@ -176,17 +174,6 @@ private static string GetFriendlyName(Enum value) : friendlyName; } - private static string GetFriendlyName(IPropertyKey value) - { - string friendlyName = value.GetPropertyName(); - - return string.IsNullOrEmpty(friendlyName) - ? value.PropertyId.ToString() - : friendlyName; - } - - - // nested classes private class MacBookPro2018 { public static readonly byte[] IntegratedLaptopPanelEdidTable = diff --git a/src/test/iEEDID.ConsoleAppCore/Program.cs b/src/test/iEEDID.ConsoleAppCore/Program.cs index e9dd7d4..70776c8 100644 --- a/src/test/iEEDID.ConsoleAppCore/Program.cs +++ b/src/test/iEEDID.ConsoleAppCore/Program.cs @@ -29,9 +29,9 @@ static void Main(string[] args) Console.WriteLine(); Console.WriteLine($@" > {block.Key} Block"); + var implSections = eedid.Blocks[block.Key].Sections.ImplementedSections; Console.WriteLine(); Console.WriteLine(@" > Implemented Sections"); - ReadOnlyCollection implSections = eedid.Blocks[block.Key].Sections.ImplementedSections; foreach (Enum section in implSections) { Console.WriteLine($@" > {GetFriendlyName(section)}"); @@ -48,13 +48,11 @@ static void Main(string[] args) IEnumerable properties = section.ImplementedProperties; foreach (IPropertyKey property in properties) { - string friendlyName = GetFriendlyName(property); - QueryPropertyResult queryResult = section.GetProperty(property); PropertyItem propertyItem = queryResult.Value; object value = propertyItem.Value; - PropertyUnit valueUnit = property.PropertyUnit; + string friendlyName = property.GetPropertyName(); string unit = valueUnit == PropertyUnit.None ? string.Empty : valueUnit.ToString(); if (value == null) @@ -138,7 +136,7 @@ static void Main(string[] args) object dataValue = dataBlockProperty.Value; IPropertyKey dataBlockKey = (PropertyKey)dataBlockProperty.Key; - string dataName = GetFriendlyName(dataBlockKey); + string dataName = dataBlockKey.GetPropertyName(); PropertyUnit dataBlockUnit = dataBlockKey.PropertyUnit; string dataUnit = dataBlockUnit == PropertyUnit.None ? string.Empty : dataBlockUnit.ToString(); Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); @@ -176,17 +174,6 @@ private static string GetFriendlyName(Enum value) : friendlyName; } - private static string GetFriendlyName(IPropertyKey value) - { - string friendlyName = value.GetPropertyName(); - - return string.IsNullOrEmpty(friendlyName) - ? value.PropertyId.ToString() - : friendlyName; - } - - - // nested classes private class MacBookPro2018 { public static readonly byte[] IntegratedLaptopPanelEdidTable =