Changed all namespaces to file-scope

This commit is contained in:
DarthAffe committed 2021-11-13 17:35:08 +01:00
1 parent a0c6ccebea
commit 30624035f1
353 files changed
+35775 -36129

No files matched your search

@@ -1,20 +1,19 @@
namespace RGB.NET.Devices.SteelSeries
namespace RGB.NET.Devices.SteelSeries;
internal class APIName : System.Attribute
{
internal class APIName : System.Attribute
#region Properties & Fields
public string Name { get; set; }
#endregion
#region Constructors
public APIName(string name)
{
#region Properties & Fields
public string Name { get; set; }
#endregion
#region Constructors
public APIName(string name)
{
this.Name = name;
}
#endregion
this.Name = name;
}
}
#endregion
}
@@ -3,44 +3,43 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace RGB.NET.Devices.SteelSeries
namespace RGB.NET.Devices.SteelSeries;
internal static class SteelSeriesEnumExtension
{
internal static class SteelSeriesEnumExtension
#region Properties & Fields
// ReSharper disable InconsistentNaming
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)
{
#region Properties & Fields
// ReSharper disable InconsistentNaming
if (!_deviceTypeNames.TryGetValue(deviceType, out string? apiName))
_deviceTypeNames.Add(deviceType, apiName = GetAPIName(typeof(SteelSeriesDeviceType), deviceType));
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)
{
if (!_deviceTypeNames.TryGetValue(deviceType, out string? apiName))
_deviceTypeNames.Add(deviceType, apiName = GetAPIName(typeof(SteelSeriesDeviceType), deviceType));
return apiName;
}
internal static string? GetAPIName(this SteelSeriesLedId ledId)
{
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)
{
MemberInfo[] memInfo = type.GetMember(value.ToString());
if (memInfo.Length == 0) return null;
return (memInfo.FirstOrDefault()?.GetCustomAttributes(typeof(APIName), false).FirstOrDefault() as APIName)?.Name;
}
#endregion
return apiName;
}
}
internal static string? GetAPIName(this SteelSeriesLedId ledId)
{
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)
{
MemberInfo[] memInfo = type.GetMember(value.ToString());
if (memInfo.Length == 0) return null;
return (memInfo.FirstOrDefault()?.GetCustomAttributes(typeof(APIName), false).FirstOrDefault() as APIName)?.Name;
}
#endregion
}