using System; using System.Collections.Generic; using System.Runtime.InteropServices; using RGB.NET.Core; using RGB.NET.Devices.Razer.Native; namespace RGB.NET.Devices.Razer { public class RazerKeyboardUpdateQueue : RazerUpdateQueue { #region Constructors public RazerKeyboardUpdateQueue(IUpdateTrigger updateTrigger, Guid deviceId) : base(updateTrigger, deviceId) { } #endregion #region Methods /// protected override IntPtr CreateEffectParams(Dictionary dataSet) { _Color[] colors = new _Color[_Defines.KEYBOARD_MAX_LEDS]; foreach (KeyValuePair data in dataSet) colors[(int)data.Key] = new _Color(data.Value); _KeyboardCustomEffect effectParams = new _KeyboardCustomEffect { Color = colors }; IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(effectParams)); Marshal.StructureToPtr(effectParams, ptr, false); return ptr; } #endregion } }