Skip to content

Commit

Permalink
Fix #11 - Split Usages (#13)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thargy authored Feb 25, 2024
1 parent c4f4e7f commit 1ce1f4a
Show file tree
Hide file tree
Showing 105 changed files with 20,613 additions and 509 deletions.
52 changes: 26 additions & 26 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Avoid shallow clone so NBGV can do its work.
submodules: 'recursive'
- name: Set version
uses: dotnet/nbgv@v0.4.0
with:
setAllVars: true
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
include-prerelease: true
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Publish
uses: alirezanet/publish-nuget@v3.0.0
with:
PROJECT_FILE_PATH: HIDDevices/HIDDevices.csproj
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
INCLUDE_SYMBOLS: true
VERSION_STATIC: ${{env.NBGV_Version}}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Avoid shallow clone so NBGV can do its work.
submodules: 'recursive'
- name: Set version
uses: dotnet/nbgv@v0.4.0
with:
setAllVars: true
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
include-prerelease: true
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Publish
uses: alirezanet/publish-nuget@v3.0.0
with:
PROJECT_FILE_PATH: HIDDevices/HIDDevices.csproj
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
INCLUDE_SYMBOLS: true
VERSION_STATIC: ${{env.NBGV_Version}}
38 changes: 19 additions & 19 deletions .github/workflows/validatepullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Avoid shallow clone so NBGV can do its work.
submodules: 'recursive'
- name: Set version
uses: dotnet/nbgv@v0.4.0
with:
setAllVars: true
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
include-prerelease: true
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Avoid shallow clone so NBGV can do its work.
submodules: 'recursive'
- name: Set version
uses: dotnet/nbgv@v0.4.0
with:
setAllVars: true
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
include-prerelease: true
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
22 changes: 14 additions & 8 deletions HIDDevices.Generator/HIDDevices.Generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,27 @@
<Nullable>enable</Nullable>
<IsRoslynComponent>true</IsRoslynComponent>
<Configurations>Debug;Release;GenerateFromCache;GenerateFromSource</Configurations>
<!-- TODO eventually need to enable the following, however it bans all file IO so major rethink needed
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
For now we will supress warning:
-->
<NoWarn>RS1036</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="iTextSharp" Version="5.5.13.3" GeneratePathProperty="true" PrivateAssets="all" >
<PackageReference Include="iTextSharp" Version="5.5.13.3" GeneratePathProperty="true" PrivateAssets="all">
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="BouncyCastle" Version="1.8.9" GeneratePathProperty="true" PrivateAssets="all" >
<PackageReference Include="BouncyCastle" Version="1.8.9" GeneratePathProperty="true" PrivateAssets="all">
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" GeneratePathProperty="true" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" GeneratePathProperty="true" PrivateAssets="all" />
</ItemGroup>


Expand All @@ -30,9 +36,9 @@

<Target Name="GetDependencyTargetPaths">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker Include="$(PKGNewtonsoft_Json)\lib\netstandard2.0\Newtonsoft.Json.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PKGiTextSharp)\lib\iTextSharp.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PKGBouncyCastle)\lib\BouncyCastle.Crypto.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PKGNewtonsoft_Json)\lib\netstandard2.0\Newtonsoft.Json.dll" IncludeRuntimeDependency="false"/>
<TargetPathWithTargetPlatformMoniker Include="$(PKGiTextSharp)\lib\iTextSharp.dll" IncludeRuntimeDependency="false"/>
<TargetPathWithTargetPlatformMoniker Include="$(PKGBouncyCastle)\lib\BouncyCastle.Crypto.dll" IncludeRuntimeDependency="false"/>
</ItemGroup>
</Target>
</Project>
9 changes: 5 additions & 4 deletions HIDDevices.Sample/HIDDevices.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<AssemblyName>HIDCSample</AssemblyName>
<RootNamespace>HIDDevices.Sample</RootNamespace>
<Configurations>Debug;Release;GenerateFromCache;GenerateFromSource</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\HIDDevices\HIDDevices.csproj" />
<ProjectReference Include="..\HIDDevices.Usages\HIDDevices.Usages.csproj" />
<ProjectReference Include="..\HIDDevices\HIDDevices.csproj"/>
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion HIDDevices.Sample/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

179 changes: 92 additions & 87 deletions HIDDevices.Sample/Resources.resx
Original file line number Diff line number Diff line change
@@ -1,103 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 1.3
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
xmlns="">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1"/>
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data name="SampleExecutor" xml:space="preserve">
<value>{0} - Sample executor</value>
</data>
Expand Down
Loading

0 comments on commit 1ce1f4a

Please sign in to comment.