Refactoring

This commit is contained in:
DarthAffe committed 2021-02-06 17:07:41 +01:00
1 parent a0a1521658
commit 6a4ebb3d2a
37 files changed
+123 -300

No files matched your search

@@ -46,7 +46,7 @@ namespace RGB.NET.Devices.Wooting.Generic
this.DeviceType = deviceType;
this.DeviceIndex = deviceIndex;
Model = deviceIndex.GetDescription() ?? "Unknown";
Model = deviceIndex.GetDescription();
DeviceName = $"{Manufacturer} {Model}";
}
@@ -14,7 +14,7 @@ namespace RGB.NET.Devices.Wooting.Helper
/// </summary>
/// <param name="source">The enum value to get the description from.</param>
/// <returns>The value of the <see cref="DescriptionAttribute"/> or the <see cref="System.Enum.ToString()" /> result of the source.</returns>
internal static string? GetDescription(this System.Enum source)
internal static string GetDescription(this System.Enum source)
=> source.GetAttribute<DescriptionAttribute>()?.Description ?? source.ToString();
/// <summary>
@@ -1,5 +1,4 @@
using System.Globalization;
using RGB.NET.Core;
using RGB.NET.Core;
using RGB.NET.Devices.Wooting.Enum;
using RGB.NET.Devices.Wooting.Generic;
@@ -74,7 +74,7 @@ namespace RGB.NET.Devices.Wooting
/// <inheritdoc />
/// <exception cref="RGBDeviceException">Thrown if the SDK failed to initialize</exception>
public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool throwExceptions = false)
{
IsInitialized = false;
@@ -113,17 +113,18 @@ namespace RGB.NET.Devices.Wooting
return true;
}
/// <inheritdoc />
public void ResetDevices()
{ }
/// <inheritdoc />
public void Dispose()
{
try { UpdateTrigger.Dispose(); }
catch { /* at least we tried */ }
foreach (IRGBDevice device in Devices)
try { device.Dispose(); }
catch { /* at least we tried */ }
Devices = Enumerable.Empty<IRGBDevice>();
try { _WootingSDK.Close(); }
catch { /* Unlucky.. */ }