1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 01:58:30 +00:00

Added corsair device id

This commit is contained in:
Darth Affe 2021-07-02 22:17:12 +02:00
parent 790f55224d
commit 95eeef2d04
2 changed files with 14 additions and 0 deletions

View File

@ -36,6 +36,12 @@ namespace RGB.NET.Devices.Corsair
/// <inheritdoc />
public string Model { get; }
/// <summary>
/// Returns the unique ID provided by the Corsair-SDK.
/// Returns string.Empty for Custom devices.
/// </summary>
public string DeviceId { get; }
/// <inheritdoc />
public object? LayoutMetadata { get; set; }
@ -60,6 +66,7 @@ namespace RGB.NET.Devices.Corsair
this.DeviceType = deviceType;
this.CorsairDeviceType = nativeInfo.type;
this.Model = nativeInfo.model == IntPtr.Zero ? string.Empty : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase);
this.DeviceId = nativeInfo.deviceId ?? string.Empty;
this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask;
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
@ -78,6 +85,7 @@ namespace RGB.NET.Devices.Corsair
this.DeviceType = deviceType;
this.CorsairDeviceType = nativeInfo.type;
this.Model = modelName;
this.DeviceId = nativeInfo.deviceId ?? string.Empty;
this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask;
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);

View File

@ -48,5 +48,11 @@ namespace RGB.NET.Devices.Corsair.Native
/// CUE-SDK: structure that describes channels of the DIY-devices
/// </summary>
internal _CorsairChannelsInfo? channels;
/// <summary>
/// CUE-SDK: null-terminated string that contains unique device identifier that uniquely identifies device at least within session
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
internal string? deviceId;
}
}