public void ApplyMapMouseLighting(string region, Color col, bool clear) { if (!IsInitialized || !_coolermasterDeviceKeyboard) { return; } foreach (var mouseDevice in _mice) { CoolermasterSdkWrapper.SetControlDevice(mouseDevice); switch (region) { case "All": CoolermasterSdkWrapper.SetLedColor(0, 0, col.R, col.G, col.B, mouseDevice); CoolermasterSdkWrapper.SetLedColor(0, 1, col.R, col.G, col.B, mouseDevice); CoolermasterSdkWrapper.SetLedColor(0, 2, col.R, col.G, col.B, mouseDevice); CoolermasterSdkWrapper.SetLedColor(0, 3, col.R, col.G, col.B, mouseDevice); break; case "MouseFront": CoolermasterSdkWrapper.SetLedColor(0, 0, col.R, col.G, col.B, mouseDevice); break; case "MouseScroll": CoolermasterSdkWrapper.SetLedColor(0, 1, col.R, col.G, col.B, mouseDevice); break; case "MouseSide": CoolermasterSdkWrapper.SetLedColor(0, 2, col.R, col.G, col.B, mouseDevice); CoolermasterSdkWrapper.SetLedColor(0, 3, col.R, col.G, col.B, mouseDevice); break; } } }
public void Shutdown() { foreach (var keyboard in _keyboards) { CoolermasterSdkWrapper.SetControlDevice(keyboard); CoolermasterSdkWrapper.EnableLedControl(false); } }
public bool InitializeSdk() { try { lock (_initLock) { if (IsInitialized) { return(true); } Write.WriteConsole(ConsoleTypes.Coolermaster, @"Attempting to initializer Coolermaster support..."); foreach (var supportedDevice in SupportedKeyboardDevices) { CoolermasterSdkWrapper.SetControlDevice(supportedDevice); if (CoolermasterSdkWrapper.IsDevicePlug(supportedDevice)) { Write.WriteConsole(ConsoleTypes.Coolermaster, $"Found a {supportedDevice} Coolermaster keyboard."); _keyboards.Add(supportedDevice); CoolermasterSdkWrapper.EnableLedControl(true); } } foreach (var supportedDevice in SupportedMouseDevices) { CoolermasterSdkWrapper.SetControlDevice(supportedDevice); if (CoolermasterSdkWrapper.IsDevicePlug(supportedDevice)) { Write.WriteConsole(ConsoleTypes.Coolermaster, $"Found a {supportedDevice} Coolermaster mouse."); _mice.Add(supportedDevice); CoolermasterSdkWrapper.EnableLedControl(true); } } if (_keyboards.Any() || _mice.Any()) { IsInitialized = true; return(true); } else { Write.WriteConsole(ConsoleTypes.Coolermaster, @"Did not find any supported Coolermaster devices."); } } } catch (Exception ex) { Write.WriteConsole(ConsoleTypes.Coolermaster, @"Coolermaster SDK failed to load. Error: " + ex.Message); } return(false); }
private void ApplyKeyboardLighting() { if (!IsInitialized || !_coolermasterDeviceKeyboard) { return; } foreach (var keyboardDevice in _keyboards) { CoolermasterSdkWrapper.SetControlDevice(keyboardDevice); CoolermasterSdkWrapper.SetAllLedColor(_colorMatrix); } _updateTimer.Change(Timeout.Infinite, Timeout.Infinite); }