public static string GetDeviceDescription(string device) { RegistryKey deviceKey = RegistryAccess.GetDeviceKey(device); if (deviceKey != null) { string text = deviceKey.GetValue("DeviceDesc").ToString(); if (text != null) { int num = text.IndexOf(';'); if (num >= 0 && num < text.Length - 1) { return(text.Substring(num + 1)); } return(string.Empty); } } return(string.Empty); }
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); }