public static string GetDeviceDescription(string device) { var deviceKey = RegistryAccess.GetDeviceKey(device); var deviceDesc = deviceKey.GetValue("DeviceDesc").ToString(); deviceDesc = deviceDesc.Substring(deviceDesc.IndexOf(';') + 1); //var deviceClass = RegistryAccess.GetClassType(deviceKey.GetValue("ClassGUID").ToString()); //isKeyboard = deviceClass.ToUpper().Equals( "KEYBOARD" ); return(deviceDesc); }
public static string GetDeviceDescription(string device) { string deviceDesc; try { var deviceKey = RegistryAccess.GetDeviceKey(device); deviceDesc = deviceKey.GetValue("DeviceDesc").ToString(); deviceDesc = deviceDesc.Substring(deviceDesc.IndexOf(';') + 1); } catch (Exception) { deviceDesc = "Device is malformed unable to look up in the registry"; } //var deviceClass = RegistryAccess.GetClassType(deviceKey.GetValue("ClassGUID").ToString()); //isKeyboard = deviceClass.ToUpper().Equals( "KEYBOARD" ); return(deviceDesc); }