示例#1
0
        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);
        }
示例#2
0
文件: Win32.cs 项目: herisant/t22-4
        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);
        }