コード例 #1
0
 public void ColorCycle(Color color, CancellationToken token)
 {
     if (_logitechDeviceKeyboard)
     {
         LogitechSdkWrapper.LogiColourCycle(color, new object(), token);
     }
 }
コード例 #2
0
        public void Flash4(Color burstcol, int speed, CancellationToken cts, string[] regions)
        {
            if (!_logitechDeviceKeyboard)
            {
                return;
            }

            if (!_logiFlash4Running)
            {
                foreach (var key in regions)
                {
                    LogitechSdkWrapper.LogiLedSaveLightingForKey(ToKeyboardNames(key));
                }

                _logiFlash4Running = true;
                _logiFlash4Step    = 0;
            }

            if (_logiFlash4Running)
            {
                while (_logiFlash4Running)
                {
                    if (cts.IsCancellationRequested)
                    {
                        break;
                    }

                    if (_logiFlash4Step == 0)
                    {
                        if (_logitechDeviceKeyboard)
                        {
                            foreach (var key in regions)
                            {
                                ApplyMapKeyLighting(key, burstcol, false);
                            }
                        }

                        _logiFlash4Step = 1;

                        Thread.Sleep(speed);
                    }
                    else if (_logiFlash4Step == 1)
                    {
                        if (_logitechDeviceKeyboard)
                        {
                            foreach (var key in regions)
                            {
                                LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                            }
                        }

                        _logiFlash4Step = 0;

                        Thread.Sleep(speed);
                    }
                }
            }
        }
コード例 #3
0
 public void SetLights(Color color)
 {
     if (_logitechDeviceKeyboard)
     {
         LogitechSdkWrapper.LogiLedSetLighting((int)Math.Ceiling((double)(color.R * 100) / 255),
                                               (int)Math.Ceiling((double)(color.G * 100) / 255),
                                               (int)Math.Ceiling((double)(color.B * 100) / 255));
     }
 }
コード例 #4
0
 public void Pulse(Color color, int milliSecondsDuration, int milliSecondsInterval)
 {
     if (_logitechDeviceKeyboard)
     {
         LogitechSdkWrapper.LogiLedPulseLighting((int)Math.Ceiling((double)(color.R * 100) / 255),
                                                 (int)Math.Ceiling((double)(color.G * 100) / 255),
                                                 (int)Math.Ceiling((double)(color.B * 100) / 255),
                                                 LogitechSdkWrapper.LogiLedDurationInfinite,
                                                 60);
     }
 }
コード例 #5
0
        public bool InitializeLights()
        {
            var result = true;

            try
            {
                LogitechSdkWrapper.LogiLedInit();
            }
            catch (Exception)
            {
                result = false;
            }
            return(result);
        }
コード例 #6
0
        public void ApplyMapKeyLighting(string key, Color color, bool clear, [Optional] bool bypasswhitelist)
        {
            if (!_logitechDeviceKeyboard)
            {
                return;
            }

            if (FfxivHotbar.Keybindwhitelist.Contains(key) && !bypasswhitelist)
            {
                return;
            }

            KeyboardNames keyName;

            //StopEffects();

            if (Enum.TryParse(key, out keyName))
            {
                LogitechSdkWrapper.LogiLedSetLightingForKeyWithScanCode((int)keyName,
                                                                        (int)Math.Ceiling((double)(color.R * 100) / 255),
                                                                        (int)Math.Ceiling((double)(color.G * 100) / 255),
                                                                        (int)Math.Ceiling((double)(color.B * 100) / 255));
            }
        }
コード例 #7
0
        public void Flash1(Color burstcol, int speed, string[] regions)
        {
            if (!_logitechDeviceKeyboard)
            {
                return;
            }

            for (var i = 0; i <= 8; i++)
            {
                if (i == 0)
                {
                    foreach (var key in regions)
                    {
                        LogitechSdkWrapper.LogiLedSaveLightingForKey(ToKeyboardNames(key));
                    }
                }
                else if (i == 1)
                {
                    foreach (var key in regions)
                    {
                        ApplyMapKeyLighting(key, burstcol, false);
                    }
                }
                else if (i == 2)
                {
                    foreach (var key in regions)
                    {
                        LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                    }
                }
                else if (i == 3)
                {
                    foreach (var key in regions)
                    {
                        ApplyMapKeyLighting(key, burstcol, false);
                    }
                }
                else if (i == 4)
                {
                    foreach (var key in regions)
                    {
                        LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                    }
                }
                else if (i == 5)
                {
                    foreach (var key in regions)
                    {
                        ApplyMapKeyLighting(key, burstcol, false);
                    }
                }
                else if (i == 6)
                {
                    foreach (var key in regions)
                    {
                        LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                    }
                }
                else if (i == 7)
                {
                    foreach (var key in regions)
                    {
                        ApplyMapKeyLighting(key, burstcol, false);
                    }
                }
                else if (i == 8)
                {
                    foreach (var key in regions)
                    {
                        LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                    }
                }

                if (i < 8)
                {
                    Thread.Sleep(speed);
                }
            }
        }
コード例 #8
0
        public Task Ripple1(Color burstcol, int speed, Color baseColor)
        {
            return(new Task(() =>
            {
                if (!_logitechDeviceKeyboard)
                {
                    return;
                }

                for (var i = 0; i <= 9; i++)
                {
                    if (i == 0)
                    {
                        //Setup

                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            try
                            {
                                KeyboardNames keyName;
                                if (Enum.TryParse(key, out keyName))
                                {
                                    LogitechSdkWrapper.LogiLedSaveLightingForKey(keyName);
                                }
                            }
                            catch (Exception ex)
                            {
                                Write.WriteConsole(ConsoleTypes.Error, "(" + key + "): " + ex.Message);
                            }
                        }
                    }
                    else if (i == 1)
                    {
                        //Step 0
                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            var pos = Array.IndexOf(DeviceEffects.PulseOutStep0, key);
                            if (pos > -1)
                            {
                                ApplyMapKeyLighting(key, burstcol, false);
                            }
                            else
                            {
                                LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                            }
                        }
                    }
                    else if (i == 2)
                    {
                        //Step 1
                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            var pos = Array.IndexOf(DeviceEffects.PulseOutStep1, key);
                            if (pos > -1)
                            {
                                ApplyMapKeyLighting(key, burstcol, false);
                            }
                            else
                            {
                                LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                            }
                        }
                    }
                    else if (i == 3)
                    {
                        //Step 2
                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            var pos = Array.IndexOf(DeviceEffects.PulseOutStep2, key);
                            if (pos > -1)
                            {
                                ApplyMapKeyLighting(key, burstcol, false);
                            }
                            else
                            {
                                LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                            }
                        }
                    }
                    else if (i == 4)
                    {
                        //Step 3
                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            var pos = Array.IndexOf(DeviceEffects.PulseOutStep3, key);
                            if (pos > -1)
                            {
                                ApplyMapKeyLighting(key, burstcol, false);
                            }
                            else
                            {
                                LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                            }
                        }
                    }
                    else if (i == 5)
                    {
                        //Step 4
                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            var pos = Array.IndexOf(DeviceEffects.PulseOutStep4, key);
                            if (pos > -1)
                            {
                                ApplyMapKeyLighting(key, burstcol, false);
                            }
                            else
                            {
                                LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                            }
                        }
                    }
                    else if (i == 6)
                    {
                        //Step 5
                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            var pos = Array.IndexOf(DeviceEffects.PulseOutStep5, key);
                            if (pos > -1)
                            {
                                ApplyMapKeyLighting(key, burstcol, false);
                            }
                            else
                            {
                                LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                            }
                        }
                    }
                    else if (i == 7)
                    {
                        //Step 6
                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            var pos = Array.IndexOf(DeviceEffects.PulseOutStep6, key);
                            if (pos > -1)
                            {
                                ApplyMapKeyLighting(key, burstcol, false);
                            }
                            else
                            {
                                LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                            }
                        }
                    }
                    else if (i == 8)
                    {
                        //Step 7
                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            var pos = Array.IndexOf(DeviceEffects.PulseOutStep7, key);
                            if (pos > -1)
                            {
                                ApplyMapKeyLighting(key, burstcol, false);
                            }
                            else
                            {
                                LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                            }
                        }
                    }
                    else if (i == 9)
                    {
                        //Spin down

                        foreach (var key in DeviceEffects.GlobalKeys)
                        {
                            LogitechSdkWrapper.LogiLedRestoreLightingForKey(ToKeyboardNames(key));
                        }

                        ApplyMapKeyLighting("D1", baseColor, false);
                        ApplyMapKeyLighting("D2", baseColor, false);
                        ApplyMapKeyLighting("D3", baseColor, false);
                        ApplyMapKeyLighting("D4", baseColor, false);
                        ApplyMapKeyLighting("D5", baseColor, false);
                        ApplyMapKeyLighting("D6", baseColor, false);
                        ApplyMapKeyLighting("D7", baseColor, false);
                        ApplyMapKeyLighting("D8", baseColor, false);
                        ApplyMapKeyLighting("D9", baseColor, false);
                        ApplyMapKeyLighting("D0", baseColor, false);
                        ApplyMapKeyLighting("OemMinus", baseColor, false);
                        ApplyMapKeyLighting("OemEquals", baseColor, false);
                    }

                    if (i < 9)
                    {
                        Thread.Sleep(speed);
                    }
                }
            }));
        }
コード例 #9
0
 public void StopEffects()
 {
     LogitechSdkWrapper.LogiLedStopEffects();
     MemoryTasks.Cleanup();
     _cancellationTokenSource?.Cancel();
 }