mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-12 05:28:14 +00:00
Fixed warnings
This commit is contained in:
1 parent
57dc9afb32
commit
a0a1521658
118 files changed
+802
-1181
No files matched your search
@@ -5,6 +5,6 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
internal class CoreProps
|
||||
{
|
||||
[JsonPropertyName("address")]
|
||||
public string Address { get; set; }
|
||||
public string? Address { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,13 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
#region Properties & Fields
|
||||
|
||||
[JsonPropertyName("game")]
|
||||
public string Game { get; set; }
|
||||
public string? Game { get; set; }
|
||||
|
||||
[JsonPropertyName("event")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
[JsonPropertyName("data")]
|
||||
public Dictionary<string, object> Data { get; } = new Dictionary<string, object>();
|
||||
public Dictionary<string, object> Data { get; } = new();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
#region Properties & Fields
|
||||
|
||||
[JsonPropertyName("game")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
[JsonPropertyName("game_display_name")]
|
||||
public string DisplayName { get; set; }
|
||||
public string? DisplayName { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
#region Properties & Fields
|
||||
|
||||
[JsonPropertyName("game")]
|
||||
public string Game { get; set; }
|
||||
public string? Game { get; set; }
|
||||
|
||||
[JsonPropertyName("golisp")]
|
||||
public string Handler { get; set; }
|
||||
public string? Handler { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Net.Http;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using RGB.NET.Devices.SteelSeries.API.Model;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries.API
|
||||
@@ -55,10 +54,10 @@ namespace RGB.NET.Devices.SteelSeries.API
|
||||
#region Properties & Fields
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
private static readonly HttpClient _client = new HttpClient();
|
||||
private static readonly Game _game = new Game(GAME_NAME, GAME_DISPLAYNAME);
|
||||
private static readonly Event _event = new Event(_game, EVENT_NAME);
|
||||
private static string _baseUrl;
|
||||
private static readonly HttpClient _client = new();
|
||||
private static readonly Game _game = new(GAME_NAME, GAME_DISPLAYNAME);
|
||||
private static readonly Event _event = new(_game, EVENT_NAME);
|
||||
private static string? _baseUrl;
|
||||
|
||||
internal static bool IsInitialized => !string.IsNullOrWhiteSpace(_baseUrl);
|
||||
|
||||
@@ -74,7 +73,7 @@ namespace RGB.NET.Devices.SteelSeries.API
|
||||
string corePropsPath = GetCorePropsPath();
|
||||
if (!string.IsNullOrWhiteSpace(corePropsPath) && File.Exists(corePropsPath))
|
||||
{
|
||||
CoreProps coreProps = JsonSerializer.Deserialize<CoreProps>(File.ReadAllText(corePropsPath));
|
||||
CoreProps? coreProps = JsonSerializer.Deserialize<CoreProps>(File.ReadAllText(corePropsPath));
|
||||
_baseUrl = coreProps?.Address;
|
||||
if (_baseUrl != null)
|
||||
{
|
||||
@@ -93,12 +92,12 @@ namespace RGB.NET.Devices.SteelSeries.API
|
||||
return IsInitialized;
|
||||
}
|
||||
|
||||
internal static void UpdateLeds(string device, Dictionary<string, int[]> data)
|
||||
internal static void UpdateLeds(string device, IList<(string zone, int[] color)> data)
|
||||
{
|
||||
_event.Data.Clear();
|
||||
_event.Data.Add("value", device);
|
||||
_event.Data.Add("colors", data.Values.ToList());
|
||||
_event.Data.Add("zones", data.Keys.ToList());
|
||||
_event.Data.Add("colors", data.Select(x => x.color).ToList());
|
||||
_event.Data.Add("zones", data.Select(x => x.zone).ToList());
|
||||
|
||||
TriggerEvent(_event);
|
||||
}
|
||||
|
||||
@@ -10,31 +10,31 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
#region Properties & Fields
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
private static readonly Dictionary<SteelSeriesDeviceType, string> _deviceTypeNames = new Dictionary<SteelSeriesDeviceType, string>();
|
||||
private static readonly Dictionary<SteelSeriesLedId, string> _ledIdNames = new Dictionary<SteelSeriesLedId, string>();
|
||||
private static readonly Dictionary<SteelSeriesDeviceType, string?> _deviceTypeNames = new();
|
||||
private static readonly Dictionary<SteelSeriesLedId, string?> _ledIdNames = new();
|
||||
|
||||
// ReSharper restore InconsistentNaming
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
internal static string GetAPIName(this SteelSeriesDeviceType deviceType)
|
||||
internal static string? GetAPIName(this SteelSeriesDeviceType deviceType)
|
||||
{
|
||||
if (!_deviceTypeNames.TryGetValue(deviceType, out string apiName))
|
||||
if (!_deviceTypeNames.TryGetValue(deviceType, out string? apiName))
|
||||
_deviceTypeNames.Add(deviceType, apiName = GetAPIName(typeof(SteelSeriesDeviceType), deviceType));
|
||||
|
||||
return apiName;
|
||||
}
|
||||
|
||||
internal static string GetAPIName(this SteelSeriesLedId ledId)
|
||||
internal static string? GetAPIName(this SteelSeriesLedId ledId)
|
||||
{
|
||||
if (!_ledIdNames.TryGetValue(ledId, out string apiName))
|
||||
if (!_ledIdNames.TryGetValue(ledId, out string? apiName))
|
||||
_ledIdNames.Add(ledId, apiName = GetAPIName(typeof(SteelSeriesLedId), ledId));
|
||||
|
||||
return apiName;
|
||||
}
|
||||
|
||||
private static string GetAPIName(Type type, Enum value)
|
||||
private static string? GetAPIName(Type type, Enum value)
|
||||
{
|
||||
MemberInfo[] memInfo = type.GetMember(value.ToString());
|
||||
if (memInfo.Length == 0) return null;
|
||||
|
||||
@@ -35,9 +35,9 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override void OnUpdate(object sender, CustomUpdateData customData)
|
||||
protected override void OnUpdate(object? sender, CustomUpdateData customData)
|
||||
{
|
||||
if ((customData != null) && (customData["refresh"] as bool? ?? false))
|
||||
if (customData["refresh"] as bool? ?? false)
|
||||
SteelSeriesSDK.SendHeartbeat();
|
||||
else
|
||||
base.OnUpdate(sender, customData);
|
||||
@@ -45,7 +45,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Update(Dictionary<object, Color> dataSet)
|
||||
=> SteelSeriesSDK.UpdateLeds(_deviceType, dataSet.ToDictionary(x => ((SteelSeriesLedId)x.Key).GetAPIName(), x => x.Value.ToIntArray()));
|
||||
=> SteelSeriesSDK.UpdateLeds(_deviceType, dataSet.Select(x => (((SteelSeriesLedId)x.Key).GetAPIName(), x.Value.ToIntArray())).Where(x => x.Item1 != null).ToList()!);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnUpdate(CustomUpdateData updateData = null)
|
||||
protected override void OnUpdate(CustomUpdateData? updateData = null)
|
||||
{
|
||||
base.OnUpdate(updateData);
|
||||
_lastUpdateTimestamp = Stopwatch.GetTimestamp();
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Dictionary<LedId, SteelSeriesLedId> _ledMapping;
|
||||
private Dictionary<LedId, SteelSeriesLedId> _ledMapping = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
@@ -25,7 +25,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
/// Gets or sets the update queue performing updates for this device.
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected UpdateQueue UpdateQueue { get; set; }
|
||||
protected UpdateQueue? UpdateQueue { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue?.SetData(ledsToUpdate.Where(x => x.Color.A > 0));
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries
|
||||
{
|
||||
@@ -27,17 +26,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
public SteelSeriesDeviceType SteelSeriesDeviceType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the layout used to decide which images to load.
|
||||
/// </summary>
|
||||
internal string ImageLayout { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path/name of the layout-file.
|
||||
/// </summary>
|
||||
internal string LayoutPath { get; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@@ -50,13 +39,11 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
/// <param name="deviceCaps">The lighting-capabilities of the device.</param>
|
||||
/// <param name="imageLayout">The layout used to decide which images to load.</param>
|
||||
/// <param name="layoutPath">The path/name of the layout-file.</param>
|
||||
internal SteelSeriesRGBDeviceInfo(RGBDeviceType deviceType, string model, SteelSeriesDeviceType steelSeriesDeviceType, string imageLayout, string layoutPath)
|
||||
internal SteelSeriesRGBDeviceInfo(RGBDeviceType deviceType, string model, SteelSeriesDeviceType steelSeriesDeviceType)
|
||||
{
|
||||
this.DeviceType = deviceType;
|
||||
this.Model = model;
|
||||
this.SteelSeriesDeviceType = steelSeriesDeviceType;
|
||||
this.ImageLayout = imageLayout;
|
||||
this.LayoutPath = layoutPath;
|
||||
|
||||
DeviceName = $"{Manufacturer} {Model}";
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Linq;
|
||||
using HidSharp;
|
||||
using RGB.NET.Core;
|
||||
using DeviceDataList = System.Collections.Generic.List<(string model, RGB.NET.Core.RGBDeviceType deviceType, int id, RGB.NET.Devices.SteelSeries.SteelSeriesDeviceType steelSeriesDeviceType, string imageLayout, string layoutPath, System.Collections.Generic.Dictionary<RGB.NET.Core.LedId, RGB.NET.Devices.SteelSeries.SteelSeriesLedId> ledMapping)>;
|
||||
using DeviceDataList = System.Collections.Generic.List<(string model, RGB.NET.Core.RGBDeviceType deviceType, int id, RGB.NET.Devices.SteelSeries.SteelSeriesDeviceType steelSeriesDeviceType, System.Collections.Generic.Dictionary<RGB.NET.Core.LedId, RGB.NET.Devices.SteelSeries.SteelSeriesLedId> ledMapping)>;
|
||||
using LedMapping = System.Collections.Generic.Dictionary<RGB.NET.Core.LedId, RGB.NET.Devices.SteelSeries.SteelSeriesLedId>;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries.HID
|
||||
@@ -11,7 +11,7 @@ namespace RGB.NET.Devices.SteelSeries.HID
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private static readonly LedMapping KEYBOARD_MAPPING_UK = new LedMapping
|
||||
private static readonly LedMapping KEYBOARD_MAPPING_UK = new()
|
||||
{
|
||||
{ LedId.Logo, SteelSeriesLedId.Logo },
|
||||
{ LedId.Keyboard_Escape, SteelSeriesLedId.Escape },
|
||||
@@ -121,7 +121,7 @@ namespace RGB.NET.Devices.SteelSeries.HID
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, SteelSeriesLedId.KeypadPeriod }
|
||||
};
|
||||
|
||||
private static readonly LedMapping KEYBOARD_TKL_MAPPING_UK = new LedMapping
|
||||
private static readonly LedMapping KEYBOARD_TKL_MAPPING_UK = new()
|
||||
{
|
||||
{ LedId.Logo, SteelSeriesLedId.Logo },
|
||||
{ LedId.Keyboard_Escape, SteelSeriesLedId.Escape },
|
||||
@@ -214,87 +214,87 @@ namespace RGB.NET.Devices.SteelSeries.HID
|
||||
{ LedId.Keyboard_ArrowRight, SteelSeriesLedId.RightArrow }
|
||||
};
|
||||
|
||||
private static readonly LedMapping MOUSE_ONE_ZONE = new LedMapping
|
||||
private static readonly LedMapping MOUSE_ONE_ZONE = new()
|
||||
{
|
||||
{LedId.Mouse1, SteelSeriesLedId.ZoneOne}
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne }
|
||||
};
|
||||
|
||||
private static readonly LedMapping MOUSE_TWO_ZONE = new LedMapping
|
||||
{
|
||||
{LedId.Mouse1, SteelSeriesLedId.ZoneOne},
|
||||
{LedId.Mouse2, SteelSeriesLedId.ZoneTwo}
|
||||
};
|
||||
private static readonly LedMapping MOUSE_TWO_ZONE = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo }
|
||||
};
|
||||
|
||||
private static readonly LedMapping MOUSE_THREE_ZONE = new LedMapping
|
||||
{
|
||||
{LedId.Mouse1, SteelSeriesLedId.ZoneOne},
|
||||
{LedId.Mouse2, SteelSeriesLedId.ZoneTwo},
|
||||
{LedId.Mouse3, SteelSeriesLedId.ZoneThree}
|
||||
};
|
||||
|
||||
private static readonly LedMapping MOUSE_EIGHT_ZONE = new LedMapping
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne},
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo},
|
||||
{ LedId.Mouse3, SteelSeriesLedId.ZoneThree},
|
||||
{ LedId.Mouse4, SteelSeriesLedId.ZoneFour},
|
||||
{ LedId.Mouse5, SteelSeriesLedId.ZoneFive},
|
||||
{ LedId.Mouse6, SteelSeriesLedId.ZoneSix},
|
||||
{ LedId.Mouse7, SteelSeriesLedId.ZoneSeven},
|
||||
{ LedId.Mouse8, SteelSeriesLedId.ZoneEight}
|
||||
};
|
||||
|
||||
private static readonly LedMapping HEADSET_TWO_ZONE = new LedMapping
|
||||
private static readonly LedMapping MOUSE_THREE_ZONE = new()
|
||||
{
|
||||
{LedId.Headset1, SteelSeriesLedId.ZoneOne},
|
||||
{LedId.Headset2, SteelSeriesLedId.ZoneTwo}
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.Mouse3, SteelSeriesLedId.ZoneThree }
|
||||
};
|
||||
|
||||
|
||||
private static readonly LedMapping MOUSE_EIGHT_ZONE = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.Mouse3, SteelSeriesLedId.ZoneThree },
|
||||
{ LedId.Mouse4, SteelSeriesLedId.ZoneFour },
|
||||
{ LedId.Mouse5, SteelSeriesLedId.ZoneFive },
|
||||
{ LedId.Mouse6, SteelSeriesLedId.ZoneSix },
|
||||
{ LedId.Mouse7, SteelSeriesLedId.ZoneSeven },
|
||||
{ LedId.Mouse8, SteelSeriesLedId.ZoneEight }
|
||||
};
|
||||
|
||||
private static readonly LedMapping HEADSET_TWO_ZONE = new()
|
||||
{
|
||||
{ LedId.Headset1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Headset2, SteelSeriesLedId.ZoneTwo }
|
||||
};
|
||||
|
||||
private const int VENDOR_ID = 0x1038;
|
||||
|
||||
//TODO DarthAffe 16.02.2019: Add devices
|
||||
private static readonly DeviceDataList DEVICES = new DeviceDataList
|
||||
private static readonly DeviceDataList DEVICES = new()
|
||||
{
|
||||
//Mice
|
||||
("Aerox 3", RGBDeviceType.Mouse, 0x1836, SteelSeriesDeviceType.ThreeZone, "default", @"Mice\Aerox3", MOUSE_THREE_ZONE),
|
||||
("Aerox 3 Wireless", RGBDeviceType.Mouse, 0x183A, SteelSeriesDeviceType.ThreeZone, "default", @"Mice\Aerox3Wireless", MOUSE_THREE_ZONE),
|
||||
("Rival 100", RGBDeviceType.Mouse, 0x1702, SteelSeriesDeviceType.OneZone, "default", @"Mice\Rival100", MOUSE_ONE_ZONE),
|
||||
("Rival 105", RGBDeviceType.Mouse, 0x1814, SteelSeriesDeviceType.OneZone, "default", @"Mice\Rival105", MOUSE_ONE_ZONE),
|
||||
("Rival 106", RGBDeviceType.Mouse, 0x1816, SteelSeriesDeviceType.OneZone, "default", @"Mice\Rival106", MOUSE_ONE_ZONE),
|
||||
("Rival 110", RGBDeviceType.Mouse, 0x1729, SteelSeriesDeviceType.OneZone, "default", @"Mice\Rival110", MOUSE_ONE_ZONE),
|
||||
("Rival 150", RGBDeviceType.Mouse, 0x0472, SteelSeriesDeviceType.OneZone, "default", @"Mice\Rival150", MOUSE_ONE_ZONE),
|
||||
("Rival 300", RGBDeviceType.Mouse, 0x1710, SteelSeriesDeviceType.TwoZone, "default", @"Mice\Rival300", MOUSE_TWO_ZONE),
|
||||
("Rival 310", RGBDeviceType.Mouse, 0x1720, SteelSeriesDeviceType.TwoZone, "default", @"Mice\Rival310", MOUSE_TWO_ZONE),
|
||||
("Rival 500", RGBDeviceType.Mouse, 0x170E, SteelSeriesDeviceType.TwoZone, "default", @"Mice\Rival500", MOUSE_TWO_ZONE),
|
||||
("Rival 600", RGBDeviceType.Mouse, 0x1724, SteelSeriesDeviceType.EightZone, "default", @"Mice\Rival600", MOUSE_EIGHT_ZONE),
|
||||
("Rival 700", RGBDeviceType.Mouse, 0x1700, SteelSeriesDeviceType.TwoZone, "default", @"Mice\Rival700", MOUSE_TWO_ZONE),
|
||||
("Rival 3 (Old Firmware)", RGBDeviceType.Mouse, 0x1824, SteelSeriesDeviceType.ThreeZone, "default", @"Mice\Rival3", MOUSE_THREE_ZONE),
|
||||
("Rival 3", RGBDeviceType.Mouse, 0x184C, SteelSeriesDeviceType.ThreeZone, "default", @"Mice\Rival3", MOUSE_THREE_ZONE),
|
||||
("Rival 3 Wireless", RGBDeviceType.Mouse, 0x1830, SteelSeriesDeviceType.ThreeZone, "default", @"Mice\Rival3Wireless", MOUSE_THREE_ZONE),
|
||||
("Sensei Ten", RGBDeviceType.Mouse, 0x1832, SteelSeriesDeviceType.TwoZone, "default", @"Mice\SenseiTen", MOUSE_TWO_ZONE),
|
||||
("Aerox 3", RGBDeviceType.Mouse, 0x1836, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Aerox 3 Wireless", RGBDeviceType.Mouse, 0x183A, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Rival 100", RGBDeviceType.Mouse, 0x1702, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 105", RGBDeviceType.Mouse, 0x1814, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 106", RGBDeviceType.Mouse, 0x1816, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 110", RGBDeviceType.Mouse, 0x1729, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 150", RGBDeviceType.Mouse, 0x0472, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 300", RGBDeviceType.Mouse, 0x1710, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
("Rival 310", RGBDeviceType.Mouse, 0x1720, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
("Rival 500", RGBDeviceType.Mouse, 0x170E, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
("Rival 600", RGBDeviceType.Mouse, 0x1724, SteelSeriesDeviceType.EightZone, MOUSE_EIGHT_ZONE),
|
||||
("Rival 700", RGBDeviceType.Mouse, 0x1700, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
("Rival 3 (Old Firmware)", RGBDeviceType.Mouse, 0x1824, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Rival 3", RGBDeviceType.Mouse, 0x184C, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Rival 3 Wireless", RGBDeviceType.Mouse, 0x1830, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Sensei Ten", RGBDeviceType.Mouse, 0x1832, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
|
||||
//Keyboards
|
||||
("Apex 5", RGBDeviceType.Keyboard, 0x161C, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\5\UK", KEYBOARD_MAPPING_UK),
|
||||
("Apex 7", RGBDeviceType.Keyboard, 0x1612, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\7\UK", KEYBOARD_MAPPING_UK),
|
||||
("Apex 7 TKL", RGBDeviceType.Keyboard, 0x1618, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\7TKL\UK", KEYBOARD_TKL_MAPPING_UK),
|
||||
("Apex M750", RGBDeviceType.Keyboard, 0x0616, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\M750\UK", KEYBOARD_MAPPING_UK),
|
||||
("Apex M800", RGBDeviceType.Keyboard, 0x1600, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\M800\UK", KEYBOARD_MAPPING_UK),
|
||||
("Apex Pro", RGBDeviceType.Keyboard, 0x1610, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\Pro\UK", KEYBOARD_MAPPING_UK),
|
||||
("Apex Pro TKL", RGBDeviceType.Keyboard, 0x1614, SteelSeriesDeviceType.PerKey, "UK", @"Keyboards\ProTKL\UK", KEYBOARD_TKL_MAPPING_UK),
|
||||
("Apex 5", RGBDeviceType.Keyboard, 0x161C, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex 7", RGBDeviceType.Keyboard, 0x1612, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex 7 TKL", RGBDeviceType.Keyboard, 0x1618, SteelSeriesDeviceType.PerKey, KEYBOARD_TKL_MAPPING_UK),
|
||||
("Apex M750", RGBDeviceType.Keyboard, 0x0616, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex M800", RGBDeviceType.Keyboard, 0x1600, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex Pro", RGBDeviceType.Keyboard, 0x1610, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex Pro TKL", RGBDeviceType.Keyboard, 0x1614, SteelSeriesDeviceType.PerKey, KEYBOARD_TKL_MAPPING_UK),
|
||||
|
||||
//Headsets
|
||||
("Arctis 5", RGBDeviceType.Headset, 0x12AA, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
|
||||
("Arctis 5 Game", RGBDeviceType.Headset, 0x1250, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
|
||||
("Arctis 5 Game - Dota 2 edition", RGBDeviceType.Headset, 0x1251, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
|
||||
("Arctis 5 Game - PUBG edition", RGBDeviceType.Headset, 0x12A8, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
|
||||
("Arctis Pro Game", RGBDeviceType.Headset, 0x1252, SteelSeriesDeviceType.TwoZone, "default", @"Headsets\Artis5", HEADSET_TWO_ZONE),
|
||||
("Arctis 5", RGBDeviceType.Headset, 0x12AA, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
("Arctis 5 Game", RGBDeviceType.Headset, 0x1250, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
("Arctis 5 Game - Dota 2 edition", RGBDeviceType.Headset, 0x1251, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
("Arctis 5 Game - PUBG edition", RGBDeviceType.Headset, 0x12A8, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
("Arctis Pro Game", RGBDeviceType.Headset, 0x1252, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
public static DeviceDataList ConnectedDevices { get; } = new DeviceDataList();
|
||||
public static DeviceDataList ConnectedDevices { get; } = new();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -304,7 +304,7 @@ namespace RGB.NET.Devices.SteelSeries.HID
|
||||
{
|
||||
ConnectedDevices.Clear();
|
||||
|
||||
HashSet<int> ids = new HashSet<int>(DeviceList.Local.GetHidDevices(VENDOR_ID).Select(x => x.ProductID).Distinct());
|
||||
HashSet<int> ids = new(DeviceList.Local.GetHidDevices(VENDOR_ID).Select(x => x.ProductID).Distinct());
|
||||
DeviceDataList connectedDevices = DEVICES.Where(d => ids.Contains(d.id) && loadFilter.HasFlag(d.deviceType)).ToList();
|
||||
|
||||
List<SteelSeriesDeviceType> connectedDeviceTypes = connectedDevices.Select(d => d.steelSeriesDeviceType).ToList();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.SteelSeries.API;
|
||||
using RGB.NET.Devices.SteelSeries.HID;
|
||||
@@ -15,7 +16,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private static SteelSeriesDeviceProvider _instance;
|
||||
private static SteelSeriesDeviceProvider? _instance;
|
||||
/// <summary>
|
||||
/// Gets the singleton <see cref="SteelSeriesDeviceProvider"/> instance.
|
||||
/// </summary>
|
||||
@@ -28,13 +29,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
public bool IsInitialized { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Gets whether the application has exclusive access to the SDK or not.
|
||||
/// </summary>
|
||||
public bool HasExclusiveAccess => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IRGBDevice> Devices { get; private set; }
|
||||
public IEnumerable<IRGBDevice> Devices { get; private set; } = Enumerable.Empty<IRGBDevice>();
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="SteelSeriesDeviceUpdateTrigger"/> used to trigger the updates for SteelSeries devices.
|
||||
@@ -68,7 +63,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
{
|
||||
IsInitialized = false;
|
||||
|
||||
UpdateTrigger?.Stop();
|
||||
UpdateTrigger.Stop();
|
||||
|
||||
if (!SteelSeriesSDK.IsInitialized)
|
||||
SteelSeriesSDK.Initialize();
|
||||
@@ -78,17 +73,18 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
|
||||
try
|
||||
{
|
||||
foreach ((string model, RGBDeviceType deviceType, int _, SteelSeriesDeviceType steelSeriesDeviceType, string imageLayout, string layoutPath, Dictionary<LedId, SteelSeriesLedId> ledMapping) in DeviceChecker.ConnectedDevices)
|
||||
foreach ((string model, RGBDeviceType deviceType, int _, SteelSeriesDeviceType steelSeriesDeviceType, Dictionary<LedId, SteelSeriesLedId> ledMapping) in DeviceChecker.ConnectedDevices)
|
||||
{
|
||||
ISteelSeriesRGBDevice device = new SteelSeriesRGBDevice(new SteelSeriesRGBDeviceInfo(deviceType, model, steelSeriesDeviceType, imageLayout, layoutPath));
|
||||
SteelSeriesDeviceUpdateQueue updateQueue = new SteelSeriesDeviceUpdateQueue(UpdateTrigger, steelSeriesDeviceType.GetAPIName());
|
||||
ISteelSeriesRGBDevice device = new SteelSeriesRGBDevice(new SteelSeriesRGBDeviceInfo(deviceType, model, steelSeriesDeviceType));
|
||||
string apiName = steelSeriesDeviceType.GetAPIName() ?? throw new RGBDeviceException($"Missing API-name for device {model}");
|
||||
SteelSeriesDeviceUpdateQueue updateQueue = new(UpdateTrigger, apiName);
|
||||
device.Initialize(updateQueue, ledMapping);
|
||||
devices.Add(device);
|
||||
}
|
||||
}
|
||||
catch { if (throwExceptions) throw; }
|
||||
|
||||
UpdateTrigger?.Start();
|
||||
UpdateTrigger.Start();
|
||||
|
||||
Devices = new ReadOnlyCollection<IRGBDevice>(devices);
|
||||
IsInitialized = true;
|
||||
|
||||
Reference in new issue
Block a user