コード例 #1
0
        /// <summary>
        /// Sets the color of the device.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="r">The r.</param>
        /// <param name="g">The g.</param>
        /// <param name="b">The b.</param>
        /// <returns></returns>
        public bool SetDeviceColor(Device device, int r, int g, int b)
        {
            device.SetColor(r, g, b);
            CorsairLedColor[] leds = device.Leds.Select(x => x.CorsairLedColor).ToArray();
            bool setResult         = CorsairLightingSDK.SetLedsColorsBufferByDeviceIndex(device.DeviceIndex, leds);

            if (setResult)
            {
                return(CorsairLightingSDK.SetLedsColorsFlushBuffer());
            }

            return(false);
        }
コード例 #2
0
        /// <summary>
        /// Applies light changes to the device
        /// </summary>
        public void ApplyLights()
        {
            if (NumberOfLights > 0)
            {
                var buffer = new CorsairLedColor[_lights.Count];

                for (var i = 0; i < _lights.Count; i++)
                {
                    buffer[i] = _lights[i]._deviceLight;
                }

                CorsairLightingSDK.SetLedsColorsBufferByDeviceIndex(_deviceIndex, buffer);
                CorsairLightingSDK.SetLedsColorsFlushBuffer();
            }
        }
コード例 #3
0
 /// <summary>
 /// Sets the color of the device.
 /// </summary>
 /// <param name="devices">The devices.</param>
 /// <param name="r">The r.</param>
 /// <param name="g">The g.</param>
 /// <param name="b">The b.</param>
 /// <returns></returns>
 public bool SetDeviceColor(Device[] devices, int r, int g, int b)
 {
     if (devices == null)
     {
         return(false);
     }
     if (devices.Length == 0)
     {
         return(true);
     }
     for (int i = 0; i < devices.Length; i++)
     {
         devices[i].SetColor(r, g, b);
         CorsairLedColor[] leds = devices[i].Leds.Select(x => x.CorsairLedColor).ToArray();
         bool setResult         = CorsairLightingSDK.SetLedsColorsBufferByDeviceIndex(devices[i].DeviceIndex, leds);
         if (!setResult)
         {
             return(false);
         }
     }
     return(CorsairLightingSDK.SetLedsColorsFlushBuffer());
 }