mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
64 lines
1.5 KiB
C#
64 lines
1.5 KiB
C#
using System;
|
|
using RGB.NET.Core;
|
|
using RGB.NET.Devices.Wooting.Native;
|
|
|
|
namespace RGB.NET.Devices.Wooting.Generic;
|
|
|
|
/// <inheritdoc />
|
|
/// <summary>
|
|
/// Represents the update-queue performing updates for cooler master devices.
|
|
/// </summary>
|
|
public sealed class WootingUpdateQueue : UpdateQueue
|
|
{
|
|
#region Properties & Fields
|
|
|
|
private readonly byte _deviceid;
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="WootingUpdateQueue"/> class.
|
|
/// </summary>
|
|
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
|
public WootingUpdateQueue(IDeviceUpdateTrigger updateTrigger, byte deviceId)
|
|
: base(updateTrigger)
|
|
{
|
|
this._deviceid = deviceId;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <inheritdoc />
|
|
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
|
|
{
|
|
try
|
|
{
|
|
lock (_WootingSDK.SdkLock)
|
|
{
|
|
_WootingSDK.SelectDevice(_deviceid);
|
|
|
|
foreach ((object key, Color color) in dataSet)
|
|
{
|
|
(int row, int column) = ((int, int))key;
|
|
_WootingSDK.ArraySetSingle((byte)row, (byte)column, color.GetR(), color.GetG(), color.GetB());
|
|
}
|
|
|
|
_WootingSDK.ArrayUpdateKeyboard();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WootingDeviceProvider.Instance.Throw(ex);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
#endregion
|
|
} |