mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-10 20:46:24 +00:00
Added exception-handling to all UpdateQueues
This commit is contained in:
1 parent
6e313ea6a1
commit
37e4954583
18 files changed
+222
-97
No files matched your search
@@ -40,17 +40,24 @@ public class CorsairDeviceUpdateQueue : UpdateQueue
|
||||
/// <inheritdoc />
|
||||
protected override unsafe void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
|
||||
{
|
||||
Span<_CorsairLedColor> colors = new((void*)_colorPtr, dataSet.Length);
|
||||
for (int i = 0; i < colors.Length; i++)
|
||||
try
|
||||
{
|
||||
(object id, Color color) = dataSet[i];
|
||||
(byte a, byte r, byte g, byte b) = color.GetRGBBytes();
|
||||
colors[i] = new _CorsairLedColor((CorsairLedId)id, r, g, b, a);
|
||||
}
|
||||
Span<_CorsairLedColor> colors = new((void*)_colorPtr, dataSet.Length);
|
||||
for (int i = 0; i < colors.Length; i++)
|
||||
{
|
||||
(object id, Color color) = dataSet[i];
|
||||
(byte a, byte r, byte g, byte b) = color.GetRGBBytes();
|
||||
colors[i] = new _CorsairLedColor((CorsairLedId)id, r, g, b, a);
|
||||
}
|
||||
|
||||
CorsairError error = _CUESDK.CorsairSetLedColors(_device.id!, dataSet.Length, _colorPtr);
|
||||
if (error != CorsairError.Success)
|
||||
throw new RGBDeviceException($"Failed to update device '{_device.id}'. (ErrorCode: {error})");
|
||||
CorsairError error = _CUESDK.CorsairSetLedColors(_device.id!, dataSet.Length, _colorPtr);
|
||||
if (error != CorsairError.Success)
|
||||
throw new RGBDeviceException($"Failed to update device '{_device.id}'. (ErrorCode: {error})");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CorsairDeviceProvider.Instance.Throw(ex, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in new issue
Block a user