// ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedMember.Global using RGB.NET.Core; using RGB.NET.Devices.Razer.Native; namespace RGB.NET.Devices.Razer; /// /// /// Represents a razer keyboard. /// public sealed class RazerKeyboardRGBDevice : RazerRGBDevice, IKeyboard { #region Properties & Fields IKeyboardDeviceInfo IKeyboard.DeviceInfo => (IKeyboardDeviceInfo)DeviceInfo; private readonly LedMapping _ledMapping; #endregion #region Constructors /// /// /// Initializes a new instance of the class. /// /// The specific information provided by CUE for the keyboard. /// The update trigger used to update this device. /// A mapping of leds this device is initialized with. internal RazerKeyboardRGBDevice(RazerKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger, LedMapping ledMapping) : base(info, new RazerKeyboardUpdateQueue(updateTrigger)) { this._ledMapping = ledMapping; InitializeLayout(); } #endregion #region Methods private void InitializeLayout() { for (int row = 0; row < _Defines.KEYBOARD_MAX_ROW; row++) for (int column = 0; column < _Defines.KEYBOARD_MAX_COLUMN; column++) if (_ledMapping.TryGetValue((row * _Defines.KEYBOARD_MAX_COLUMN) + column, out LedId id)) AddLed(id, new Point(column * 19, row * 19), new Size(19, 19)); } /// protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId]; #endregion }