mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2026-11-11 04:56:44 +00:00
Updated SDK to 2.18.127
Added headset stand support Added Glaive support
This commit is contained in:
1 parent
220953bfe7
commit
6840813529
10 files changed
+191
-2
No files matched your search
@@ -0,0 +1,91 @@
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using CUE.NET.Devices.Generic;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using CUE.NET.Exceptions;
|
||||
using CUE.NET.Native;
|
||||
|
||||
namespace CUE.NET.Devices.HeadsetStand
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the SDK for a corsair headset stand.
|
||||
/// </summary>
|
||||
public class CorsairHeadsetStand : AbstractCueDevice
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets specific information provided by CUE for the headset stand.
|
||||
/// </summary>
|
||||
public CorsairHeadsetStandDeviceInfo HeadsetStandDeviceInfo { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CorsairHeadsetStand"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the headset stand</param>
|
||||
internal CorsairHeadsetStand(CorsairHeadsetStandDeviceInfo info)
|
||||
: base(info)
|
||||
{
|
||||
this.HeadsetStandDeviceInfo = info;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the headset stand.
|
||||
/// </summary>
|
||||
public override void Initialize()
|
||||
{
|
||||
int deviceCount = _CUESDK.CorsairGetDeviceCount();
|
||||
|
||||
// Get headset stand device index
|
||||
int headsetStandIndex = -1;
|
||||
for (int i = 0; i < deviceCount; i++)
|
||||
{
|
||||
_CorsairDeviceInfo nativeDeviceInfo = (_CorsairDeviceInfo)Marshal.PtrToStructure(_CUESDK.CorsairGetDeviceInfo(i), typeof(_CorsairDeviceInfo));
|
||||
GenericDeviceInfo info = new GenericDeviceInfo(nativeDeviceInfo);
|
||||
if (info.Type != CorsairDeviceType.HeadsetStand)
|
||||
continue;
|
||||
|
||||
headsetStandIndex = i;
|
||||
break;
|
||||
}
|
||||
if (headsetStandIndex < 0)
|
||||
throw new WrapperException("Can't determine headset stand device index");
|
||||
|
||||
_CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(headsetStandIndex), typeof(_CorsairLedPositions));
|
||||
int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition));
|
||||
IntPtr ptr = nativeLedPositions.pLedPosition;
|
||||
|
||||
// Put the positions in an array for sorting later on
|
||||
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);
|
||||
}
|
||||
|
||||
// Sort for easy iteration by clients
|
||||
foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.ledId))
|
||||
InitializeLed(ledPosition.ledId, new RectangleF((float)ledPosition.left, (float)ledPosition.top, (float)ledPosition.width, (float)ledPosition.height));
|
||||
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
|
||||
using CUE.NET.Devices.Generic;
|
||||
using CUE.NET.Native;
|
||||
|
||||
namespace CUE.NET.Devices.HeadsetStand
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents specific information for a CUE headset stand.
|
||||
/// </summary>
|
||||
public class CorsairHeadsetStandDeviceInfo : GenericDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="CorsairHeadsetStandDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
||||
internal CorsairHeadsetStandDeviceInfo(_CorsairDeviceInfo nativeInfo)
|
||||
: base(nativeInfo)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
|
||||
namespace CUE.NET.Devices.HeadsetStand.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains list of all LEDs available for corsair headset stands.
|
||||
/// </summary>
|
||||
public static class CorsairHeadsetStandLedId
|
||||
{
|
||||
public const CorsairLedId Invalid = CorsairLedId.Invalid;
|
||||
public const CorsairLedId HeadsetStandZone1 = CorsairLedId.HeadsetStandZone1;
|
||||
public const CorsairLedId HeadsetStandZone2 = CorsairLedId.HeadsetStandZone2;
|
||||
public const CorsairLedId HeadsetStandZone3 = CorsairLedId.HeadsetStandZone3;
|
||||
public const CorsairLedId HeadsetStandZone4 = CorsairLedId.HeadsetStandZone4;
|
||||
public const CorsairLedId HeadsetStandZone5 = CorsairLedId.HeadsetStandZone5;
|
||||
public const CorsairLedId HeadsetStandZone6 = CorsairLedId.HeadsetStandZone6;
|
||||
public const CorsairLedId HeadsetStandZone7 = CorsairLedId.HeadsetStandZone7;
|
||||
public const CorsairLedId HeadsetStandZone8 = CorsairLedId.HeadsetStandZone8;
|
||||
public const CorsairLedId HeadsetStandZone9 = CorsairLedId.HeadsetStandZone9;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user