FindRegistryKey() static private method

static private FindRegistryKey ( string name ) : RegistryKey
name string
return RegistryKey
示例#1
0
 public void RefreshDevices()
 {
     lock (this.UpdateLock)
     {
         for (int local_0 = 0; local_0 < this.mice.Count; ++local_0)
         {
             MouseState local_1 = this.mice[local_0];
             local_1.IsConnected = false;
             this.mice[local_0]  = local_1;
         }
         int local_2 = WinRawInput.DeviceCount;
         RawInputDeviceList[] local_3 = new RawInputDeviceList[local_2];
         for (int local_4 = 0; local_4 < local_2; ++local_4)
         {
             local_3[local_4] = new RawInputDeviceList();
         }
         Functions.GetRawInputDeviceList(local_3, out local_2, API.RawInputDeviceListSize);
         foreach (RawInputDeviceList item_0 in local_3)
         {
             ContextHandle local_6 = new ContextHandle(item_0.Device);
             if (this.rawids.ContainsKey(local_6))
             {
                 MouseState local_7 = this.mice[this.rawids[local_6]];
                 local_7.IsConnected             = true;
                 this.mice[this.rawids[local_6]] = local_7;
             }
             else
             {
                 string local_8 = WinRawMouse.GetDeviceName(item_0);
                 if (!local_8.ToLower().Contains("root") && (item_0.Type == RawInputDeviceType.MOUSE || item_0.Type == RawInputDeviceType.HID))
                 {
                     RegistryKey local_9    = WinRawMouse.FindRegistryKey(local_8);
                     string      local_10   = (string)local_9.GetValue("DeviceDesc");
                     string      local_11   = (string)local_9.GetValue("Class");
                     string      local_10_1 = local_10.Substring(local_10.LastIndexOf(';') + 1);
                     if (!string.IsNullOrEmpty(local_11) && local_11.ToLower().Equals("mouse") && !this.rawids.ContainsKey(new ContextHandle(item_0.Device)))
                     {
                         RawInputDeviceInfo local_12 = new RawInputDeviceInfo();
                         int local_13 = API.RawInputDeviceInfoSize;
                         Functions.GetRawInputDeviceInfo(item_0.Device, RawInputDeviceInfoEnum.DEVICEINFO, local_12, out local_13);
                         WinRawMouse.RegisterRawDevice(this.Window, local_10_1);
                         this.mice.Add(new MouseState()
                         {
                             IsConnected = true
                         });
                         this.names.Add(local_10_1);
                         this.rawids.Add(new ContextHandle(item_0.Device), this.mice.Count - 1);
                     }
                 }
             }
         }
     }
 }