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

@@ -39,7 +39,7 @@ namespace RGB.NET.Devices.Logitech
/// <inheritdoc />
public bool IsInitialized { get; private set; }
/// <inheritdoc />
public IEnumerable<IRGBDevice> Devices { get; private set; } = Enumerable.Empty<IRGBDevice>();
@@ -76,7 +76,7 @@ namespace RGB.NET.Devices.Logitech
#region Methods
/// <inheritdoc />
public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool throwExceptions = false)
{
try
{
@@ -165,15 +165,17 @@ namespace RGB.NET.Devices.Logitech
return true;
}
/// <inheritdoc />
public void ResetDevices() => _LogitechGSDK.LogiLedRestoreLighting();
/// <inheritdoc />
public void Dispose()
{
try { UpdateTrigger?.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 { _LogitechGSDK.LogiLedRestoreLighting(); }
catch { /* at least we tried */ }
@@ -26,7 +26,7 @@ namespace RGB.NET.Devices.Logitech
#region Methods
/// <inheritdoc />
protected override object? GetLedCustomData(LedId ledId) => (ledId, PerKeyIdMapping.DEFAULT.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : LogitechLedId.Invalid);
protected override object GetLedCustomData(LedId ledId) => (ledId, PerKeyIdMapping.DEFAULT.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : LogitechLedId.Invalid);
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue?.SetData(ledsToUpdate.Where(x => x.Color.A > 0));