Added device update modes and implemented syncback for corsair and asus

This commit is contained in:
DarthAffe committed 2017-12-06 15:41:23 +01:00
1 parent 5e59948d83
commit b700c84b8d
25 files changed
+130 -31

No files matched your search

@@ -127,11 +127,8 @@ namespace RGB.NET.Devices.Corsair
}
}
/// <summary>
/// Reads the current color-data from the device
/// </summary>
/// <returns>A dictionary mapping the <see cref="CorsairLedIds"/> to the current <see cref="Color"/>.</returns>
protected Dictionary<CorsairLedIds, Color> GetColors()
/// <inheritdoc cref="IRGBDevice.SyncBack" />
public override void SyncBack()
{
int structSize = Marshal.SizeOf(typeof(_CorsairLedColor));
IntPtr ptr = Marshal.AllocHGlobal(structSize * LedMapping.Count);
@@ -145,18 +142,15 @@ namespace RGB.NET.Devices.Corsair
_CUESDK.CorsairGetLedsColors(LedMapping.Count, ptr);
IntPtr readPtr = ptr;
Dictionary<CorsairLedIds, Color> colorData = new Dictionary<CorsairLedIds, Color>();
for (int i = 0; i < LedMapping.Count; i++)
{
_CorsairLedColor ledColor = (_CorsairLedColor)Marshal.PtrToStructure(readPtr, typeof(_CorsairLedColor));
colorData.Add((CorsairLedIds)ledColor.ledId, new Color(ledColor.r, ledColor.g, ledColor.b));
LedMapping[new CorsairLedId(this, (CorsairLedIds)ledColor.ledId)].Color = new Color(ledColor.r, ledColor.g, ledColor.b);
readPtr = new IntPtr(readPtr.ToInt64() + structSize);
}
Marshal.FreeHGlobal(ptr);
return colorData;
}
#endregion
@@ -35,6 +35,9 @@ namespace RGB.NET.Devices.Corsair
/// <inheritdoc />
public Uri Image { get; protected set; }
/// <inheritdoc />
public bool SupportsSyncBack => true;
/// <inheritdoc />
public RGBDeviceLighting Lighting => RGBDeviceLighting.Key;
@@ -34,10 +34,7 @@ namespace RGB.NET.Devices.Corsair
/// <inheritdoc />
protected override void InitializeLayout()
{
_CorsairLedPositions nativeLedPositions =
(_CorsairLedPositions)
Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex),
typeof(_CorsairLedPositions));
_CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions));
int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition));
IntPtr ptr = nativeLedPositions.pLedPosition;
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=headsetstand/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=libs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mousepad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=native/@EntryIndexedValue">False</s:Boolean>