Skip to content

Commit 1ce1f4a

Browse files
authored
Fix #11 - Split Usages (#13)
BREAKING CHANGES! * refactor: Moved Usages into own project * Updated Major Version as breaking change * Code cleanup * Updated NuGets * Updated Samples & Tests to .Net 8.0. * HIDDevices no longer uses the encoded `Usage`s and associated types. * `Control` no longer has `Name`, `FullName`, or `ButtonNumber` properties; equivalent static methods are added to the `Usage` type. * Samples updated to use new `Usage` helpers. * `UsagePage`s now use 4-digit hex correctly (instead of 2-digit). * Updated readmes.
1 parent c4f4e7f commit 1ce1f4a

File tree

105 files changed

+20613
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+20613
-509
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ jobs:
1515
runs-on: windows-latest
1616

1717
steps:
18-
- uses: actions/checkout@v2
19-
with:
20-
fetch-depth: 0 # Avoid shallow clone so NBGV can do its work.
21-
submodules: 'recursive'
22-
- name: Set version
23-
uses: dotnet/[email protected]
24-
with:
25-
setAllVars: true
26-
- name: Setup .NET
27-
uses: actions/setup-dotnet@v1
28-
with:
29-
dotnet-version: '6.0.x'
30-
include-prerelease: true
31-
- name: Install dependencies
32-
run: dotnet restore
33-
- name: Build
34-
run: dotnet build --configuration Release --no-restore -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
35-
- name: Test
36-
run: dotnet test --configuration Release --no-build --verbosity normal -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
37-
- name: Publish
38-
uses: alirezanet/[email protected]
39-
with:
40-
PROJECT_FILE_PATH: HIDDevices/HIDDevices.csproj
41-
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
42-
INCLUDE_SYMBOLS: true
43-
VERSION_STATIC: ${{env.NBGV_Version}}
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0 # Avoid shallow clone so NBGV can do its work.
21+
submodules: 'recursive'
22+
- name: Set version
23+
uses: dotnet/[email protected]
24+
with:
25+
setAllVars: true
26+
- name: Setup .NET
27+
uses: actions/setup-dotnet@v1
28+
with:
29+
dotnet-version: '8.0.x'
30+
include-prerelease: true
31+
- name: Install dependencies
32+
run: dotnet restore
33+
- name: Build
34+
run: dotnet build --configuration Release --no-restore -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
35+
- name: Test
36+
run: dotnet test --configuration Release --no-build --verbosity normal -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
37+
- name: Publish
38+
uses: alirezanet/[email protected]
39+
with:
40+
PROJECT_FILE_PATH: HIDDevices/HIDDevices.csproj
41+
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
42+
INCLUDE_SYMBOLS: true
43+
VERSION_STATIC: ${{env.NBGV_Version}}

.github/workflows/validatepullrequest.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ jobs:
1515
runs-on: windows-latest
1616

1717
steps:
18-
- uses: actions/checkout@v2
19-
with:
20-
fetch-depth: 0 # Avoid shallow clone so NBGV can do its work.
21-
submodules: 'recursive'
22-
- name: Set version
23-
uses: dotnet/[email protected]
24-
with:
25-
setAllVars: true
26-
- name: Setup .NET
27-
uses: actions/setup-dotnet@v1
28-
with:
29-
dotnet-version: '6.0.x'
30-
include-prerelease: true
31-
- name: Install dependencies
32-
run: dotnet restore
33-
- name: Build
34-
run: dotnet build --configuration Release --no-restore -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
35-
- name: Test
36-
run: dotnet test --configuration Release --no-build --verbosity normal -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0 # Avoid shallow clone so NBGV can do its work.
21+
submodules: 'recursive'
22+
- name: Set version
23+
uses: dotnet/[email protected]
24+
with:
25+
setAllVars: true
26+
- name: Setup .NET
27+
uses: actions/setup-dotnet@v1
28+
with:
29+
dotnet-version: '8.0.x'
30+
include-prerelease: true
31+
- name: Install dependencies
32+
run: dotnet restore
33+
- name: Build
34+
run: dotnet build --configuration Release --no-restore -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
35+
- name: Test
36+
run: dotnet test --configuration Release --no-build --verbosity normal -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true

HIDDevices.Generator/HIDDevices.Generator.csproj

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,27 @@
66
<Nullable>enable</Nullable>
77
<IsRoslynComponent>true</IsRoslynComponent>
88
<Configurations>Debug;Release;GenerateFromCache;GenerateFromSource</Configurations>
9+
<!-- TODO eventually need to enable the following, however it bans all file IO so major rethink needed
10+
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
11+
12+
For now we will supress warning:
13+
-->
14+
<NoWarn>RS1036</NoWarn>
915
</PropertyGroup>
1016

1117
<ItemGroup>
12-
<PackageReference Include="iTextSharp" Version="5.5.13.3" GeneratePathProperty="true" PrivateAssets="all" >
18+
<PackageReference Include="iTextSharp" Version="5.5.13.3" GeneratePathProperty="true" PrivateAssets="all">
1319
<NoWarn>NU1701</NoWarn>
1420
</PackageReference>
15-
<PackageReference Include="BouncyCastle" Version="1.8.9" GeneratePathProperty="true" PrivateAssets="all" >
21+
<PackageReference Include="BouncyCastle" Version="1.8.9" GeneratePathProperty="true" PrivateAssets="all">
1622
<NoWarn>NU1701</NoWarn>
1723
</PackageReference>
18-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0" PrivateAssets="all" />
19-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
24+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" PrivateAssets="all" />
25+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
2026
<PrivateAssets>all</PrivateAssets>
2127
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2228
</PackageReference>
23-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" GeneratePathProperty="true" PrivateAssets="all" />
29+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" GeneratePathProperty="true" PrivateAssets="all" />
2430
</ItemGroup>
2531

2632

@@ -30,9 +36,9 @@
3036

3137
<Target Name="GetDependencyTargetPaths">
3238
<ItemGroup>
33-
<TargetPathWithTargetPlatformMoniker Include="$(PKGNewtonsoft_Json)\lib\netstandard2.0\Newtonsoft.Json.dll" IncludeRuntimeDependency="false" />
34-
<TargetPathWithTargetPlatformMoniker Include="$(PKGiTextSharp)\lib\iTextSharp.dll" IncludeRuntimeDependency="false" />
35-
<TargetPathWithTargetPlatformMoniker Include="$(PKGBouncyCastle)\lib\BouncyCastle.Crypto.dll" IncludeRuntimeDependency="false" />
39+
<TargetPathWithTargetPlatformMoniker Include="$(PKGNewtonsoft_Json)\lib\netstandard2.0\Newtonsoft.Json.dll" IncludeRuntimeDependency="false"/>
40+
<TargetPathWithTargetPlatformMoniker Include="$(PKGiTextSharp)\lib\iTextSharp.dll" IncludeRuntimeDependency="false"/>
41+
<TargetPathWithTargetPlatformMoniker Include="$(PKGBouncyCastle)\lib\BouncyCastle.Crypto.dll" IncludeRuntimeDependency="false"/>
3642
</ItemGroup>
3743
</Target>
3844
</Project>

HIDDevices.Sample/HIDDevices.Sample.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<AssemblyName>HIDCSample</AssemblyName>
88
<RootNamespace>HIDDevices.Sample</RootNamespace>
99
<Configurations>Debug;Release;GenerateFromCache;GenerateFromSource</Configurations>
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
14-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
13+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
14+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<ProjectReference Include="..\HIDDevices\HIDDevices.csproj" />
18+
<ProjectReference Include="..\HIDDevices.Usages\HIDDevices.Usages.csproj" />
19+
<ProjectReference Include="..\HIDDevices\HIDDevices.csproj"/>
1920
</ItemGroup>
2021

2122
<ItemGroup>

HIDDevices.Sample/Resources.Designer.cs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HIDDevices.Sample/Resources.resx

Lines changed: 92 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,108 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<root>
3-
<!--
4-
Microsoft ResX Schema
3+
<!--
4+
Microsoft ResX Schema
55
6-
Version 1.3
6+
Version 1.3
77
8-
The primary goals of this format is to allow a simple XML format
9-
that is mostly human readable. The generation and parsing of the
10-
various data types are done through the TypeConverter classes
11-
associated with the data types.
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
1212
13-
Example:
13+
Example:
1414
15-
... ado.net/XML headers & schema ...
16-
<resheader name="resmimetype">text/microsoft-resx</resheader>
17-
<resheader name="version">1.3</resheader>
18-
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19-
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20-
<data name="Name1">this is my long string</data>
21-
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22-
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23-
[base64 mime encoded serialized .NET Framework object]
24-
</data>
25-
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26-
[base64 mime encoded string representing a byte array form of the .NET Framework object]
27-
</data>
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">1.3</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1">this is my long string</data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
[base64 mime encoded serialized .NET Framework object]
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
[base64 mime encoded string representing a byte array form of the .NET Framework object]
27+
</data>
2828
29-
There are any number of "resheader" rows that contain simple
30-
name/value pairs.
29+
There are any number of "resheader" rows that contain simple
30+
name/value pairs.
3131
32-
Each data row contains a name, and value. The row also contains a
33-
type or mimetype. Type corresponds to a .NET class that support
34-
text/value conversion through the TypeConverter architecture.
35-
Classes that don't support this are serialized and stored with the
36-
mimetype set.
32+
Each data row contains a name, and value. The row also contains a
33+
type or mimetype. Type corresponds to a .NET class that support
34+
text/value conversion through the TypeConverter architecture.
35+
Classes that don't support this are serialized and stored with the
36+
mimetype set.
3737
38-
The mimetype is used for serialized objects, and tells the
39-
ResXResourceReader how to depersist the object. This is currently not
40-
extensible. For a given mimetype the value must be set accordingly:
38+
The mimetype is used for serialized objects, and tells the
39+
ResXResourceReader how to depersist the object. This is currently not
40+
extensible. For a given mimetype the value must be set accordingly:
4141
42-
Note - application/x-microsoft.net.object.binary.base64 is the format
43-
that the ResXResourceWriter will generate, however the reader can
44-
read any of the formats listed below.
42+
Note - application/x-microsoft.net.object.binary.base64 is the format
43+
that the ResXResourceWriter will generate, however the reader can
44+
read any of the formats listed below.
4545
46-
mimetype: application/x-microsoft.net.object.binary.base64
47-
value : The object must be serialized with
48-
: System.Serialization.Formatters.Binary.BinaryFormatter
49-
: and then encoded with base64 encoding.
46+
mimetype: application/x-microsoft.net.object.binary.base64
47+
value : The object must be serialized with
48+
: System.Serialization.Formatters.Binary.BinaryFormatter
49+
: and then encoded with base64 encoding.
5050
51-
mimetype: application/x-microsoft.net.object.soap.base64
52-
value : The object must be serialized with
53-
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
54-
: and then encoded with base64 encoding.
51+
mimetype: application/x-microsoft.net.object.soap.base64
52+
value : The object must be serialized with
53+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
54+
: and then encoded with base64 encoding.
5555
56-
mimetype: application/x-microsoft.net.object.bytearray.base64
57-
value : The object must be serialized into a byte array
58-
: using a System.ComponentModel.TypeConverter
59-
: and then encoded with base64 encoding.
60-
-->
61-
62-
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63-
<xsd:element name="root" msdata:IsDataSet="true">
64-
<xsd:complexType>
65-
<xsd:choice maxOccurs="unbounded">
66-
<xsd:element name="data">
67-
<xsd:complexType>
68-
<xsd:sequence>
69-
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
70-
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
71-
</xsd:sequence>
72-
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
73-
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
74-
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
75-
</xsd:complexType>
76-
</xsd:element>
77-
<xsd:element name="resheader">
78-
<xsd:complexType>
79-
<xsd:sequence>
80-
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
81-
</xsd:sequence>
82-
<xsd:attribute name="name" type="xsd:string" use="required" />
83-
</xsd:complexType>
84-
</xsd:element>
85-
</xsd:choice>
86-
</xsd:complexType>
87-
</xsd:element>
88-
</xsd:schema>
89-
<resheader name="resmimetype">
90-
<value>text/microsoft-resx</value>
91-
</resheader>
92-
<resheader name="version">
93-
<value>1.3</value>
94-
</resheader>
95-
<resheader name="reader">
96-
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
97-
</resheader>
98-
<resheader name="writer">
99-
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
100-
</resheader>
56+
mimetype: application/x-microsoft.net.object.bytearray.base64
57+
value : The object must be serialized into a byte array
58+
: using a System.ComponentModel.TypeConverter
59+
: and then encoded with base64 encoding.
60+
-->
61+
62+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
63+
xmlns="">
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="data">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
71+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
72+
</xsd:sequence>
73+
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1"/>
74+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
75+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="resheader">
79+
<xsd:complexType>
80+
<xsd:sequence>
81+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
82+
</xsd:sequence>
83+
<xsd:attribute name="name" type="xsd:string" use="required"/>
84+
</xsd:complexType>
85+
</xsd:element>
86+
</xsd:choice>
87+
</xsd:complexType>
88+
</xsd:element>
89+
</xsd:schema>
90+
<resheader name="resmimetype">
91+
<value>text/microsoft-resx</value>
92+
</resheader>
93+
<resheader name="version">
94+
<value>1.3</value>
95+
</resheader>
96+
<resheader name="reader">
97+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral,
98+
PublicKeyToken=b77a5c561934e089
99+
</value>
100+
</resheader>
101+
<resheader name="writer">
102+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral,
103+
PublicKeyToken=b77a5c561934e089
104+
</value>
105+
</resheader>
101106
<data name="SampleExecutor" xml:space="preserve">
102107
<value>{0} - Sample executor</value>
103108
</data>

0 commit comments

Comments
 (0)