comparison USBLib/Communication/WindowsUsbDeviceRegistry.cs @ 52:d4778c3232ad

Prevent exception in HWLib
author Ivo Smits <Ivo@UCIS.nl>
date Tue, 01 Oct 2013 00:24:39 +0200
parents 556b4fb511bd
children df5534af12e9
comparison
equal deleted inserted replaced
51:e3f37686b15a 52:d4778c3232ad
8 namespace UCIS.USBLib.Communication { 8 namespace UCIS.USBLib.Communication {
9 public abstract class WindowsUsbDeviceRegistry { 9 public abstract class WindowsUsbDeviceRegistry {
10 public DeviceNode DeviceNode { get; private set; } 10 public DeviceNode DeviceNode { get; private set; }
11 11
12 public static Boolean DecodeDeviceIDs(DeviceNode device, out int vendorID, out int productID, out int revision, out int interfaceID) { 12 public static Boolean DecodeDeviceIDs(DeviceNode device, out int vendorID, out int productID, out int revision, out int interfaceID) {
13 String[] hwids = device.GetPropertyStringArray(CMRDP.HARDWAREID); 13 String[] hwids = device.HardwareID;
14 String hwid = null; 14 String hwid = null;
15 if (hwids == null || hwids.Length < 1 || hwids[0].Length == 0) { 15 if (hwids == null || hwids.Length < 1 || hwids[0].Length == 0) {
16 hwid = device.DeviceID; 16 hwid = device.DeviceID;
17 } else { 17 } else {
18 hwid = hwids[0]; 18 hwid = hwids[0];