Skip to content

Commit

Permalink
Fixed comparing wrong property when checking for equality (#62)
Browse files Browse the repository at this point in the history
* Fixed comparing wrong property when checking for equality

* Ran code clean-up
  • Loading branch information
nefarius authored Aug 17, 2024
1 parent ce5cc49 commit 8300cad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions Nefarius.Utilities.DeviceManagement.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=BTHENUM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CANCELREMOVE/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cfgmgr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=classguid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CLASSINSTALL/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CONFIGRET/@EntryIndexedValue">True</s:Boolean>
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ Managed wrappers around SetupAPI, Cfgmgr32, NewDev and DrvStore native APIs on W

### Generating documentation

```PowerShell
dotnet build -c:Release
dotnet tool install --global Nefarius.Tools.XMLDoc2Markdown
xmldoc2md .\bin\netstandard2.0\Nefarius.Utilities.DeviceManagement.dll .\docs\
```
- `dotnet build -c:Release`
- `dotnet tool install --global Nefarius.Tools.XMLDoc2Markdown`
- `xmldoc2md .\bin\netstandard2.0\Nefarius.Utilities.DeviceManagement.dll .\docs\`

## Examples

Expand Down
6 changes: 4 additions & 2 deletions src/PnP/PnPDevice.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable enable

using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
Expand Down Expand Up @@ -26,7 +27,7 @@ public partial class PnPDevice : IPnPDevice, IEquatable<PnPDevice>
private readonly uint _instanceHandle;

/// <summary>
/// The <see cref="DeviceLocationFlags"/> used when creating this instance.
/// The <see cref="DeviceLocationFlags" /> used when creating this instance.
/// </summary>
private readonly DeviceLocationFlags _locationFlags;

Expand Down Expand Up @@ -794,7 +795,8 @@ public bool Equals(PnPDevice other)
return true;
}

return string.Equals(DeviceId, other.DeviceId, StringComparison.InvariantCultureIgnoreCase);
// Instance ID distinguishes unique instances of devices, even of the same Hardware ID
return string.Equals(InstanceId, other.InstanceId, StringComparison.InvariantCultureIgnoreCase);
}

/// <inheritdoc />
Expand Down

0 comments on commit 8300cad

Please sign in to comment.