diff --git a/src/HidLibrary/HidDevices.cs b/src/HidLibrary/HidDevices.cs index ff7ca89..61ad508 100644 --- a/src/HidLibrary/HidDevices.cs +++ b/src/HidLibrary/HidDevices.cs @@ -36,6 +36,20 @@ public static IEnumerable Enumerate(int vendorId, params int[] produc productIds.Contains(x.Attributes.ProductId)); } + public static IEnumerable Enumerate(unit.Tuple_VidPid[] vidpids) + { + var Devices = EnumerateDevices().Select(x => new HidDevice(x.Path, x.Description)); + List temp = new List(); + foreach (var d in Devices) + { + if (vidpids.Where(x => x.VendorId == d.Attributes.VendorId && x.ProductId == d.Attributes.ProductId).Any()) + { + temp.Add(d); + } + } + return temp; + } + public static IEnumerable Enumerate(int vendorId, int productId, ushort UsagePage) { return EnumerateDevices().Select(x => new HidDevice(x.Path, x.Description)).Where(x => x.Attributes.VendorId == vendorId && diff --git a/src/HidLibrary/HidLibrary.csproj b/src/HidLibrary/HidLibrary.csproj index bdbbe84..5e3d9e2 100644 --- a/src/HidLibrary/HidLibrary.csproj +++ b/src/HidLibrary/HidLibrary.csproj @@ -46,7 +46,7 @@ false - + diff --git a/src/HidLibrary/unit/Tuple_VidPid.cs b/src/HidLibrary/unit/Tuple_VidPid.cs new file mode 100644 index 0000000..9082b87 --- /dev/null +++ b/src/HidLibrary/unit/Tuple_VidPid.cs @@ -0,0 +1,8 @@ +namespace HidLibrary.unit +{ + public class Tuple_VidPid + { + public int VendorId { get; set; } + public int ProductId { get; set; } + } +}