using System.Collections.Generic; using System.Linq; using RGB.NET.Core; using RGB.NET.Devices.Wooting.Generic; namespace RGB.NET.Devices.Wooting.Keyboard { /// /// /// Represents a Wooting keyboard. /// public class WootingKeyboardRGBDevice : WootingRGBDevice, IKeyboard { #region Constructors /// /// /// Initializes a new instance of the class. /// /// The specific information provided by Wooting for the keyboard internal WootingKeyboardRGBDevice(WootingKeyboardRGBDeviceInfo info) : base(info) { } #endregion #region Methods /// protected override void InitializeLayout() { Dictionary mapping = WootingKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout]; foreach (KeyValuePair led in mapping) { InitializeLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19,19)); } string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\Wooting\Keyboards\{model}", $"{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), DeviceInfo.LogicalLayout.ToString()); } /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0)); /// protected override object CreateLedCustomData(LedId ledId) => WootingKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout][ledId]; #endregion } }