Fixed warnings

This commit is contained in:
DarthAffe committed 2021-02-02 23:37:56 +01:00
1 parent 57dc9afb32
commit a0a1521658
118 files changed
+802 -1181

No files matched your search

@@ -14,8 +14,8 @@ namespace RGB.NET.Devices.CoolerMaster
#region MasterKeysL
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysL_US = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysL_US = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -131,8 +131,8 @@ namespace RGB.NET.Devices.CoolerMaster
{ LedId.Keyboard_NumPeriodAndDelete, (5,20) }
};
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysL_EU = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysL_EU = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -253,8 +253,8 @@ namespace RGB.NET.Devices.CoolerMaster
#region MasterKeysM
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysM_US = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysM_US = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -354,8 +354,8 @@ namespace RGB.NET.Devices.CoolerMaster
{ LedId.Keyboard_NumPeriodAndDelete, (5,17) }
};
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysM_EU = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysM_EU = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -460,8 +460,8 @@ namespace RGB.NET.Devices.CoolerMaster
#region MasterKeysS
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysS_US = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysS_US = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -556,8 +556,8 @@ namespace RGB.NET.Devices.CoolerMaster
{ LedId.Keyboard_ArrowRight, (5,17) }
};
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysS_EU = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysS_EU = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -657,8 +657,8 @@ namespace RGB.NET.Devices.CoolerMaster
#region MasterKeysMK750
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysMK750_US = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysMK750_US = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -801,8 +801,8 @@ namespace RGB.NET.Devices.CoolerMaster
{ LedId.Keyboard_Custom22, (6,17) },
};
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysMK750_EU = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysMK750_EU = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -946,8 +946,8 @@ namespace RGB.NET.Devices.CoolerMaster
{ LedId.Keyboard_Custom22, (6,17) }
};
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysMK750_JP = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> MasterKeysMK750_JP = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -1099,8 +1099,8 @@ namespace RGB.NET.Devices.CoolerMaster
#region CKxxx
private static readonly Dictionary<LedId, (int row, int column)> CKxxx_US = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> CKxxx_US = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -1212,8 +1212,8 @@ namespace RGB.NET.Devices.CoolerMaster
{ LedId.Keyboard_NumPeriodAndDelete, (5,20) }
};
private static readonly Dictionary<LedId, (int row, int column)> CKxxx_EU = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> CKxxx_EU = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -1326,8 +1326,8 @@ namespace RGB.NET.Devices.CoolerMaster
{ LedId.Keyboard_NumPeriodAndDelete, (5,20) }
};
private static readonly Dictionary<LedId, (int row, int column)> CKxxx_JP = new Dictionary<LedId, (int row, int column)>
{
private static readonly Dictionary<LedId, (int row, int column)> CKxxx_JP = new()
{
{ LedId.Keyboard_Escape, (0,0) },
{ LedId.Keyboard_F1, (0,1) },
{ LedId.Keyboard_F2, (0,2) },
@@ -1450,7 +1450,7 @@ namespace RGB.NET.Devices.CoolerMaster
/// Contains all the hardware-id mappings for CoolerMaster devices.
/// </summary>
public static readonly Dictionary<CoolerMasterDevicesIndexes, Dictionary<CoolerMasterPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>> Mapping =
new Dictionary<CoolerMasterDevicesIndexes, Dictionary<CoolerMasterPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>>
new()
{
{ CoolerMasterDevicesIndexes.MasterKeys_L, new Dictionary<CoolerMasterPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>
{
@@ -27,13 +27,13 @@ namespace RGB.NET.Devices.CoolerMaster
/// <inheritdoc />
protected override void InitializeLayout()
{
if (!CoolerMasterKeyboardLedMappings.Mapping.TryGetValue(DeviceInfo.DeviceIndex, out Dictionary<CoolerMasterPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>> deviceMappings))
if (!CoolerMasterKeyboardLedMappings.Mapping.TryGetValue(DeviceInfo.DeviceIndex, out Dictionary<CoolerMasterPhysicalKeyboardLayout, Dictionary<LedId, (int row, int column)>>? deviceMappings))
throw new RGBDeviceException($"Failed to find a CoolerMasterKeyboardLedMapping for device index {DeviceInfo.DeviceIndex}");
if (!deviceMappings.TryGetValue(DeviceInfo.PhysicalLayout, out Dictionary<LedId, (int row, int column)> mapping))
if (!deviceMappings.TryGetValue(DeviceInfo.PhysicalLayout, out Dictionary<LedId, (int row, int column)>? mapping))
throw new RGBDeviceException($"Failed to find a CoolerMasterKeyboardLedMapping for device index {DeviceInfo.DeviceIndex} with physical layout {DeviceInfo.PhysicalLayout}");
foreach (KeyValuePair<LedId, (int row, int column)> led in mapping)
AddLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19, 19));
foreach ((LedId ledId, (int row, int column)) in mapping)
AddLed(ledId, new Point(column * 19, row * 19), new Size(19, 19));
}
/// <inheritdoc />
@@ -1,5 +1,4 @@
using System.Globalization;
using RGB.NET.Core;
using RGB.NET.Core;
namespace RGB.NET.Devices.CoolerMaster
{
@@ -16,11 +15,6 @@ namespace RGB.NET.Devices.CoolerMaster
/// </summary>
public CoolerMasterPhysicalKeyboardLayout PhysicalLayout { get; }
/// <summary>
/// Gets the <see cref="CoolerMasterLogicalKeyboardLayout"/> of the <see cref="CoolerMasterKeyboardRGBDevice"/>.
/// </summary>
public CoolerMasterLogicalKeyboardLayout LogicalLayout { get; private set; }
#endregion
#region Constructors
@@ -32,23 +26,10 @@ namespace RGB.NET.Devices.CoolerMaster
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterKeyboardRGBDevice" />.</param>
/// <param name="physicalKeyboardLayout">The <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterPhysicalKeyboardLayout" /> of the <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterKeyboardRGBDevice" />.</param>
/// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> of the layout this keyboard is using</param>
internal CoolerMasterKeyboardRGBDeviceInfo(CoolerMasterDevicesIndexes deviceIndex, CoolerMasterPhysicalKeyboardLayout physicalKeyboardLayout, CultureInfo culture)
internal CoolerMasterKeyboardRGBDeviceInfo(CoolerMasterDevicesIndexes deviceIndex, CoolerMasterPhysicalKeyboardLayout physicalKeyboardLayout)
: base(RGBDeviceType.Keyboard, deviceIndex)
{
this.PhysicalLayout = physicalKeyboardLayout;
SetLayouts(culture.KeyboardLayoutId);
}
private void SetLayouts(int keyboardLayoutId)
{
switch (keyboardLayoutId)
{
//TODO DarthAffe 02.04.2017: Check all available keyboards and there layout-ids
default:
LogicalLayout = CoolerMasterLogicalKeyboardLayout.DE;
break;
}
}
#endregion