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

@@ -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;