public void Push(ControlDevice controlDevice)
        {
            SteelSeriesControlDevice cs = (SteelSeriesControlDevice)controlDevice;

            Dictionary <string, int[]> mdata = new Dictionary <string, int[]>();

            foreach (ControlDevice.LedUnit controlDeviceLeD in controlDevice.LEDs)
            {
                mdata.Add(((SteelSeriesLedData)controlDeviceLeD.Data).ZoneName, controlDeviceLeD.Color.ToIntArray());
            }

            GameSenseSdk.UpdateLeds(cs.SSDeviceType.GetAPIName(), mdata);
        }
        public void AddDevice(int PID)
        {
            var supportedDevice = HIDDevices.First(x => x.PID == PID);

            SteelSeriesControlDevice device = new SteelSeriesControlDevice
            {
                LEDs         = new ControlDevice.LedUnit[supportedDevice.NumberOfLeds],
                Driver       = this,
                Name         = supportedDevice.Name,
                DeviceType   = supportedDevice.DeviceClass,
                ProductImage = supportedDevice.Image,
                HID          = PID,
                SSDeviceType = supportedDevice.SteelSeriesDeviceType
            };

            List <KeyValuePair <LedId, SteelSeriesLedId> > mp = supportedDevice.Mapping.ToList();

            for (int i = 0; i < supportedDevice.NumberOfLeds; i++)
            {
                int ln = i;
                int kc = 2;
                SteelSeriesLedId tp = SteelSeriesLedId.ZoneOne;
                if (i < mp.Count)
                {
                    ln = (int)mp[i].Key;
                    kc = (int)mp[i].Value;
                    tp = mp[i].Value;
                }

                device.LEDs[i] =
                    new ControlDevice.LedUnit
                {
                    LEDName = "LED " + i,
                    Data    = new SteelSeriesLedData
                    {
                        LEDNumber = ln,
                        KeyCode   = kc,
                        ZoneName  = tp.GetAPIName()
                    }
                };
            }

            DeviceAdded?.Invoke(this, new Events.DeviceChangeEventArgs(device));

            foundDevices.Add(device);
        }
 public void InterestedUSBChange(int VID, int PID, bool connected)
 {
     Debug.WriteLine(VID + "_" + PID + "_" + connected);
     if (connected)
     {
         AddDevice(PID);
     }
     else
     {
         if (foundDevices.Any(x => x.HID == PID))
         {
             SteelSeriesControlDevice dev = foundDevices.First(x => x.HID == PID);
             DeviceRemoved?.Invoke(this, new Events.DeviceChangeEventArgs(dev));
             foundDevices.Remove(dev);
         }
     }
 }