using System; using System.Collections.Generic; using RGB.NET.Core; using RGB.NET.Devices.Wooting.Generic; using RGB.NET.Devices.Wooting.Native; namespace RGB.NET.Devices.Wooting.Keyboard; /// /// /// Represents a Wooting keyboard. /// public class WootingKeyboardRGBDevice : WootingRGBDevice, IKeyboard { #region Properties & Fields IKeyboardDeviceInfo IKeyboard.DeviceInfo => DeviceInfo; #endregion #region Constructors /// /// /// Initializes a new instance of the class. /// /// The specific information provided by Wooting for the keyboard /// The update trigger used to update this device. internal WootingKeyboardRGBDevice(WootingKeyboardRGBDeviceInfo info, IUpdateQueue updateQueue) : base(info, updateQueue) { InitializeLayout(); } #endregion #region Methods private void InitializeLayout() { Dictionary mapping = WootingKeyboardLedMappings.Mapping[DeviceInfo.WootingDeviceType]; foreach (KeyValuePair led in mapping) AddLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19, 19)); } /// protected override object GetLedCustomData(LedId ledId) => WootingKeyboardLedMappings.Mapping[DeviceInfo.WootingDeviceType][ledId]; /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); public override void Dispose() { _WootingSDK.SelectDevice(DeviceInfo.WootingDeviceIndex); _WootingSDK.Reset(); base.Dispose(); GC.SuppressFinalize(this); } #endregion }