mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
Added DeviceName
This commit is contained in:
parent
7c5306232f
commit
d0c3d4a9dc
@ -14,6 +14,11 @@ namespace RGB.NET.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
RGBDeviceType DeviceType { get; }
|
RGBDeviceType DeviceType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unique name of the <see cref="IRGBDevice"/>.
|
||||||
|
/// </summary>
|
||||||
|
string DeviceName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the manufacturer-name of the <see cref="IRGBDevice"/>.
|
/// Gets the manufacturer-name of the <see cref="IRGBDevice"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -14,6 +14,9 @@ namespace RGB.NET.Devices.Asus
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType { get; }
|
public RGBDeviceType DeviceType { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer { get; }
|
public string Manufacturer { get; }
|
||||||
|
|
||||||
@ -51,6 +54,8 @@ namespace RGB.NET.Devices.Asus
|
|||||||
this.Handle = handle;
|
this.Handle = handle;
|
||||||
this.Model = model;
|
this.Model = model;
|
||||||
this.Manufacturer = manufacturer;
|
this.Manufacturer = manufacturer;
|
||||||
|
|
||||||
|
DeviceName = $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -15,6 +15,9 @@ namespace RGB.NET.Devices.CoolerMaster
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType { get; }
|
public RGBDeviceType DeviceType { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer => "Cooler Master";
|
public string Manufacturer => "Cooler Master";
|
||||||
|
|
||||||
@ -50,6 +53,7 @@ namespace RGB.NET.Devices.CoolerMaster
|
|||||||
this.DeviceIndex = deviceIndex;
|
this.DeviceIndex = deviceIndex;
|
||||||
|
|
||||||
Model = deviceIndex.GetDescription();
|
Model = deviceIndex.GetDescription();
|
||||||
|
DeviceName = $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -129,6 +129,7 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
if (!_CUESDK.CorsairSetLayerPriority(127))
|
if (!_CUESDK.CorsairSetLayerPriority(127))
|
||||||
throw new CUEException(LastError);
|
throw new CUEException(LastError);
|
||||||
|
|
||||||
|
Dictionary<string, int> modelCounter = new Dictionary<string, int>();
|
||||||
IList<IRGBDevice> devices = new List<IRGBDevice>();
|
IList<IRGBDevice> devices = new List<IRGBDevice>();
|
||||||
int deviceCount = _CUESDK.CorsairGetDeviceCount();
|
int deviceCount = _CUESDK.CorsairGetDeviceCount();
|
||||||
for (int i = 0; i < deviceCount; i++)
|
for (int i = 0; i < deviceCount; i++)
|
||||||
@ -136,12 +137,12 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_CorsairDeviceInfo nativeDeviceInfo = (_CorsairDeviceInfo)Marshal.PtrToStructure(_CUESDK.CorsairGetDeviceInfo(i), typeof(_CorsairDeviceInfo));
|
_CorsairDeviceInfo nativeDeviceInfo = (_CorsairDeviceInfo)Marshal.PtrToStructure(_CUESDK.CorsairGetDeviceInfo(i), typeof(_CorsairDeviceInfo));
|
||||||
CorsairRGBDeviceInfo info = new CorsairRGBDeviceInfo(i, RGBDeviceType.Unknown, nativeDeviceInfo);
|
CorsairRGBDeviceInfo info = new CorsairRGBDeviceInfo(i, RGBDeviceType.Unknown, nativeDeviceInfo, modelCounter);
|
||||||
if (!info.CapsMask.HasFlag(CorsairDeviceCaps.Lighting))
|
if (!info.CapsMask.HasFlag(CorsairDeviceCaps.Lighting))
|
||||||
continue; // Everything that doesn't support lighting control is useless
|
continue; // Everything that doesn't support lighting control is useless
|
||||||
|
|
||||||
CorsairDeviceUpdateQueue deviceUpdateQueue = null;
|
CorsairDeviceUpdateQueue deviceUpdateQueue = null;
|
||||||
foreach (ICorsairRGBDevice device in GetRGBDevice(info, i, nativeDeviceInfo))
|
foreach (ICorsairRGBDevice device in GetRGBDevice(info, i, nativeDeviceInfo, modelCounter))
|
||||||
{
|
{
|
||||||
if ((device == null) || !loadFilter.HasFlag(device.DeviceInfo.DeviceType)) continue;
|
if ((device == null) || !loadFilter.HasFlag(device.DeviceInfo.DeviceType)) continue;
|
||||||
|
|
||||||
@ -176,28 +177,28 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<ICorsairRGBDevice> GetRGBDevice(CorsairRGBDeviceInfo info, int i, _CorsairDeviceInfo nativeDeviceInfo)
|
private static IEnumerable<ICorsairRGBDevice> GetRGBDevice(CorsairRGBDeviceInfo info, int i, _CorsairDeviceInfo nativeDeviceInfo, Dictionary<string, int> modelCounter)
|
||||||
{
|
{
|
||||||
switch (info.CorsairDeviceType)
|
switch (info.CorsairDeviceType)
|
||||||
{
|
{
|
||||||
case CorsairDeviceType.Keyboard:
|
case CorsairDeviceType.Keyboard:
|
||||||
yield return new CorsairKeyboardRGBDevice(new CorsairKeyboardRGBDeviceInfo(i, nativeDeviceInfo));
|
yield return new CorsairKeyboardRGBDevice(new CorsairKeyboardRGBDeviceInfo(i, nativeDeviceInfo, modelCounter));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CorsairDeviceType.Mouse:
|
case CorsairDeviceType.Mouse:
|
||||||
yield return new CorsairMouseRGBDevice(new CorsairMouseRGBDeviceInfo(i, nativeDeviceInfo));
|
yield return new CorsairMouseRGBDevice(new CorsairMouseRGBDeviceInfo(i, nativeDeviceInfo, modelCounter));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CorsairDeviceType.Headset:
|
case CorsairDeviceType.Headset:
|
||||||
yield return new CorsairHeadsetRGBDevice(new CorsairHeadsetRGBDeviceInfo(i, nativeDeviceInfo));
|
yield return new CorsairHeadsetRGBDevice(new CorsairHeadsetRGBDeviceInfo(i, nativeDeviceInfo, modelCounter));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CorsairDeviceType.Mousepad:
|
case CorsairDeviceType.Mousepad:
|
||||||
yield return new CorsairMousepadRGBDevice(new CorsairMousepadRGBDeviceInfo(i, nativeDeviceInfo));
|
yield return new CorsairMousepadRGBDevice(new CorsairMousepadRGBDeviceInfo(i, nativeDeviceInfo, modelCounter));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CorsairDeviceType.HeadsetStand:
|
case CorsairDeviceType.HeadsetStand:
|
||||||
yield return new CorsairHeadsetStandRGBDevice(new CorsairHeadsetStandRGBDeviceInfo(i, nativeDeviceInfo));
|
yield return new CorsairHeadsetStandRGBDevice(new CorsairHeadsetStandRGBDeviceInfo(i, nativeDeviceInfo, modelCounter));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CorsairDeviceType.CommanderPro:
|
case CorsairDeviceType.CommanderPro:
|
||||||
@ -220,7 +221,7 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
{
|
{
|
||||||
_CorsairChannelDeviceInfo channelDeviceInfo = (_CorsairChannelDeviceInfo)Marshal.PtrToStructure(channelDeviceInfoPtr, typeof(_CorsairChannelDeviceInfo));
|
_CorsairChannelDeviceInfo channelDeviceInfo = (_CorsairChannelDeviceInfo)Marshal.PtrToStructure(channelDeviceInfoPtr, typeof(_CorsairChannelDeviceInfo));
|
||||||
|
|
||||||
yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(info.CorsairDeviceIndex, nativeDeviceInfo, channelDeviceInfo, referenceLed));
|
yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(info.CorsairDeviceIndex, nativeDeviceInfo, channelDeviceInfo, referenceLed, modelCounter));
|
||||||
referenceLed += channelDeviceInfo.deviceLedCount;
|
referenceLed += channelDeviceInfo.deviceLedCount;
|
||||||
|
|
||||||
channelDeviceInfoPtr = new IntPtr(channelDeviceInfoPtr.ToInt64() + channelDeviceInfoStructSize);
|
channelDeviceInfoPtr = new IntPtr(channelDeviceInfoPtr.ToInt64() + channelDeviceInfoStructSize);
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
// ReSharper disable UnusedMember.Global
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
using RGB.NET.Devices.Corsair.Native;
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
|
|
||||||
@ -31,8 +32,10 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||||
/// <param name="channelDeviceInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairChannelDeviceInfo"/> representing this device.</param>
|
/// <param name="channelDeviceInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairChannelDeviceInfo"/> representing this device.</param>
|
||||||
/// <param name="referenceCorsairLed">The id of the first led of this device.</param>
|
/// <param name="referenceCorsairLed">The id of the first led of this device.</param>
|
||||||
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo, CorsairLedId referenceCorsairLed)
|
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo,
|
||||||
: base(deviceIndex, channelDeviceInfo.type == CorsairChannelDeviceType.Strip ? RGBDeviceType.LedStripe : RGBDeviceType.Fan, nativeInfo, GetModelName(channelDeviceInfo.type))
|
CorsairLedId referenceCorsairLed, Dictionary<string, int> modelCounter)
|
||||||
|
: base(deviceIndex, channelDeviceInfo.type == CorsairChannelDeviceType.Strip ? RGBDeviceType.LedStripe : RGBDeviceType.Fan, nativeInfo,
|
||||||
|
GetModelName(channelDeviceInfo.type), modelCounter)
|
||||||
{
|
{
|
||||||
this.ReferenceCorsairLed = referenceCorsairLed;
|
this.ReferenceCorsairLed = referenceCorsairLed;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
@ -27,6 +28,9 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType { get; }
|
public RGBDeviceType DeviceType { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer => "Corsair";
|
public string Manufacturer => "Corsair";
|
||||||
|
|
||||||
@ -57,13 +61,16 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// <param name="deviceIndex">The index of the <see cref="CorsairRGBDevice{TDeviceInfo}"/>.</param>
|
/// <param name="deviceIndex">The index of the <see cref="CorsairRGBDevice{TDeviceInfo}"/>.</param>
|
||||||
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
|
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
|
||||||
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
||||||
internal CorsairRGBDeviceInfo(int deviceIndex, RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo)
|
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
||||||
|
internal CorsairRGBDeviceInfo(int deviceIndex, RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo, Dictionary<string, int> modelCounter)
|
||||||
{
|
{
|
||||||
this.CorsairDeviceIndex = deviceIndex;
|
this.CorsairDeviceIndex = deviceIndex;
|
||||||
this.DeviceType = deviceType;
|
this.DeviceType = deviceType;
|
||||||
this.CorsairDeviceType = nativeInfo.type;
|
this.CorsairDeviceType = nativeInfo.type;
|
||||||
this.Model = nativeInfo.model == IntPtr.Zero ? null : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase);
|
this.Model = nativeInfo.model == IntPtr.Zero ? null : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase);
|
||||||
this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask;
|
this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask;
|
||||||
|
|
||||||
|
DeviceName = GetUniqueModelName(modelCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -73,13 +80,34 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
|
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
|
||||||
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
||||||
/// <param name="modelName">The name of the device-model (overwrites the one provided with the device info).</param>
|
/// <param name="modelName">The name of the device-model (overwrites the one provided with the device info).</param>
|
||||||
internal CorsairRGBDeviceInfo(int deviceIndex, RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo, string modelName)
|
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
||||||
|
internal CorsairRGBDeviceInfo(int deviceIndex, RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo, string modelName, Dictionary<string, int> modelCounter)
|
||||||
{
|
{
|
||||||
this.CorsairDeviceIndex = deviceIndex;
|
this.CorsairDeviceIndex = deviceIndex;
|
||||||
this.DeviceType = deviceType;
|
this.DeviceType = deviceType;
|
||||||
this.CorsairDeviceType = nativeInfo.type;
|
this.CorsairDeviceType = nativeInfo.type;
|
||||||
this.Model = modelName;
|
this.Model = modelName;
|
||||||
this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask;
|
this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask;
|
||||||
|
|
||||||
|
DeviceName = GetUniqueModelName(modelCounter);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
private string GetUniqueModelName(Dictionary<string, int> modelCounter)
|
||||||
|
{
|
||||||
|
if (modelCounter.TryGetValue(Model, out int counter))
|
||||||
|
{
|
||||||
|
counter = ++modelCounter[Model];
|
||||||
|
return $"{Manufacturer} {Model} {counter}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
modelCounter.Add(Model, 1);
|
||||||
|
return $"{Manufacturer} {Model}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using RGB.NET.Core;
|
using System.Collections.Generic;
|
||||||
|
using RGB.NET.Core;
|
||||||
using RGB.NET.Devices.Corsair.Native;
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
|
|
||||||
namespace RGB.NET.Devices.Corsair
|
namespace RGB.NET.Devices.Corsair
|
||||||
@ -17,8 +18,9 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetRGBDevice" />.</param>
|
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetRGBDevice" />.</param>
|
||||||
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||||
internal CorsairHeadsetRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
||||||
: base(deviceIndex, RGBDeviceType.Headset, nativeInfo)
|
internal CorsairHeadsetRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, Dictionary<string, int> modelCounter)
|
||||||
|
: base(deviceIndex, RGBDeviceType.Headset, nativeInfo, modelCounter)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using RGB.NET.Core;
|
using System.Collections.Generic;
|
||||||
|
using RGB.NET.Core;
|
||||||
using RGB.NET.Devices.Corsair.Native;
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
|
|
||||||
namespace RGB.NET.Devices.Corsair
|
namespace RGB.NET.Devices.Corsair
|
||||||
@ -17,8 +18,9 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetStandRGBDevice" />.</param>
|
/// <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>
|
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||||
internal CorsairHeadsetStandRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
||||||
: base(deviceIndex, RGBDeviceType.HeadsetStand, nativeInfo)
|
internal CorsairHeadsetStandRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, Dictionary<string, int> modelCounter)
|
||||||
|
: base(deviceIndex, RGBDeviceType.HeadsetStand, nativeInfo, modelCounter)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
// ReSharper disable UnusedMember.Global
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
using RGB.NET.Devices.Corsair.Native;
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
|
|
||||||
@ -34,8 +35,9 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairKeyboardRGBDevice" />.</param>
|
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairKeyboardRGBDevice" />.</param>
|
||||||
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||||
internal CorsairKeyboardRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
||||||
: base(deviceIndex, RGBDeviceType.Keyboard, nativeInfo)
|
internal CorsairKeyboardRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, Dictionary<string, int> modelCounter)
|
||||||
|
: base(deviceIndex, RGBDeviceType.Keyboard, nativeInfo, modelCounter)
|
||||||
{
|
{
|
||||||
this.PhysicalLayout = (CorsairPhysicalKeyboardLayout)nativeInfo.physicalLayout;
|
this.PhysicalLayout = (CorsairPhysicalKeyboardLayout)nativeInfo.physicalLayout;
|
||||||
this.LogicalLayout = (CorsairLogicalKeyboardLayout)nativeInfo.logicalLayout;
|
this.LogicalLayout = (CorsairLogicalKeyboardLayout)nativeInfo.logicalLayout;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using RGB.NET.Core;
|
using System.Collections.Generic;
|
||||||
|
using RGB.NET.Core;
|
||||||
using RGB.NET.Devices.Corsair.Native;
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
|
|
||||||
namespace RGB.NET.Devices.Corsair
|
namespace RGB.NET.Devices.Corsair
|
||||||
@ -26,8 +27,9 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairMouseRGBDevice" />.</param>
|
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairMouseRGBDevice" />.</param>
|
||||||
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||||
internal CorsairMouseRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
||||||
: base(deviceIndex, RGBDeviceType.Mouse, nativeInfo)
|
internal CorsairMouseRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, Dictionary<string, int> modelCounter)
|
||||||
|
: base(deviceIndex, RGBDeviceType.Mouse, nativeInfo, modelCounter)
|
||||||
{
|
{
|
||||||
this.PhysicalLayout = (CorsairPhysicalMouseLayout)nativeInfo.physicalLayout;
|
this.PhysicalLayout = (CorsairPhysicalMouseLayout)nativeInfo.physicalLayout;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using RGB.NET.Core;
|
using System.Collections.Generic;
|
||||||
|
using RGB.NET.Core;
|
||||||
using RGB.NET.Devices.Corsair.Native;
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
|
|
||||||
namespace RGB.NET.Devices.Corsair
|
namespace RGB.NET.Devices.Corsair
|
||||||
@ -17,8 +18,9 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceIndex">The index if the <see cref="T:RGB.NET.Devices.Corsair.CorsairMousepadRGBDevice" />.</param>
|
/// <param name="deviceIndex">The index if the <see cref="T:RGB.NET.Devices.Corsair.CorsairMousepadRGBDevice" />.</param>
|
||||||
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||||
internal CorsairMousepadRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
|
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
||||||
: base(deviceIndex, RGBDeviceType.Mousepad, nativeInfo)
|
internal CorsairMousepadRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, Dictionary<string, int> modelCounter)
|
||||||
|
: base(deviceIndex, RGBDeviceType.Mousepad, nativeInfo, modelCounter)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -24,6 +24,9 @@ namespace RGB.NET.Devices.DMX.E131
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType { get; }
|
public RGBDeviceType DeviceType { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer { get; }
|
public string Manufacturer { get; }
|
||||||
|
|
||||||
@ -78,6 +81,8 @@ namespace RGB.NET.Devices.DMX.E131
|
|||||||
CID = new byte[CID_LENGTH];
|
CID = new byte[CID_LENGTH];
|
||||||
new Random().NextBytes(CID);
|
new Random().NextBytes(CID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceName = $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -14,6 +14,9 @@ namespace RGB.NET.Devices.Debug
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType { get; }
|
public RGBDeviceType DeviceType { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer { get; }
|
public string Manufacturer { get; }
|
||||||
|
|
||||||
@ -41,13 +44,15 @@ namespace RGB.NET.Devices.Debug
|
|||||||
/// <param name="model">The model of the device.</param>
|
/// <param name="model">The model of the device.</param>
|
||||||
/// <param name="lighting">The <see cref="RGBDeviceLighting"/> of the device.</param>
|
/// <param name="lighting">The <see cref="RGBDeviceLighting"/> of the device.</param>
|
||||||
/// <param name="supportsSyncBack">True if the device supports syncback; false if not.</param>
|
/// <param name="supportsSyncBack">True if the device supports syncback; false if not.</param>
|
||||||
internal DebugRGBDeviceInfo(RGBDeviceType deviceType, string manufacturer, string model, RGBDeviceLighting lighting, bool supportsSyncBack)
|
internal DebugRGBDeviceInfo(RGBDeviceType deviceType, string manufacturer, string model, RGBDeviceLighting lighting, bool supportsSyncBack, string deviceName = null)
|
||||||
{
|
{
|
||||||
this.DeviceType = deviceType;
|
this.DeviceType = deviceType;
|
||||||
this.Manufacturer = manufacturer;
|
this.Manufacturer = manufacturer;
|
||||||
this.Model = model;
|
this.Model = model;
|
||||||
this.Lighting = lighting;
|
this.Lighting = lighting;
|
||||||
this.SupportsSyncBack = supportsSyncBack;
|
this.SupportsSyncBack = supportsSyncBack;
|
||||||
|
|
||||||
|
DeviceName = deviceName ?? $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -14,6 +14,9 @@ namespace RGB.NET.Devices.Logitech
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType { get; }
|
public RGBDeviceType DeviceType { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer => "Logitech";
|
public string Manufacturer => "Logitech";
|
||||||
|
|
||||||
@ -76,6 +79,8 @@ namespace RGB.NET.Devices.Logitech
|
|||||||
this.DeviceCaps = deviceCaps;
|
this.DeviceCaps = deviceCaps;
|
||||||
this.ImageLayout = imageLayout;
|
this.ImageLayout = imageLayout;
|
||||||
this.LayoutPath = layoutPath;
|
this.LayoutPath = layoutPath;
|
||||||
|
|
||||||
|
DeviceName = $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -19,6 +19,9 @@ namespace RGB.NET.Devices.Msi
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string MsiDeviceType { get; }
|
public string MsiDeviceType { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer { get; }
|
public string Manufacturer { get; }
|
||||||
|
|
||||||
@ -51,6 +54,8 @@ namespace RGB.NET.Devices.Msi
|
|||||||
this.MsiDeviceType = msiDeviceType;
|
this.MsiDeviceType = msiDeviceType;
|
||||||
this.Manufacturer = manufacturer;
|
this.Manufacturer = manufacturer;
|
||||||
this.Model = model;
|
this.Model = model;
|
||||||
|
|
||||||
|
DeviceName = $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -14,6 +14,9 @@ namespace RGB.NET.Devices.Novation
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType { get; }
|
public RGBDeviceType DeviceType { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer => "Novation";
|
public string Manufacturer => "Novation";
|
||||||
|
|
||||||
@ -56,6 +59,8 @@ namespace RGB.NET.Devices.Novation
|
|||||||
this.Model = model;
|
this.Model = model;
|
||||||
this.DeviceId = deviceId;
|
this.DeviceId = deviceId;
|
||||||
this.ColorCapabilities = colorCapabilities;
|
this.ColorCapabilities = colorCapabilities;
|
||||||
|
|
||||||
|
DeviceName = $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -19,6 +19,9 @@ namespace RGB.NET.Devices.Razer
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType { get; }
|
public RGBDeviceType DeviceType { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer => "Razer";
|
public string Manufacturer => "Razer";
|
||||||
|
|
||||||
@ -49,6 +52,8 @@ namespace RGB.NET.Devices.Razer
|
|||||||
this.DeviceId = deviceId;
|
this.DeviceId = deviceId;
|
||||||
this.DeviceType = deviceType;
|
this.DeviceType = deviceType;
|
||||||
this.Model = model;
|
this.Model = model;
|
||||||
|
|
||||||
|
DeviceName = $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -14,6 +14,9 @@ namespace RGB.NET.Devices.SoIP.Client
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType => RGBDeviceType.Unknown;
|
public RGBDeviceType DeviceType => RGBDeviceType.Unknown;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer { get; }
|
public string Manufacturer { get; }
|
||||||
|
|
||||||
@ -49,6 +52,8 @@ namespace RGB.NET.Devices.SoIP.Client
|
|||||||
this.Model = deviceDefinition.Model;
|
this.Model = deviceDefinition.Model;
|
||||||
this.Hostname = deviceDefinition.Hostname;
|
this.Hostname = deviceDefinition.Hostname;
|
||||||
this.Port = deviceDefinition.Port;
|
this.Port = deviceDefinition.Port;
|
||||||
|
|
||||||
|
DeviceName = $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -14,6 +14,9 @@ namespace RGB.NET.Devices.SoIP.Server
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RGBDeviceType DeviceType => RGBDeviceType.Unknown;
|
public RGBDeviceType DeviceType => RGBDeviceType.Unknown;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string DeviceName { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Manufacturer { get; }
|
public string Manufacturer { get; }
|
||||||
|
|
||||||
@ -43,6 +46,8 @@ namespace RGB.NET.Devices.SoIP.Server
|
|||||||
this.Manufacturer = deviceDefinition.Manufacturer;
|
this.Manufacturer = deviceDefinition.Manufacturer;
|
||||||
this.Model = deviceDefinition.Model;
|
this.Model = deviceDefinition.Model;
|
||||||
this.Port = deviceDefinition.Port;
|
this.Port = deviceDefinition.Port;
|
||||||
|
|
||||||
|
DeviceName = $"{Manufacturer} {Model}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user