mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
Added corsair headset stand
This commit is contained in:
parent
1865b4d83e
commit
5e59948d83
@ -57,5 +57,10 @@ namespace RGB.NET.Core
|
||||
/// Represents a DRAM-bank
|
||||
/// </summary>
|
||||
DRAM = 1 << 8,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a headset stand
|
||||
/// </summary>
|
||||
HeadsetStand = 1 << 9,
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,6 +147,10 @@ namespace RGB.NET.Devices.Corsair
|
||||
case CorsairDeviceType.Mousepad:
|
||||
device = new CorsairMousepadRGBDevice(new CorsairMousepadRGBDeviceInfo(i, nativeDeviceInfo));
|
||||
break;
|
||||
|
||||
case CorsairDeviceType.HeadsetStand:
|
||||
device = new CorsairHeadsetStandRGBDevice(new CorsairHeadsetStandRGBDeviceInfo(i, nativeDeviceInfo));
|
||||
break;
|
||||
|
||||
// ReSharper disable once RedundantCaseLabel
|
||||
case CorsairDeviceType.Unknown:
|
||||
|
||||
@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Corsair
|
||||
Mouse = 1,
|
||||
Keyboard = 2,
|
||||
Headset = 3,
|
||||
Mousepad = 4
|
||||
Mousepad = 4,
|
||||
HeadsetStand = 5
|
||||
};
|
||||
}
|
||||
|
||||
@ -205,5 +205,15 @@ namespace RGB.NET.Devices.Corsair
|
||||
Lightbar17 = 186,
|
||||
Lightbar18 = 187,
|
||||
Lightbar19 = 188,
|
||||
|
||||
HeadsetStandZone1 = 191,
|
||||
HeadsetStandZone2 = 192,
|
||||
HeadsetStandZone3 = 193,
|
||||
HeadsetStandZone4 = 194,
|
||||
HeadsetStandZone5 = 195,
|
||||
HeadsetStandZone6 = 196,
|
||||
HeadsetStandZone7 = 197,
|
||||
HeadsetStandZone8 = 198,
|
||||
HeadsetStandZone9 = 199,
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a corsair headset stand.
|
||||
/// </summary>
|
||||
public class CorsairHeadsetStandRGBDevice : CorsairRGBDevice<CorsairHeadsetStandRGBDeviceInfo>
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetStandRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the headset stand</param>
|
||||
internal CorsairHeadsetStandRGBDevice(CorsairHeadsetStandRGBDeviceInfo info)
|
||||
: base(info)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeLayout()
|
||||
{
|
||||
_CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions));
|
||||
|
||||
int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition));
|
||||
IntPtr ptr = nativeLedPositions.pLedPosition;
|
||||
|
||||
List<_CorsairLedPosition> positions = new List<_CorsairLedPosition>();
|
||||
for (int i = 0; i < nativeLedPositions.numberOfLed; i++)
|
||||
{
|
||||
_CorsairLedPosition ledPosition = (_CorsairLedPosition)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition));
|
||||
ptr = new IntPtr(ptr.ToInt64() + structSize);
|
||||
positions.Add(ledPosition);
|
||||
}
|
||||
|
||||
foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.ledId))
|
||||
InitializeLed(new CorsairLedId(this, ledPosition.ledId),
|
||||
new Rectangle(ledPosition.left, ledPosition.top, ledPosition.width, ledPosition.height));
|
||||
|
||||
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\HeadsetStands\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
|
||||
null, PathHelper.GetAbsolutePath(@"Images\Corsair\HeadsetStands"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetStandRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairHeadsetStandRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetStandRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetStandRGBDevice" />.</param>
|
||||
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||
internal CorsairHeadsetStandRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
||||
: base(deviceIndex, RGBDeviceType.HeadsetStand, nativeInfo)
|
||||
{
|
||||
Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Corsair\HeadsetStands\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -60,6 +60,8 @@
|
||||
<Compile Include="Generic\CorsairRGBDeviceInfo.cs" />
|
||||
<Compile Include="Generic\CorsairRGBDevice.cs" />
|
||||
<Compile Include="Generic\ICorsairRGBDevice.cs" />
|
||||
<Compile Include="HeadsetStand\CorsairHeadsetStandRGBDevice.cs" />
|
||||
<Compile Include="HeadsetStand\CorsairHeadsetStandRGBDeviceInfo.cs" />
|
||||
<Compile Include="Headset\CorsairHeadsetRGBDevice.cs" />
|
||||
<Compile Include="Headset\CorsairHeadsetRGBDeviceInfo.cs" />
|
||||
<Compile Include="Keyboard\CorsairKeyboardRGBDevice.cs" />
|
||||
@ -89,9 +91,11 @@
|
||||
<None Include="libs\x86\CUESDK.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Images\Corsair\HeadsetStands\" />
|
||||
<Folder Include="Images\Corsair\Headsets\" />
|
||||
<Folder Include="Images\Corsair\Mice\" />
|
||||
<Folder Include="Images\Corsair\Mousepads\" />
|
||||
<Folder Include="Layouts\Corsair\HeadsetStands\" />
|
||||
<Folder Include="Layouts\Corsair\Headsets\" />
|
||||
<Folder Include="Layouts\Corsair\Mice\" />
|
||||
<Folder Include="Layouts\Corsair\Mousepads\" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user