diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs index 596625c..a03bfa2 100644 --- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs +++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs @@ -3,9 +3,11 @@ // ReSharper disable AutoPropertyCanBeMadeGetOnly.Global using System; +using System.Buffers; using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; namespace RGB.NET.Core; @@ -100,12 +102,7 @@ public abstract class AbstractRGBDevice : Placeable, IRGBDevice ledsToUpdate = GetLedsToUpdate(flushLeds).ToList(); - - foreach (Led led in ledsToUpdate) - led.Update(); - - UpdateLeds(ledsToUpdate); + UpdateLeds(GetLedsToUpdate(flushLeds)); } /// @@ -124,37 +121,39 @@ public abstract class AbstractRGBDevice : Placeable, IRGBDevice /// The enumerable of leds to convert. /// The enumerable of custom data and color tuples for the specified leds. - protected virtual IEnumerable<(object key, Color color)> GetUpdateData(IEnumerable leds) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected (object key, Color color) GetUpdateData(Led led) { - if (ColorCorrections.Count > 0) - { - foreach (Led led in leds) - { - Color color = led.Color; - object key = led.CustomData ?? led.Id; + Color color = led.Color; + object key = led.CustomData ?? led.Id; - foreach (IColorCorrection colorCorrection in ColorCorrections) - colorCorrection.ApplyTo(ref color); + // ReSharper disable once ForCanBeConvertedToForeach - This causes an allocation that's not really needed here + for (int i = 0; i < ColorCorrections.Count; i++) + ColorCorrections[i].ApplyTo(ref color); - yield return (key, color); - } - } - else - { - foreach (Led led in leds) - { - Color color = led.Color; - object key = led.CustomData ?? led.Id; - - yield return (key, color); - } - } + return (key, color); } /// /// Sends all the updated to the device. /// - protected virtual void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); + protected virtual void UpdateLeds(IEnumerable ledsToUpdate) + { + (object key, Color color)[] buffer = ArrayPool<(object, Color)>.Shared.Rent(LedMapping.Count); + + int counter = 0; + foreach (Led led in ledsToUpdate) + { + led.Update(); + + buffer[counter] = GetUpdateData(led); + ++counter; + } + + UpdateQueue.SetData(new ReadOnlySpan<(object, Color)>(buffer)[..counter]); + + ArrayPool<(object, Color)>.Shared.Return(buffer); + } /// public virtual void Dispose() diff --git a/RGB.NET.Core/Groups/AbstractLedGroup.cs b/RGB.NET.Core/Groups/AbstractLedGroup.cs index 86659af..7135a21 100644 --- a/RGB.NET.Core/Groups/AbstractLedGroup.cs +++ b/RGB.NET.Core/Groups/AbstractLedGroup.cs @@ -1,4 +1,5 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using System.Linq; @@ -61,5 +62,14 @@ public abstract class AbstractLedGroup : AbstractDecoratable /// public IEnumerator GetEnumerator() => GetLeds().GetEnumerator(); + /// + IDisposable? ILedGroup.ToListUnsafe(out IList leds) => ToListUnsafe(out leds); + + protected virtual IDisposable? ToListUnsafe(out IList leds) + { + leds = ToList(); + return null; + } + #endregion } \ No newline at end of file diff --git a/RGB.NET.Core/Groups/ILedGroup.cs b/RGB.NET.Core/Groups/ILedGroup.cs index 97ed8b2..1970afc 100644 --- a/RGB.NET.Core/Groups/ILedGroup.cs +++ b/RGB.NET.Core/Groups/ILedGroup.cs @@ -1,6 +1,7 @@ // ReSharper disable UnusedMemberInSuper.Global // ReSharper disable UnusedMember.Global +using System; using System.Collections.Generic; namespace RGB.NET.Core; @@ -45,4 +46,6 @@ public interface ILedGroup : IDecoratable, IEnumerable /// /// A list containing all in this group. IList ToList(); + + internal IDisposable? ToListUnsafe(out IList leds); } \ No newline at end of file diff --git a/RGB.NET.Core/Groups/ListLedGroup.cs b/RGB.NET.Core/Groups/ListLedGroup.cs index 9c51906..4bca2fb 100644 --- a/RGB.NET.Core/Groups/ListLedGroup.cs +++ b/RGB.NET.Core/Groups/ListLedGroup.cs @@ -1,7 +1,9 @@ // ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedMember.Global +using System; using System.Collections.Generic; +using System.Threading; namespace RGB.NET.Core; @@ -9,14 +11,16 @@ namespace RGB.NET.Core; /// /// Represents a ledgroup containing arbitrary . /// -public class ListLedGroup : AbstractLedGroup +public sealed class ListLedGroup : AbstractLedGroup { #region Properties & Fields + private readonly ActionDisposable _unlockDisposable; + /// /// Gets the list containing the of this . /// - protected IList GroupLeds { get; } = new List(); + private readonly IList _groupLeds = new List(); #endregion @@ -29,7 +33,9 @@ public class ListLedGroup : AbstractLedGroup /// Specifies the surface to attach this group to or null if the group should not be attached on creation. public ListLedGroup(RGBSurface? surface) : base(surface) - { } + { + _unlockDisposable = new ActionDisposable(Unlock); + } /// /// @@ -40,6 +46,8 @@ public class ListLedGroup : AbstractLedGroup public ListLedGroup(RGBSurface? surface, IEnumerable leds) : base(surface) { + _unlockDisposable = new ActionDisposable(Unlock); + AddLeds(leds); } @@ -52,6 +60,8 @@ public class ListLedGroup : AbstractLedGroup public ListLedGroup(RGBSurface? surface, params Led[] leds) : base(surface) { + _unlockDisposable = new ActionDisposable(Unlock); + AddLeds(leds); } @@ -71,10 +81,10 @@ public class ListLedGroup : AbstractLedGroup /// The to add. public void AddLeds(IEnumerable leds) { - lock (GroupLeds) + lock (_groupLeds) foreach (Led led in leds) if (!ContainsLed(led)) - GroupLeds.Add(led); + _groupLeds.Add(led); } /// @@ -89,9 +99,9 @@ public class ListLedGroup : AbstractLedGroup /// The to remove. public void RemoveLeds(IEnumerable leds) { - lock (GroupLeds) + lock (_groupLeds) foreach (Led led in leds) - GroupLeds.Remove(led); + _groupLeds.Remove(led); } /// @@ -101,8 +111,8 @@ public class ListLedGroup : AbstractLedGroup /// true if the LED is contained by this ledgroup; otherwise, false. public bool ContainsLed(Led led) { - lock (GroupLeds) - return GroupLeds.Contains(led); + lock (_groupLeds) + return _groupLeds.Contains(led); } /// @@ -111,10 +121,10 @@ public class ListLedGroup : AbstractLedGroup /// The ledgroup to merge. public void MergeLeds(ILedGroup groupToMerge) { - lock (GroupLeds) + lock (_groupLeds) foreach (Led led in groupToMerge) - if (!GroupLeds.Contains(led)) - GroupLeds.Add(led); + if (!_groupLeds.Contains(led)) + _groupLeds.Add(led); } /// @@ -131,9 +141,18 @@ public class ListLedGroup : AbstractLedGroup /// The list containing the . public override IList ToList() { - lock (GroupLeds) - return new List(GroupLeds); + lock (_groupLeds) + return new List(_groupLeds); } + protected override IDisposable ToListUnsafe(out IList leds) + { + Monitor.Enter(_groupLeds); + leds = _groupLeds; + return _unlockDisposable; + } + + private void Unlock() => Monitor.Exit(_groupLeds); + #endregion } \ No newline at end of file diff --git a/RGB.NET.Core/Ids/IdGenerator.cs b/RGB.NET.Core/Ids/IdGenerator.cs index 99beaa6..c6270e7 100644 --- a/RGB.NET.Core/Ids/IdGenerator.cs +++ b/RGB.NET.Core/Ids/IdGenerator.cs @@ -50,8 +50,7 @@ public static class IdGenerator idMapping.Add(id, mappedId); } - if (!counterMapping.ContainsKey(mappedId)) - counterMapping.Add(mappedId, 0); + counterMapping.TryAdd(mappedId, 0); int counter = ++counterMapping[mappedId]; return counter <= 1 ? mappedId : $"{mappedId} ({counter})"; diff --git a/RGB.NET.Core/Leds/Led.cs b/RGB.NET.Core/Leds/Led.cs index ad2e3f9..2fb05ea 100644 --- a/RGB.NET.Core/Leds/Led.cs +++ b/RGB.NET.Core/Leds/Led.cs @@ -9,7 +9,7 @@ namespace RGB.NET.Core; /// Represents a single LED of a RGB-device. /// [DebuggerDisplay("{Id} {Color}")] -public class Led : Placeable +public sealed class Led : Placeable { #region Properties & Fields diff --git a/RGB.NET.Core/Leds/LedMapping.cs b/RGB.NET.Core/Leds/LedMapping.cs index 05a10ec..0aab16d 100644 --- a/RGB.NET.Core/Leds/LedMapping.cs +++ b/RGB.NET.Core/Leds/LedMapping.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Core; /// Represents a mapping from to a custom identifier. /// /// The identifier the is mapped to. -public class LedMapping : IEnumerable<(LedId ledId, T mapping)> +public sealed class LedMapping : IEnumerable<(LedId ledId, T mapping)> where T : notnull { #region Constants diff --git a/RGB.NET.Core/MVVM/IBindable.cs b/RGB.NET.Core/MVVM/IBindable.cs index 34a861d..24d1fa5 100644 --- a/RGB.NET.Core/MVVM/IBindable.cs +++ b/RGB.NET.Core/MVVM/IBindable.cs @@ -6,5 +6,4 @@ namespace RGB.NET.Core; /// Represents a basic bindable class which notifies when a property value changes. /// public interface IBindable : INotifyPropertyChanged -{ -} \ No newline at end of file +{ } \ No newline at end of file diff --git a/RGB.NET.Core/Misc/AbstractReferenceCounting.cs b/RGB.NET.Core/Misc/AbstractReferenceCounting.cs index 070138a..09d64ef 100644 --- a/RGB.NET.Core/Misc/AbstractReferenceCounting.cs +++ b/RGB.NET.Core/Misc/AbstractReferenceCounting.cs @@ -26,8 +26,7 @@ public abstract class AbstractReferenceCounting : IReferenceCounting public void AddReferencingObject(object obj) { lock (_referencingObjects) - if (!_referencingObjects.Contains(obj)) - _referencingObjects.Add(obj); + _referencingObjects.Add(obj); } /// diff --git a/RGB.NET.Core/Misc/ActionDisposable.cs b/RGB.NET.Core/Misc/ActionDisposable.cs new file mode 100644 index 0000000..843605e --- /dev/null +++ b/RGB.NET.Core/Misc/ActionDisposable.cs @@ -0,0 +1,27 @@ +using System; + +namespace RGB.NET.Core; + +public sealed class ActionDisposable : IDisposable +{ + #region Properties & Fields + + private readonly Action _onDispose; + + #endregion + + #region Constructors + + public ActionDisposable(Action onDispose) + { + this._onDispose = onDispose; + } + + #endregion + + #region Methods + + public void Dispose() => _onDispose(); + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.Core/RGB.NET.Core.csproj b/RGB.NET.Core/RGB.NET.Core.csproj index 6357388..8499b1e 100644 --- a/RGB.NET.Core/RGB.NET.Core.csproj +++ b/RGB.NET.Core/RGB.NET.Core.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -41,7 +41,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -49,7 +49,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Core/RGBSurface.cs b/RGB.NET.Core/RGBSurface.cs index fc8003f..8219191 100644 --- a/RGB.NET.Core/RGBSurface.cs +++ b/RGB.NET.Core/RGBSurface.cs @@ -208,26 +208,27 @@ public sealed class RGBSurface : AbstractBindable, IDisposable if ((brush == null) || !brush.IsEnabled) return; - IList leds = ledGroup.ToList(); - - IEnumerable<(RenderTarget renderTarget, Color color)> render; - switch (brush.CalculationMode) + using (ledGroup.ToListUnsafe(out IList leds)) { - case RenderMode.Relative: - Rectangle brushRectangle = new(leds); - Point offset = new(-brushRectangle.Location.X, -brushRectangle.Location.Y); - brushRectangle = brushRectangle.SetLocation(new Point(0, 0)); - render = brush.Render(brushRectangle, leds.Select(led => new RenderTarget(led, led.AbsoluteBoundary.Translate(offset)))); - break; - case RenderMode.Absolute: - render = brush.Render(Boundary, leds.Select(led => new RenderTarget(led, led.AbsoluteBoundary))); - break; - default: - throw new ArgumentException($"The CalculationMode '{brush.CalculationMode}' is not valid."); - } + IEnumerable<(RenderTarget renderTarget, Color color)> render; + switch (brush.CalculationMode) + { + case RenderMode.Relative: + Rectangle brushRectangle = new(leds); + Point offset = new(-brushRectangle.Location.X, -brushRectangle.Location.Y); + brushRectangle = brushRectangle.SetLocation(new Point(0, 0)); + render = brush.Render(brushRectangle, leds.Select(led => new RenderTarget(led, led.AbsoluteBoundary.Translate(offset)))); + break; + case RenderMode.Absolute: + render = brush.Render(Boundary, leds.Select(led => new RenderTarget(led, led.AbsoluteBoundary))); + break; + default: + throw new ArgumentException($"The CalculationMode '{brush.CalculationMode}' is not valid."); + } - foreach ((RenderTarget renderTarget, Color c) in render) - renderTarget.Led.Color = c; + foreach ((RenderTarget renderTarget, Color c) in render) + renderTarget.Led.Color = c; + } } /// diff --git a/RGB.NET.Core/Rendering/Brushes/SolidColorBrush.cs b/RGB.NET.Core/Rendering/Brushes/SolidColorBrush.cs index 4175db1..158705c 100644 --- a/RGB.NET.Core/Rendering/Brushes/SolidColorBrush.cs +++ b/RGB.NET.Core/Rendering/Brushes/SolidColorBrush.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Core; /// /// Represents a brush drawing only a single color. /// -public class SolidColorBrush : AbstractBrush +public sealed class SolidColorBrush : AbstractBrush { #region Properties & Fields diff --git a/RGB.NET.Core/Rendering/Brushes/TextureBrush.cs b/RGB.NET.Core/Rendering/Brushes/TextureBrush.cs index 4a2de6e..41280cd 100644 --- a/RGB.NET.Core/Rendering/Brushes/TextureBrush.cs +++ b/RGB.NET.Core/Rendering/Brushes/TextureBrush.cs @@ -4,7 +4,7 @@ /// /// Represents a brush drawing a texture. /// -public class TextureBrush : AbstractBrush +public sealed class TextureBrush : AbstractBrush { #region Properties & Fields diff --git a/RGB.NET.Core/Rendering/Textures/EmptyTexture.cs b/RGB.NET.Core/Rendering/Textures/EmptyTexture.cs index 588b62b..7aca9b7 100644 --- a/RGB.NET.Core/Rendering/Textures/EmptyTexture.cs +++ b/RGB.NET.Core/Rendering/Textures/EmptyTexture.cs @@ -1,6 +1,6 @@ namespace RGB.NET.Core; -internal class EmptyTexture : ITexture +internal sealed class EmptyTexture : ITexture { #region Properties & Fields diff --git a/RGB.NET.Core/Update/CustomUpdateData.cs b/RGB.NET.Core/Update/CustomUpdateData.cs index a657e96..4888cd1 100644 --- a/RGB.NET.Core/Update/CustomUpdateData.cs +++ b/RGB.NET.Core/Update/CustomUpdateData.cs @@ -48,7 +48,7 @@ public interface ICustomUpdateData /// /// Represents a set of custom data, each indexed by a string-key. /// -public class CustomUpdateData : ICustomUpdateData +public sealed class CustomUpdateData : ICustomUpdateData { #region Properties & Fields @@ -92,7 +92,7 @@ public class CustomUpdateData : ICustomUpdateData #endregion } -internal class DefaultCustomUpdateData : ICustomUpdateData +internal sealed class DefaultCustomUpdateData : ICustomUpdateData { #region Constants @@ -120,7 +120,7 @@ internal class DefaultCustomUpdateData : ICustomUpdateData #region Constructors - public DefaultCustomUpdateData(bool flushLeds) + private DefaultCustomUpdateData(bool flushLeds) { this._flushLeds = flushLeds; } diff --git a/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs b/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs index db22aa4..00abcc7 100644 --- a/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs +++ b/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs @@ -157,11 +157,13 @@ public class DeviceUpdateTrigger : AbstractUpdateTrigger, IDeviceUpdateTrigger using (TimerHelper.RequestHighResolutionTimer()) while (!UpdateToken.IsCancellationRequested) if (HasDataEvent.WaitOne(Timeout)) - LastUpdateTime = TimerHelper.Execute(() => OnUpdate(), UpdateFrequency * 1000); + LastUpdateTime = TimerHelper.Execute(TimerExecute, UpdateFrequency * 1000); else if ((HeartbeatTimer > 0) && (LastUpdateTimestamp > 0) && (TimerHelper.GetElapsedTime(LastUpdateTimestamp) > HeartbeatTimer)) OnUpdate(new CustomUpdateData().Heartbeat()); } + private void TimerExecute() => OnUpdate(); + protected override void OnUpdate(CustomUpdateData? updateData = null) { base.OnUpdate(updateData); diff --git a/RGB.NET.Core/Update/Devices/IUpdateQueue.cs b/RGB.NET.Core/Update/Devices/IUpdateQueue.cs index bf4011c..2943379 100644 --- a/RGB.NET.Core/Update/Devices/IUpdateQueue.cs +++ b/RGB.NET.Core/Update/Devices/IUpdateQueue.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; namespace RGB.NET.Core; @@ -21,7 +20,7 @@ public interface IUpdateQueue : IReferenceCounting, IDisposa /// /// The set of data. // ReSharper disable once MemberCanBeProtected.Global - void SetData(IEnumerable<(TIdentifier, TData)> dataSet); + void SetData(ReadOnlySpan<(TIdentifier, TData)> dataSet); /// /// Resets the current data set. diff --git a/RGB.NET.Core/Update/Devices/UpdateQueue.cs b/RGB.NET.Core/Update/Devices/UpdateQueue.cs index 72cec7e..c17e3a9 100644 --- a/RGB.NET.Core/Update/Devices/UpdateQueue.cs +++ b/RGB.NET.Core/Update/Devices/UpdateQueue.cs @@ -1,7 +1,6 @@ using System; using System.Buffers; using System.Collections.Generic; -using System.Linq; namespace RGB.NET.Core; @@ -88,10 +87,9 @@ public abstract class UpdateQueue : AbstractReferenceCountin /// /// The set of data. // ReSharper disable once MemberCanBeProtected.Global - public virtual void SetData(IEnumerable<(TIdentifier, TData)> dataSet) + public virtual void SetData(ReadOnlySpan<(TIdentifier, TData)> data) { - IList<(TIdentifier, TData)> data = dataSet.ToList(); - if (data.Count == 0) return; + if (data.Length == 0) return; lock (_dataLock) { diff --git a/RGB.NET.Core/Update/ManualUpdateTrigger.cs b/RGB.NET.Core/Update/ManualUpdateTrigger.cs index 67e8ca4..5cd4235 100644 --- a/RGB.NET.Core/Update/ManualUpdateTrigger.cs +++ b/RGB.NET.Core/Update/ManualUpdateTrigger.cs @@ -83,12 +83,12 @@ public sealed class ManualUpdateTrigger : AbstractUpdateTrigger OnStartup(); while (!UpdateToken.IsCancellationRequested) - { if (_mutex.WaitOne(100)) - LastUpdateTime = TimerHelper.Execute(() => OnUpdate(_customUpdateData)); - } + LastUpdateTime = TimerHelper.Execute(TimerExecute); } + private void TimerExecute() => OnUpdate(_customUpdateData); + /// public override void Dispose() => Stop(); diff --git a/RGB.NET.Core/Update/TimerUpdateTrigger.cs b/RGB.NET.Core/Update/TimerUpdateTrigger.cs index 14a7e9f..6b94b3f 100644 --- a/RGB.NET.Core/Update/TimerUpdateTrigger.cs +++ b/RGB.NET.Core/Update/TimerUpdateTrigger.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Core; /// /// Represents an update trigger that triggers in a set interval. /// -public class TimerUpdateTrigger : AbstractUpdateTrigger +public sealed class TimerUpdateTrigger : AbstractUpdateTrigger { #region Properties & Fields @@ -21,17 +21,17 @@ public class TimerUpdateTrigger : AbstractUpdateTrigger /// /// Gets or sets the update loop of this trigger. /// - protected Task? UpdateTask { get; set; } + private Task? _updateTask; /// - /// Gets or sets the cancellation token source used to create the cancellation token checked by the . + /// Gets or sets the cancellation token source used to create the cancellation token checked by the . /// - protected CancellationTokenSource? UpdateTokenSource { get; set; } + private CancellationTokenSource? _updateTokenSource; /// - /// Gets or sets the cancellation token checked by the . + /// Gets or sets the cancellation token checked by the . /// - protected CancellationToken UpdateToken { get; set; } + private CancellationToken _updateToken; private double _updateFrequency = 1.0 / 30.0; /// @@ -88,11 +88,11 @@ public class TimerUpdateTrigger : AbstractUpdateTrigger { lock (_lock) { - if (UpdateTask == null) + if (_updateTask == null) { - UpdateTokenSource?.Dispose(); - UpdateTokenSource = new CancellationTokenSource(); - UpdateTask = Task.Factory.StartNew(UpdateLoop, (UpdateToken = UpdateTokenSource.Token), TaskCreationOptions.LongRunning, TaskScheduler.Default); + _updateTokenSource?.Dispose(); + _updateTokenSource = new CancellationTokenSource(); + _updateTask = Task.Factory.StartNew(UpdateLoop, (_updateToken = _updateTokenSource.Token), TaskCreationOptions.LongRunning, TaskScheduler.Default); } } } @@ -104,13 +104,13 @@ public class TimerUpdateTrigger : AbstractUpdateTrigger { lock (_lock) { - if (UpdateTask != null) + if (_updateTask != null) { - UpdateTokenSource?.Cancel(); + _updateTokenSource?.Cancel(); try { // ReSharper disable once MethodSupportsCancellation - UpdateTask.Wait(); + _updateTask.Wait(); } catch (AggregateException) { @@ -118,8 +118,8 @@ public class TimerUpdateTrigger : AbstractUpdateTrigger } finally { - UpdateTask.Dispose(); - UpdateTask = null; + _updateTask.Dispose(); + _updateTask = null; } } } @@ -130,16 +130,16 @@ public class TimerUpdateTrigger : AbstractUpdateTrigger OnStartup(); using (TimerHelper.RequestHighResolutionTimer()) - while (!UpdateToken.IsCancellationRequested) - LastUpdateTime = TimerHelper.Execute(() => OnUpdate(_customUpdateData), UpdateFrequency * 1000); - + while (!_updateToken.IsCancellationRequested) + LastUpdateTime = TimerHelper.Execute(TimerExecute, UpdateFrequency * 1000); } + private void TimerExecute() => OnUpdate(_customUpdateData); + /// public override void Dispose() { Stop(); - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs index f9af5b3..318850e 100644 --- a/RGB.NET.Devices.Asus/AsusDeviceProvider.cs +++ b/RGB.NET.Devices.Asus/AsusDeviceProvider.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.Asus; /// /// Represents a device provider responsible for Cooler Master devices. /// -public class AsusDeviceProvider : AbstractRGBDeviceProvider +public sealed class AsusDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields @@ -88,8 +88,6 @@ public class AsusDeviceProvider : AbstractRGBDeviceProvider _devices = null; _sdk = null; - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs b/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs index bb40578..fe3c238 100644 --- a/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus; /// /// Represents a Asus headset. /// -public class AsusUnspecifiedRGBDevice : AsusRGBDevice, IUnknownDevice +public sealed class AsusUnspecifiedRGBDevice : AsusRGBDevice, IUnknownDevice { #region Properties & Fields diff --git a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs index 012ed7e..2f40ec6 100644 --- a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs +++ b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Asus; /// /// Represents the update-queue performing updates for asus devices. /// -public class AsusUpdateQueue : UpdateQueue +public sealed class AsusUpdateQueue : UpdateQueue { #region Properties & Fields @@ -17,7 +17,7 @@ public class AsusUpdateQueue : UpdateQueue /// /// The device to be updated. /// - protected IAuraSyncDevice Device { get; } + private readonly IAuraSyncDevice _device; #endregion @@ -31,7 +31,7 @@ public class AsusUpdateQueue : UpdateQueue public AsusUpdateQueue(IDeviceUpdateTrigger updateTrigger, IAuraSyncDevice device) : base(updateTrigger) { - this.Device = device; + this._device = device; this._lights = new IAuraRgbLight[device.Lights.Count]; for (int i = 0; i < device.Lights.Count; i++) @@ -47,9 +47,9 @@ public class AsusUpdateQueue : UpdateQueue { try { - if ((Device.Type == (uint)AsusDeviceType.KEYBOARD_RGB) || (Device.Type == (uint)AsusDeviceType.NB_KB_RGB)) + if ((_device.Type == (uint)AsusDeviceType.KEYBOARD_RGB) || (_device.Type == (uint)AsusDeviceType.NB_KB_RGB)) { - if (Device is not IAuraSyncKeyboard keyboard) + if (_device is not IAuraSyncKeyboard keyboard) return true; foreach ((object customData, Color value) in dataSet) @@ -87,7 +87,7 @@ public class AsusUpdateQueue : UpdateQueue } } - Device.Apply(); + _device.Apply(); return true; } diff --git a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs index 15c2383..1debf59 100644 --- a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus; /// /// Represents a Asus graphicsCard. /// -public class AsusGraphicsCardRGBDevice : AsusRGBDevice, IGraphicsCard +public sealed class AsusGraphicsCardRGBDevice : AsusRGBDevice, IGraphicsCard { #region Constructors diff --git a/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs b/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs index 71f9e10..516dab6 100644 --- a/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus; /// /// Represents a Asus headset. /// -public class AsusHeadsetRGBDevice : AsusRGBDevice, IHeadset +public sealed class AsusHeadsetRGBDevice : AsusRGBDevice, IHeadset { #region Constructors diff --git a/RGB.NET.Devices.Asus/Helper/WMIHelper.cs b/RGB.NET.Devices.Asus/Helper/WMIHelper.cs index 5aa49c7..482f3a3 100644 --- a/RGB.NET.Devices.Asus/Helper/WMIHelper.cs +++ b/RGB.NET.Devices.Asus/Helper/WMIHelper.cs @@ -43,7 +43,7 @@ internal static class WMIHelper if ((_systemModelInfo == null) && (_systemModelSearcher != null)) foreach (ManagementBaseObject managementBaseObject in _systemModelSearcher.Get()) { - _systemModelInfo = managementBaseObject["Model"]?.ToString(); + _systemModelInfo = managementBaseObject["Model"].ToString(); break; } @@ -57,7 +57,7 @@ internal static class WMIHelper if (!_mainboardInfo.HasValue && (_mainboardSearcher != null)) foreach (ManagementBaseObject managementBaseObject in _mainboardSearcher.Get()) { - _mainboardInfo = (managementBaseObject["Manufacturer"]?.ToString() ?? string.Empty, managementBaseObject["Product"]?.ToString() ?? string.Empty); + _mainboardInfo = (managementBaseObject["Manufacturer"].ToString() ?? string.Empty, managementBaseObject["Product"].ToString() ?? string.Empty); break; } @@ -71,7 +71,7 @@ internal static class WMIHelper if ((_graphicsCardInfo == null) && (_graphicsCardSearcher != null)) foreach (ManagementBaseObject managementBaseObject in _graphicsCardSearcher.Get()) { - _graphicsCardInfo = managementBaseObject["Name"]?.ToString(); + _graphicsCardInfo = managementBaseObject["Name"].ToString(); break; } diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs index 86f64aa..30b429c 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs @@ -20,7 +20,7 @@ public record AsusKeyboardExtraMapping(Regex Regex, LedMapping LedMapping); /// /// Represents a Asus keyboard. /// -public class AsusKeyboardRGBDevice : AsusRGBDevice, IKeyboard +public sealed class AsusKeyboardRGBDevice : AsusRGBDevice, IKeyboard { #region Properties & Fields diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs index 4173271..b40ec59 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Asus; /// /// Represents a generic information for a . /// -public class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDeviceInfo +public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs index 2f92bb6..137ae90 100644 --- a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus; /// /// Represents a Asus mainboard. /// -public class AsusMainboardRGBDevice : AsusRGBDevice, IMainboard +public sealed class AsusMainboardRGBDevice : AsusRGBDevice, IMainboard { #region Constructors diff --git a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs index 3db166a..e4ae049 100644 --- a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus; /// /// Represents a Asus mouse. /// -public class AsusMouseRGBDevice : AsusRGBDevice, IMouse +public sealed class AsusMouseRGBDevice : AsusRGBDevice, IMouse { #region Constructors diff --git a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj index b4ac280..dc67689 100644 --- a/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj +++ b/RGB.NET.Devices.Asus/RGB.NET.Devices.Asus.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE @@ -57,21 +57,7 @@ - - - - - <_PackageFiles Include="$(OutputPath)\net6.0\Interop.AuraServiceLib.dll"> - None - lib\net6.0\ - - - - - <_PackageFiles Include="$(OutputPath)\net5.0\Interop.AuraServiceLib.dll"> - None - lib\net5.0\ - + diff --git a/RGB.NET.Devices.CoolerMaster/Attributes/DeviceTypeAttribute.cs b/RGB.NET.Devices.CoolerMaster/Attributes/DeviceTypeAttribute.cs index 8aad300..07245cb 100644 --- a/RGB.NET.Devices.CoolerMaster/Attributes/DeviceTypeAttribute.cs +++ b/RGB.NET.Devices.CoolerMaster/Attributes/DeviceTypeAttribute.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.CoolerMaster; /// Specifies the of a field. /// [AttributeUsage(AttributeTargets.Field)] -public class DeviceTypeAttribute : Attribute +public sealed class DeviceTypeAttribute : Attribute { #region Properties & Fields diff --git a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs b/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs index e51ed8a..ab16a45 100644 --- a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs +++ b/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Devices.CoolerMaster; /// /// Represents a device provider responsible for Cooler Master devices. /// -public class CoolerMasterDeviceProvider : AbstractRGBDeviceProvider +public sealed class CoolerMasterDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields @@ -100,8 +100,6 @@ public class CoolerMasterDeviceProvider : AbstractRGBDeviceProvider try { _CoolerMasterSDK.Reload(); } catch { /* Unlucky.. */ } - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterDevicesIndexes.cs b/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterDevicesIndexes.cs index f528ccf..66eb53b 100644 --- a/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterDevicesIndexes.cs +++ b/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterDevicesIndexes.cs @@ -4,8 +4,6 @@ using System.ComponentModel; using RGB.NET.Core; -#pragma warning disable 1591 // Missing XML comment for publicly visible type or member - namespace RGB.NET.Devices.CoolerMaster; /// diff --git a/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterEffects.cs b/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterEffects.cs deleted file mode 100644 index b9fcaa1..0000000 --- a/RGB.NET.Devices.CoolerMaster/Enum/CoolerMasterEffects.cs +++ /dev/null @@ -1,40 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable UnusedMember.Global - -#pragma warning disable 1591 // Missing XML comment for publicly visible type or member - -namespace RGB.NET.Devices.CoolerMaster; - -/// -/// Contains a list of available effects. -/// -public enum CoolerMasterEffects -{ - FullOn = 0, - Breath = 1, - BreathCycle = 2, - Single = 3, - Wave = 4, - Ripple = 5, - Cross = 6, - Rain = 7, - Star = 8, - Snake = 9, - Rec = 10, - - Spectrum = 11, - RapidFire = 12, - Indicator = 13, //mouse Effect - FireBall = 14, - WaterRipple = 15, - ReactivePunch = 16, - Snowing = 17, - HeartBeat = 18, - ReactiveTornade = 19, - - Multi1 = 0xE0, - Multi2 = 0xE1, - Multi3 = 0xE2, - Multi4 = 0xE3, - Off = 0xFE -} \ No newline at end of file diff --git a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs index 4121c4f..99e1428 100644 --- a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs +++ b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.CoolerMaster; /// /// Represents the update-queue performing updates for cooler master devices. /// -public class CoolerMasterUpdateQueue : UpdateQueue +public sealed class CoolerMasterUpdateQueue : UpdateQueue { #region Properties & Fields diff --git a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs index 29b1e3c..1d03191 100644 --- a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.CoolerMaster; /// /// Represents a CoolerMaster keyboard. /// -public class CoolerMasterKeyboardRGBDevice : CoolerMasterRGBDevice, IKeyboard +public sealed class CoolerMasterKeyboardRGBDevice : CoolerMasterRGBDevice, IKeyboard { #region Properties & Fields diff --git a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDeviceInfo.cs index df9fec9..591a62f 100644 --- a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDeviceInfo.cs @@ -5,7 +5,7 @@ namespace RGB.NET.Devices.CoolerMaster; /// /// Represents a generic information for a . /// -public class CoolerMasterKeyboardRGBDeviceInfo : CoolerMasterRGBDeviceInfo, IKeyboardDeviceInfo +public sealed class CoolerMasterKeyboardRGBDeviceInfo : CoolerMasterRGBDeviceInfo, IKeyboardDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs index 16ba91c..53e4522 100644 --- a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs +++ b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.CoolerMaster; /// /// Represents a CoolerMaster mouse. /// -public class CoolerMasterMouseRGBDevice : CoolerMasterRGBDevice, IMouse +public sealed class CoolerMasterMouseRGBDevice : CoolerMasterRGBDevice, IMouse { #region Constructors diff --git a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDeviceInfo.cs b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDeviceInfo.cs index 14f6b0e..2698216 100644 --- a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDeviceInfo.cs +++ b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDeviceInfo.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.CoolerMaster; /// /// Represents a generic information for a . /// -public class CoolerMasterMouseRGBDeviceInfo : CoolerMasterRGBDeviceInfo +public sealed class CoolerMasterMouseRGBDeviceInfo : CoolerMasterRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj index d4812ed..2adfaa5 100644 --- a/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj +++ b/RGB.NET.Devices.CoolerMaster/RGB.NET.Devices.CoolerMaster.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDevice.cs b/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDevice.cs index fd5b89b..e92a731 100644 --- a/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair cooler. /// -public class CorsairCoolerRGBDevice : CorsairRGBDevice, ICooler +public sealed class CorsairCoolerRGBDevice : CorsairRGBDevice, ICooler { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDeviceInfo.cs index 958f129..96333b4 100644 --- a/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDeviceInfo.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairCoolerRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairCoolerRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs b/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs index ac363b9..87ab725 100644 --- a/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs +++ b/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a device provider responsible for corsair (CUE) devices. /// -public class CorsairDeviceProvider : AbstractRGBDeviceProvider +public sealed class CorsairDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields @@ -306,8 +306,6 @@ public class CorsairDeviceProvider : AbstractRGBDeviceProvider try { _CUESDK.CorsairDisconnect(); } catch { /* at least we tried */ } try { _CUESDK.UnloadCUESDK(); } catch { /* at least we tried */ } - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairLedGroup.cs b/RGB.NET.Devices.Corsair/Enum/CorsairLedGroup.cs index 7281323..3ec299d 100644 --- a/RGB.NET.Devices.Corsair/Enum/CorsairLedGroup.cs +++ b/RGB.NET.Devices.Corsair/Enum/CorsairLedGroup.cs @@ -1,4 +1,6 @@ -namespace RGB.NET.Devices.Corsair; +// ReSharper disable InconsistentNaming + +namespace RGB.NET.Devices.Corsair; /// /// iCUE-SDK: contains a list of led groups. Led group is used as a part of led identifier diff --git a/RGB.NET.Devices.Corsair/Exceptions/CUEException.cs b/RGB.NET.Devices.Corsair/Exceptions/CUEException.cs index aca2994..902860f 100644 --- a/RGB.NET.Devices.Corsair/Exceptions/CUEException.cs +++ b/RGB.NET.Devices.Corsair/Exceptions/CUEException.cs @@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents an exception thrown by the CUE. /// -public class CUEException : ApplicationException +public sealed class CUEException : ApplicationException { #region Properties & Fields diff --git a/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDevice.cs b/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDevice.cs index 6520081..eb91492 100644 --- a/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair fan. /// -public class CorsairFanRGBDevice : CorsairRGBDevice, IFan +public sealed class CorsairFanRGBDevice : CorsairRGBDevice, IFan { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDeviceInfo.cs index f4973c5..35124d0 100644 --- a/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDeviceInfo.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairFanRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairFanRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs b/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs index 8bea2eb..be3a3bf 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs @@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents the update-queue performing updates for corsair devices. /// -public class CorsairDeviceUpdateQueue : UpdateQueue +public sealed class CorsairDeviceUpdateQueue : UpdateQueue { #region Properties & Fields @@ -76,8 +76,6 @@ public class CorsairDeviceUpdateQueue : UpdateQueue _isDisposed = true; Marshal.FreeHGlobal(_colorPtr); - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs b/RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs index 7069776..afca46b 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents version information for the Corsair-SDK /// -public class CorsairSessionDetails +public sealed class CorsairSessionDetails { #region Properties & Fields diff --git a/RGB.NET.Devices.Corsair/Generic/LedMappings.cs b/RGB.NET.Devices.Corsair/Generic/LedMappings.cs index 8166070..ffbfa0f 100644 --- a/RGB.NET.Devices.Corsair/Generic/LedMappings.cs +++ b/RGB.NET.Devices.Corsair/Generic/LedMappings.cs @@ -11,6 +11,7 @@ internal static class LedMappings { #region Constants + // ReSharper disable once InconsistentNaming private static LedMapping KEYBOARD_MAPPING => new() { { LedId.Invalid, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Invalid) }, diff --git a/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDevice.cs index ce7fb8c..51aa88a 100644 --- a/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair graphics card. /// -public class CorsairGraphicsCardRGBDevice : CorsairRGBDevice, IGraphicsCard +public sealed class CorsairGraphicsCardRGBDevice : CorsairRGBDevice, IGraphicsCard { #region Constructors diff --git a/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDeviceInfo.cs index ec5b436..7c57ff0 100644 --- a/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDeviceInfo.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairGraphicsCardRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairGraphicsCardRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs index c2336d6..1cbd113 100644 --- a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair headset. /// -public class CorsairHeadsetRGBDevice : CorsairRGBDevice, IHeadset +public sealed class CorsairHeadsetRGBDevice : CorsairRGBDevice, IHeadset { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs index 5bac705..c7de7f9 100644 --- a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairHeadsetRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairHeadsetRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs index 7103b76..5d79725 100644 --- a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair headset stand. /// -public class CorsairHeadsetStandRGBDevice : CorsairRGBDevice, IHeadsetStand +public sealed class CorsairHeadsetStandRGBDevice : CorsairRGBDevice, IHeadsetStand { #region Constructors diff --git a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs index cc6b274..48b2049 100644 --- a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairHeadsetStandRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairHeadsetStandRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs index d1fa931..5133619 100644 --- a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair keyboard. /// -public class CorsairKeyboardRGBDevice : CorsairRGBDevice, IKeyboard +public sealed class CorsairKeyboardRGBDevice : CorsairRGBDevice, IKeyboard { #region Properties & Fields diff --git a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs index dcab088..8f5774c 100644 --- a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs @@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairKeyboardRGBDeviceInfo : CorsairRGBDeviceInfo, IKeyboardDeviceInfo +public sealed class CorsairKeyboardRGBDeviceInfo : CorsairRGBDeviceInfo, IKeyboardDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripGBDevice.cs b/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripGBDevice.cs index 53eb5b0..9f46411 100644 --- a/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripGBDevice.cs +++ b/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair ledStrip. /// -public class CorsairLedStripRGBDevice : CorsairRGBDevice, ILedStripe +public sealed class CorsairLedStripRGBDevice : CorsairRGBDevice, ILedStripe { #region Constructors diff --git a/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripRGBDeviceInfo.cs index 35006b8..a6497ac 100644 --- a/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripRGBDeviceInfo.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairLedStripRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairLedStripRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDevice.cs b/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDevice.cs index 55ab92c..98c02e1 100644 --- a/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair memory. /// -public class CorsairMainboardRGBDevice : CorsairRGBDevice, IMainboard +public sealed class CorsairMainboardRGBDevice : CorsairRGBDevice, IMainboard { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDeviceInfo.cs index 4058d10..761f951 100644 --- a/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDeviceInfo.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairMainboardRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairMainboardRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs index 48b2eb3..ec35a34 100644 --- a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair memory. /// -public class CorsairMemoryRGBDevice : CorsairRGBDevice, IDRAM +public sealed class CorsairMemoryRGBDevice : CorsairRGBDevice, IDRAM { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs index 8d779f7..326bd80 100644 --- a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairMemoryRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairMemoryRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs index 89f25c4..4f66d31 100644 --- a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair mouse. /// -public class CorsairMouseRGBDevice : CorsairRGBDevice, IMouse +public sealed class CorsairMouseRGBDevice : CorsairRGBDevice, IMouse { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs index 422b18a..b5ab17d 100644 --- a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairMouseRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairMouseRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs index ac7a9b3..7c005ea 100644 --- a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair mousepad. /// -public class CorsairMousepadRGBDevice : CorsairRGBDevice, IMousepad +public sealed class CorsairMousepadRGBDevice : CorsairRGBDevice, IMousepad { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs index 6b469c0..901f54f 100644 --- a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairMousepadRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairMousepadRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs index d3593ee..00d9f92 100644 --- a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs +++ b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs @@ -91,11 +91,7 @@ internal static unsafe class _CUESDK if (dllPath == null) throw new RGBDeviceException($"Can't find the CUE-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'"); if (!NativeLibrary.TryLoad(dllPath, out _handle)) -#if NET6_0_OR_GREATER throw new RGBDeviceException($"Corsair LoadLibrary failed with error code {Marshal.GetLastPInvokeError()}"); -#else - throw new RGBDeviceException($"Corsair LoadLibrary failed with error code {Marshal.GetLastWin32Error()}"); -#endif _corsairConnectPtr = (delegate* unmanaged[Cdecl])LoadFunction("CorsairConnect"); _corsairGetSessionDetails = (delegate* unmanaged[Cdecl])LoadFunction("CorsairGetSessionDetails"); diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairDeviceFilter.cs b/RGB.NET.Devices.Corsair/Native/_CorsairDeviceFilter.cs index 76f179d..f598d27 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairDeviceFilter.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairDeviceFilter.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.Corsair.Native; /// iCUE-SDK: contains device search filter /// [StructLayout(LayoutKind.Sequential)] -internal class _CorsairDeviceFilter +internal sealed class _CorsairDeviceFilter { #region Properties & Fields diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairDeviceInfo.cs b/RGB.NET.Devices.Corsair/Native/_CorsairDeviceInfo.cs index f122879..b4c8813 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairDeviceInfo.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.Corsair.Native; /// iCUE-SDK: contains information about device /// [StructLayout(LayoutKind.Sequential)] -internal class _CorsairDeviceInfo +internal sealed class _CorsairDeviceInfo { /// /// iCUE-SDK: enum describing device type diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairLedPosition.cs b/RGB.NET.Devices.Corsair/Native/_CorsairLedPosition.cs index b2ff0fe..af2bad1 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairLedPosition.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairLedPosition.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair.Native; /// iCUE-SDK: contains led id and position of led /// [StructLayout(LayoutKind.Sequential)] -internal class _CorsairLedPosition +internal sealed class _CorsairLedPosition { /// /// iCUE-SDK: unique identifier of led diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairSessionDetails.cs b/RGB.NET.Devices.Corsair/Native/_CorsairSessionDetails.cs index 392a30b..2fbf755 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairSessionDetails.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairSessionDetails.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair.Native; /// iCUE-SDK: contains information about SDK and iCUE versions /// [StructLayout(LayoutKind.Sequential)] -internal class _CorsairSessionDetails +internal sealed class _CorsairSessionDetails { /// /// iCUE-SDK: version of SDK client (like {4,0,1}). Always contains valid value even if there was no iCUE found. Must comply with the semantic versioning rules. diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairSessionStateChanged.cs b/RGB.NET.Devices.Corsair/Native/_CorsairSessionStateChanged.cs index 99aa8fd..07b1a38 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairSessionStateChanged.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairSessionStateChanged.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair.Native; /// iCUE-SDK: contains information about session state and client/server versions /// [StructLayout(LayoutKind.Sequential)] -internal class _CorsairSessionStateChanged +internal sealed class _CorsairSessionStateChanged { /// /// iCUE-SDK: new session state which SDK client has been transitioned to diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairVersion.cs b/RGB.NET.Devices.Corsair/Native/_CorsairVersion.cs index 790226e..d786b0f 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairVersion.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairVersion.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair.Native; /// iCUE-SDK: contains information about version that consists of three components /// [StructLayout(LayoutKind.Sequential)] -internal class _CorsairVersion +internal sealed class _CorsairVersion { #region Properties & Fields diff --git a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj index 302d93d..ccb143e 100644 --- a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj +++ b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -41,7 +41,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -49,7 +49,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDevice.cs b/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDevice.cs index d704343..d5f9248 100644 --- a/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair touchbar. /// -public class CorsairTouchbarRGBDevice : CorsairRGBDevice, ILedStripe +public sealed class CorsairTouchbarRGBDevice : CorsairRGBDevice, ILedStripe { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDeviceInfo.cs index 68ea4f0..04f400d 100644 --- a/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDeviceInfo.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairTouchbarRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairTouchbarRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDevice.cs b/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDevice.cs index d860336..655bafc 100644 --- a/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a unknown corsair device. /// -public class CorsairUnknownRGBDevice : CorsairRGBDevice, IUnknownDevice +public sealed class CorsairUnknownRGBDevice : CorsairRGBDevice, IUnknownDevice { #region Constructors diff --git a/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDeviceInfo.cs index e9b6da5..770f65b 100644 --- a/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDeviceInfo.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a generic information for a . /// -public class CorsairUnknownRGBDeviceInfo : CorsairRGBDeviceInfo +public sealed class CorsairUnknownRGBDeviceInfo : CorsairRGBDeviceInfo { #region Constructors diff --git a/RGB.NET.Devices.DMX/DMXDeviceProvider.cs b/RGB.NET.Devices.DMX/DMXDeviceProvider.cs index 55e8e3f..2d85a44 100644 --- a/RGB.NET.Devices.DMX/DMXDeviceProvider.cs +++ b/RGB.NET.Devices.DMX/DMXDeviceProvider.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.DMX; /// /// Represents a device provider responsible for DMX devices. /// -public class DMXDeviceProvider : AbstractRGBDeviceProvider +public sealed class DMXDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields diff --git a/RGB.NET.Devices.DMX/E131/E131DMXDeviceDefinition.cs b/RGB.NET.Devices.DMX/E131/E131DMXDeviceDefinition.cs index 37db5ea..8e0934b 100644 --- a/RGB.NET.Devices.DMX/E131/E131DMXDeviceDefinition.cs +++ b/RGB.NET.Devices.DMX/E131/E131DMXDeviceDefinition.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.DMX.E131; /// /// Represents the data used to create a E1.31 DMX-device. /// -public class E131DMXDeviceDefinition : IDMXDeviceDefinition +public sealed class E131DMXDeviceDefinition : IDMXDeviceDefinition { #region Properties & Fields diff --git a/RGB.NET.Devices.DMX/E131/E131Device.cs b/RGB.NET.Devices.DMX/E131/E131Device.cs index a7d3473..5955ddb 100644 --- a/RGB.NET.Devices.DMX/E131/E131Device.cs +++ b/RGB.NET.Devices.DMX/E131/E131Device.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.DMX.E131; /// /// Represents a E1.31-DXM-device. /// -public class E131Device : AbstractRGBDevice, IUnknownDevice +public sealed class E131Device : AbstractRGBDevice, IUnknownDevice { #region Properties & Fields diff --git a/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs b/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs index 330a740..db805f7 100644 --- a/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs +++ b/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.DMX.E131; /// /// Represents device information for a />. /// -public class E131DeviceInfo : IRGBDeviceInfo +public sealed class E131DeviceInfo : IRGBDeviceInfo { #region Constants diff --git a/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs b/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs index 57159e9..7ebdab8 100644 --- a/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs +++ b/RGB.NET.Devices.DMX/E131/E131UpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.DMX.E131; /// /// Represents the update-queue performing updates for E131-DMX devices. /// -public class E131UpdateQueue : UpdateQueue +public sealed class E131UpdateQueue : UpdateQueue { #region Properties & Fields diff --git a/RGB.NET.Devices.DMX/Generic/LedChannelMapping.cs b/RGB.NET.Devices.DMX/Generic/LedChannelMapping.cs index 2f999e3..aa1aa29 100644 --- a/RGB.NET.Devices.DMX/Generic/LedChannelMapping.cs +++ b/RGB.NET.Devices.DMX/Generic/LedChannelMapping.cs @@ -5,7 +5,7 @@ using RGB.NET.Core; namespace RGB.NET.Devices.DMX; -internal class LedChannelMapping : IEnumerable<(int channel, Func getValue)> +internal sealed class LedChannelMapping : IEnumerable<(int channel, Func getValue)> { #region Properties & Fields diff --git a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj index d291aa0..e6e876e 100644 --- a/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj +++ b/RGB.NET.Devices.DMX/RGB.NET.Devices.DMX.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.Debug/DebugDeviceProvider.cs b/RGB.NET.Devices.Debug/DebugDeviceProvider.cs index d396bc0..f88ad50 100644 --- a/RGB.NET.Devices.Debug/DebugDeviceProvider.cs +++ b/RGB.NET.Devices.Debug/DebugDeviceProvider.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.Debug; /// /// Represents a device provider responsible for debug devices. /// -public class DebugDeviceProvider : AbstractRGBDeviceProvider +public sealed class DebugDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields @@ -71,8 +71,6 @@ public class DebugDeviceProvider : AbstractRGBDeviceProvider base.Dispose(); _fakeDeviceDefinitions.Clear(); - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs b/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs index 1e00c42..2789821 100644 --- a/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Debug/DebugDeviceUpdateQueue.cs @@ -3,7 +3,7 @@ using RGB.NET.Core; namespace RGB.NET.Devices.Debug; -internal class DebugDeviceUpdateQueue : UpdateQueue +internal sealed class DebugDeviceUpdateQueue : UpdateQueue { #region Constructors diff --git a/RGB.NET.Devices.Debug/DebugRGBDevice.cs b/RGB.NET.Devices.Debug/DebugRGBDevice.cs index 35d1765..61296ab 100644 --- a/RGB.NET.Devices.Debug/DebugRGBDevice.cs +++ b/RGB.NET.Devices.Debug/DebugRGBDevice.cs @@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Debug; /// /// Represents a debug device. /// -public class DebugRGBDevice : AbstractRGBDevice, IUnknownDevice +public sealed class DebugRGBDevice : AbstractRGBDevice, IUnknownDevice { #region Properties & Fields diff --git a/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs b/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs index d724e36..43e3c64 100644 --- a/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Debug; /// /// Represents device information for a />. /// -public class DebugRGBDeviceInfo : IRGBDeviceInfo +public sealed class DebugRGBDeviceInfo : IRGBDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj index f4edaae..980153c 100644 --- a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj +++ b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs b/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs index 69cdce1..355e457 100644 --- a/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs +++ b/RGB.NET.Devices.Logitech/HID/LightspeedHidLoader.cs @@ -14,7 +14,7 @@ namespace RGB.NET.Devices.Logitech.HID; /// /// The type of the identifier leds are mapped to. /// The type of the custom data added to the HID-device. -public class LightspeedHIDLoader : IEnumerable> +public sealed class LightspeedHIDLoader : IEnumerable> where TLed : notnull { #region Constants diff --git a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs index 9fdbc79..6a31dad 100644 --- a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs +++ b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; -using System.Linq; -using RGB.NET.Core; +using RGB.NET.Core; namespace RGB.NET.Devices.Logitech; @@ -8,7 +6,7 @@ namespace RGB.NET.Devices.Logitech; /// /// Represents a logitech per-device-lightable device. /// -public class LogitechPerDeviceRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated +public sealed class LogitechPerDeviceRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated { #region Properties & Fields @@ -42,8 +40,5 @@ public class LogitechPerDeviceRGBDevice : LogitechRGBDevice protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId]; - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate.Take(1))); - #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs index c32f87d..b780a28 100644 --- a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Logitech; /// /// Represents the update-queue performing updates for logitech per-device devices. /// -public class LogitechPerDeviceUpdateQueue : UpdateQueue +public sealed class LogitechPerDeviceUpdateQueue : UpdateQueue { #region Constructors diff --git a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs index 933603f..edd3d95 100644 --- a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs +++ b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using RGB.NET.Core; +using RGB.NET.Core; namespace RGB.NET.Devices.Logitech; @@ -7,7 +6,7 @@ namespace RGB.NET.Devices.Logitech; /// /// Represents a logitech per-key-lightable device. /// -public class LogitechPerKeyRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated +public sealed class LogitechPerKeyRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated { #region Properties & Fields @@ -33,9 +32,6 @@ public class LogitechPerKeyRGBDevice : LogitechRGBDevice, /// protected override object GetLedCustomData(LedId ledId) => _ledMapping.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : -1; - - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); - + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs index b0bdaf4..7f1917f 100644 --- a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs +++ b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyUpdateQueue.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Logitech; /// /// Represents the update-queue performing updates for logitech per-key devices. /// -public class LogitechPerKeyUpdateQueue : UpdateQueue +public sealed class LogitechPerKeyUpdateQueue : UpdateQueue { #region Constructors @@ -17,8 +17,7 @@ public class LogitechPerKeyUpdateQueue : UpdateQueue /// The update trigger used by this queue. public LogitechPerKeyUpdateQueue(IDeviceUpdateTrigger updateTrigger) : base(updateTrigger) - { - } + { } #endregion diff --git a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj index 7ee22dd..fd412e7 100644 --- a/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj +++ b/RGB.NET.Devices.Logitech/RGB.NET.Devices.Logitech.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -41,7 +41,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -49,7 +49,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs b/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs index 8820834..d1050fd 100644 --- a/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs +++ b/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using RGB.NET.Core; +using RGB.NET.Core; namespace RGB.NET.Devices.Logitech; @@ -7,7 +6,7 @@ namespace RGB.NET.Devices.Logitech; /// /// Represents a logitech zone-lightable device. /// -public class LogitechZoneRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated +public sealed class LogitechZoneRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated { #region Properties & Fields @@ -41,8 +40,5 @@ public class LogitechZoneRGBDevice : LogitechRGBDevice, I /// protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId]; - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); - #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs b/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs index eba7a2d..c9a83a5 100644 --- a/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs +++ b/RGB.NET.Devices.Logitech/Zone/LogitechZoneUpdateQueue.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Logitech; /// /// Represents the update-queue performing updates for logitech zone devices. /// -public class LogitechZoneUpdateQueue : UpdateQueue +public sealed class LogitechZoneUpdateQueue : UpdateQueue { #region Properties & Fields diff --git a/RGB.NET.Devices.Msi/Exceptions/MysticLightException.cs b/RGB.NET.Devices.Msi/Exceptions/MysticLightException.cs index cf688e1..57044fb 100644 --- a/RGB.NET.Devices.Msi/Exceptions/MysticLightException.cs +++ b/RGB.NET.Devices.Msi/Exceptions/MysticLightException.cs @@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Msi.Exceptions; /// /// Represents an exception thrown by the MysticLight-SDK. /// -public class MysticLightException : ApplicationException +public sealed class MysticLightException : ApplicationException { #region Properties & Fields diff --git a/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs b/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs index 8db204f..0367029 100644 --- a/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Msi/Generic/MsiDeviceUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Msi; /// /// Represents the update-queue performing updates for MSI devices. /// -public class MsiDeviceUpdateQueue : UpdateQueue +public sealed class MsiDeviceUpdateQueue : UpdateQueue { #region Properties & Fields diff --git a/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs index a4d72f1..efb72f6 100644 --- a/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs +++ b/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Msi; /// /// Represents MSI VGA adapters. /// -public class MsiGraphicsCardRGBDevice : MsiRGBDevice, IGraphicsCard +public sealed class MsiGraphicsCardRGBDevice : MsiRGBDevice, IGraphicsCard { #region Constructors diff --git a/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs b/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs index 113d364..2367678 100644 --- a/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs +++ b/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Msi; /// /// Represents a MSI mainboard. /// -public class MsiMainboardRGBDevice : MsiRGBDevice, IMainboard +public sealed class MsiMainboardRGBDevice : MsiRGBDevice, IMainboard { #region Constructors diff --git a/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs b/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs index fc9adc8..5ebc73c 100644 --- a/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs +++ b/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Msi; /// /// Represents a MSI mouse. /// -public class MsiMouseRGBDevice : MsiRGBDevice +public sealed class MsiMouseRGBDevice : MsiRGBDevice { #region Constructors diff --git a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj index c565c94..7d604a6 100644 --- a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj +++ b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.Novation/Attributes/ColorCapabilityAttribute.cs b/RGB.NET.Devices.Novation/Attributes/ColorCapabilityAttribute.cs index d2c0a00..9d2131b 100644 --- a/RGB.NET.Devices.Novation/Attributes/ColorCapabilityAttribute.cs +++ b/RGB.NET.Devices.Novation/Attributes/ColorCapabilityAttribute.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Novation.Attributes; /// Specifies the color-capability of a field. /// [AttributeUsage(AttributeTargets.Field)] -public class ColorCapabilityAttribute : Attribute +public sealed class ColorCapabilityAttribute : Attribute { #region Properties & Fields diff --git a/RGB.NET.Devices.Novation/Attributes/DeviceIdAttribute.cs b/RGB.NET.Devices.Novation/Attributes/DeviceIdAttribute.cs index 34c8b2e..ee25485 100644 --- a/RGB.NET.Devices.Novation/Attributes/DeviceIdAttribute.cs +++ b/RGB.NET.Devices.Novation/Attributes/DeviceIdAttribute.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Novation.Attributes; /// Specifies the device-id of a field. /// [AttributeUsage(AttributeTargets.Field)] -public class DeviceIdAttribute : Attribute +public sealed class DeviceIdAttribute : Attribute { #region Properties & Fields diff --git a/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs b/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs index 1e5ac21..14e22e1 100644 --- a/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs +++ b/RGB.NET.Devices.Novation/Attributes/LedIdMappingAttribute.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Novation.Attributes; /// Specifies the led id mapping of a field. /// [AttributeUsage(AttributeTargets.Field)] -internal class LedIdMappingAttribute : Attribute +internal sealed class LedIdMappingAttribute : Attribute { #region Properties & Fields diff --git a/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs index 9bb0bbe..987b691 100644 --- a/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs +++ b/RGB.NET.Devices.Novation/Generic/LimitedColorUpdateQueue.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Novation; /// /// Represents the update-queue performing updates for a limited-color novation device. /// -public class LimitedColorUpdateQueue : MidiUpdateQueue +public sealed class LimitedColorUpdateQueue : MidiUpdateQueue { #region Constructors @@ -37,7 +37,7 @@ public class LimitedColorUpdateQueue : MidiUpdateQueue /// /// The to convert. /// The novation-representation of the . - protected virtual int ConvertColor(in Color color) + private static int ConvertColor(in Color color) { (double hue, double _, double value) = color.GetHSV(); diff --git a/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs b/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs index b64c72a..7a8f2eb 100644 --- a/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs +++ b/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using RGB.NET.Core; namespace RGB.NET.Devices.Novation; @@ -34,9 +33,6 @@ public abstract class NovationRGBDevice : AbstractRGBDevice throw new ArgumentOutOfRangeException() }; - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); - /// /// Resets the back to default. /// diff --git a/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs b/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs index 5a3367a..6279593 100644 --- a/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs +++ b/RGB.NET.Devices.Novation/Generic/RGBColorUpdateQueue.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Novation; /// /// Represents the update-queue performing updates for a RGB-color novation device. /// -public class RGBColorUpdateQueue : MidiUpdateQueue +public sealed class RGBColorUpdateQueue : MidiUpdateQueue { #region Properties & Fields @@ -165,7 +165,7 @@ public class RGBColorUpdateQueue : MidiUpdateQueue /// /// The to convert. /// The novation-representation of the . - protected virtual int ConvertColor(in Color color) + private static int ConvertColor(in Color color) { int bestVelocity = 0; double bestMatchDistance = double.MaxValue; diff --git a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs index 81e5dce..0a5b6e1 100644 --- a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs +++ b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Novation; /// /// Represents a Novation launchpad. /// -public class NovationLaunchpadRGBDevice : NovationRGBDevice, ILedMatrix +public sealed class NovationLaunchpadRGBDevice : NovationRGBDevice, ILedMatrix { #region Constructors @@ -50,7 +50,7 @@ public class NovationLaunchpadRGBDevice : NovationRGBDevice /// The mapping of the device. /// Thrown if the value of is not known. - protected virtual Dictionary GetDeviceMapping() + private Dictionary GetDeviceMapping() => DeviceInfo.LedMapping switch { LedIdMappings.Current => LaunchpadIdMapping.CURRENT, diff --git a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs index 06296b9..2805da9 100644 --- a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Novation; /// /// Represents a generic information for a . /// -public class NovationLaunchpadRGBDeviceInfo : NovationRGBDeviceInfo +public sealed class NovationLaunchpadRGBDeviceInfo : NovationRGBDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.Novation/NovationDeviceProvider.cs b/RGB.NET.Devices.Novation/NovationDeviceProvider.cs index 9d2d8d2..837a82c 100644 --- a/RGB.NET.Devices.Novation/NovationDeviceProvider.cs +++ b/RGB.NET.Devices.Novation/NovationDeviceProvider.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Novation; /// /// Represents a device provider responsible for Novation devices. /// -public class NovationDeviceProvider : AbstractRGBDeviceProvider +public sealed class NovationDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields diff --git a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj index 12a7919..cda9c5e 100644 --- a/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj +++ b/RGB.NET.Devices.Novation/RGB.NET.Devices.Novation.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.OpenRGB/Generic/OpenRGBGenericDevice.cs b/RGB.NET.Devices.OpenRGB/Generic/OpenRGBGenericDevice.cs index 618c310..7f51c81 100644 --- a/RGB.NET.Devices.OpenRGB/Generic/OpenRGBGenericDevice.cs +++ b/RGB.NET.Devices.OpenRGB/Generic/OpenRGBGenericDevice.cs @@ -4,7 +4,7 @@ using RGB.NET.Core; namespace RGB.NET.Devices.OpenRGB; /// -public class OpenRGBGenericDevice : AbstractOpenRGBDevice +public sealed class OpenRGBGenericDevice : AbstractOpenRGBDevice { #region Constructors /// diff --git a/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs b/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs index ff4daa5..0537d11 100644 --- a/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs +++ b/RGB.NET.Devices.OpenRGB/Generic/OpenRGBUpdateQueue.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.OpenRGB; /// /// Represents the update-queue performing updates for OpenRGB devices. /// -public class OpenRGBUpdateQueue : UpdateQueue +public sealed class OpenRGBUpdateQueue : UpdateQueue { #region Properties & Fields diff --git a/RGB.NET.Devices.OpenRGB/OpenRGBDeviceProvider.cs b/RGB.NET.Devices.OpenRGB/OpenRGBDeviceProvider.cs index ccf41a3..6c83a68 100644 --- a/RGB.NET.Devices.OpenRGB/OpenRGBDeviceProvider.cs +++ b/RGB.NET.Devices.OpenRGB/OpenRGBDeviceProvider.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.OpenRGB; /// /// Represents a device provider responsible for OpenRGB devices. /// -public class OpenRGBDeviceProvider : AbstractRGBDeviceProvider +public sealed class OpenRGBDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields @@ -92,7 +92,7 @@ public class OpenRGBDeviceProvider : AbstractRGBDeviceProvider for (int i = 0; i < deviceCount; i++) { - Device? device = openRgb.GetControllerData(i); + Device device = openRgb.GetControllerData(i); int directModeIndex = Array.FindIndex(device.Modes, d => d.Name == "Direct"); if (directModeIndex != -1) @@ -112,7 +112,7 @@ public class OpenRGBDeviceProvider : AbstractRGBDeviceProvider if (device.Zones.All(z => z.LedCount == 0)) continue; - OpenRGBUpdateQueue? updateQueue = new(GetUpdateTrigger(), i, openRgb, device); + OpenRGBUpdateQueue updateQueue = new(GetUpdateTrigger(), i, openRgb, device); bool anyZoneHasSegments = device.Zones.Any(z => z.Segments.Length > 0); bool splitDeviceByZones = anyZoneHasSegments || PerZoneDeviceFlag.HasFlag(Helper.GetRgbNetDeviceType(device.Type)); @@ -162,8 +162,6 @@ public class OpenRGBDeviceProvider : AbstractRGBDeviceProvider _clients.Clear(); DeviceDefinitions.Clear(); Devices = Enumerable.Empty(); - - GC.SuppressFinalize(this); } #endregion } diff --git a/RGB.NET.Devices.OpenRGB/OpenRGBServerDefinition.cs b/RGB.NET.Devices.OpenRGB/OpenRGBServerDefinition.cs index 860b6bc..7943775 100644 --- a/RGB.NET.Devices.OpenRGB/OpenRGBServerDefinition.cs +++ b/RGB.NET.Devices.OpenRGB/OpenRGBServerDefinition.cs @@ -3,17 +3,17 @@ /// /// Represents a definition of an OpenRGB server. /// -public class OpenRGBServerDefinition +public sealed class OpenRGBServerDefinition { /// /// The name of the client that will appear in the OpenRGB interface. /// - public string? ClientName { get; set; } = "RGB.NET"; + public string ClientName { get; set; } = "RGB.NET"; /// /// The ip address of the server. /// - public string? Ip { get; set; } = "127.0.0.1"; + public string Ip { get; set; } = "127.0.0.1"; /// /// The port of the server. diff --git a/RGB.NET.Devices.OpenRGB/PerZone/OpenRGBZoneDevice.cs b/RGB.NET.Devices.OpenRGB/PerZone/OpenRGBZoneDevice.cs index 6def092..1e3c4ff 100644 --- a/RGB.NET.Devices.OpenRGB/PerZone/OpenRGBZoneDevice.cs +++ b/RGB.NET.Devices.OpenRGB/PerZone/OpenRGBZoneDevice.cs @@ -4,7 +4,7 @@ using RGB.NET.Core; namespace RGB.NET.Devices.OpenRGB; /// -public class OpenRGBZoneDevice : AbstractOpenRGBDevice +public sealed class OpenRGBZoneDevice : AbstractOpenRGBDevice { #region Properties & Fields diff --git a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj index 9d4c0e8..94ce604 100644 --- a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj +++ b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj @@ -1,6 +1,6 @@ - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj.DotSettings b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj.DotSettings index f79e29d..7e8e95f 100644 --- a/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj.DotSettings +++ b/RGB.NET.Devices.OpenRGB/RGB.NET.Devices.OpenRGB.csproj.DotSettings @@ -1,4 +1,5 @@  True True - True \ No newline at end of file + True + True \ No newline at end of file diff --git a/RGB.NET.Devices.OpenRGB/Segment/OpenRGBSegmentDevice.cs b/RGB.NET.Devices.OpenRGB/Segment/OpenRGBSegmentDevice.cs index 9d8c633..bc8e85e 100644 --- a/RGB.NET.Devices.OpenRGB/Segment/OpenRGBSegmentDevice.cs +++ b/RGB.NET.Devices.OpenRGB/Segment/OpenRGBSegmentDevice.cs @@ -4,7 +4,7 @@ using RGB.NET.Core; namespace RGB.NET.Devices.OpenRGB; /// -public class OpenRGBSegmentDevice : AbstractOpenRGBDevice +public sealed class OpenRGBSegmentDevice : AbstractOpenRGBDevice { #region Properties & Fields diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs index 8cd251d..edd290b 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.PicoPi; /// /// Using this requires the libusb driver to be installed! /// -public class PicoPiBulkUpdateQueue : UpdateQueue +public sealed class PicoPiBulkUpdateQueue : UpdateQueue { #region Properties & Fields diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs index b3ff956..652ba80 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.PicoPi; /// /// Represents the update-queue performing updates for Pico-Pi HID-devices. /// -public class PicoPiHIDUpdateQueue : UpdateQueue +public sealed class PicoPiHIDUpdateQueue : UpdateQueue { #region Properties & Fields diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDevice.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDevice.cs index 486842d..b50be7b 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDevice.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDevice.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.PicoPi; /// /// Represents a device based on an Raspberry Pi Pico. /// -public class PicoPiRGBDevice : AbstractRGBDevice +public sealed class PicoPiRGBDevice : AbstractRGBDevice { #region Properties & Fields diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDeviceInfo.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDeviceInfo.cs index ffe8e71..52e3d79 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDeviceInfo.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDeviceInfo.cs @@ -5,7 +5,7 @@ namespace RGB.NET.Devices.PicoPi; /// /// Represents a generic information for a . /// -public class PicoPiRGBDeviceInfo : IRGBDeviceInfo +public sealed class PicoPiRGBDeviceInfo : IRGBDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs index a47916c..2dcd6de 100644 --- a/RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs +++ b/RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Devices.PicoPi; /// /// Represents a SDK to access devices based on a Raspberry Pi Pico. /// -public class PicoPiSDK : IDisposable +public sealed class PicoPiSDK : IDisposable { #region Constants @@ -303,8 +303,6 @@ public class PicoPiSDK : IDisposable _hidStream.Dispose(); _bulkDevice?.Dispose(); _usbContext?.Dispose(); - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs b/RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs index bce7e9c..f18116f 100644 --- a/RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs +++ b/RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs @@ -15,7 +15,7 @@ namespace RGB.NET.Devices.PicoPi; /// Represents a device provider responsible for PicoPi-devices. /// // ReSharper disable once InconsistentNaming -public class PicoPiDeviceProvider : AbstractRGBDeviceProvider +public sealed class PicoPiDeviceProvider : AbstractRGBDeviceProvider { #region Constants diff --git a/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj b/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj index db64c4a..6cf8a2c 100644 --- a/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj +++ b/RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs index 1dd5c70..adc08f7 100644 --- a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs +++ b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents a razer chroma link. /// -public class RazerChromaLinkRGBDevice : RazerRGBDevice, IUnknownDevice +public sealed class RazerChromaLinkRGBDevice : RazerRGBDevice, IUnknownDevice { #region Constructors diff --git a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkUpdateQueue.cs b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkUpdateQueue.cs index 42755b9..3d63bf0 100644 --- a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents the update-queue performing updates for razer chroma-link devices. /// -public class RazerChromaLinkUpdateQueue : RazerUpdateQueue +public sealed class RazerChromaLinkUpdateQueue : RazerUpdateQueue { #region Constructors diff --git a/RGB.NET.Devices.Razer/Exceptions/RazerException.cs b/RGB.NET.Devices.Razer/Exceptions/RazerException.cs index 3350c81..ae9ad23 100644 --- a/RGB.NET.Devices.Razer/Exceptions/RazerException.cs +++ b/RGB.NET.Devices.Razer/Exceptions/RazerException.cs @@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents an exception thrown by the Razer-SDK. /// -public class RazerException : ApplicationException +public sealed class RazerException : ApplicationException { #region Properties & Fields diff --git a/RGB.NET.Devices.Razer/Generic/Devices.cs b/RGB.NET.Devices.Razer/Generic/Devices.cs deleted file mode 100644 index fb47055..0000000 --- a/RGB.NET.Devices.Razer/Generic/Devices.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace RGB.NET.Devices.Razer; - -internal class Devices -{ - public static readonly List<(Guid guid, string model)> KEYBOARDS = new() - { - (new Guid("2EA1BB63-CA28-428D-9F06-196B88330BBB"), "Blackwidow Chroma"), - (new Guid("ED1C1B82-BFBE-418F-B49D-D03F05B149DF"), "Razer Blackwidow Chroma Tournament Edition"), - (new Guid("18C5AD9B-4326-4828-92C4-2669A66D2283"), "Razer Deathstalker "), - (new Guid("872AB2A9-7959-4478-9FED-15F6186E72E4"), "Overwatch Keyboard"), - (new Guid("5AF60076-ADE9-43D4-B574-52599293B554"), "Razer Blackwidow X Chroma"), - (new Guid("2D84DD51-3290-4AAC-9A89-D8AFDE38B57C"), "Razer Blackwidow X TE Chroma"), - (new Guid("803378C1-CC48-4970-8539-D828CC1D420A"), "Razer Omata Chroma"), - (new Guid("C83BDFE8-E7FC-40E0-99DB-872E23F19891"), "Razer Blade Stealth"), - (new Guid("F2BEDFAF-A0FE-4651-9D41-B6CE603A3DDD"), "Razer Blade"), - (new Guid("A73AC338-F0E5-4BF7-91AE-DD1F7E1737A5"), "Razer Blade Pro"), - (new Guid("608E743F-B402-44BD-A7A6-7AA9F574ECF4"), "Razer Blackwidow Chroma v2"), - (new Guid("F85E7473-8F03-45B6-A16E-CE26CB8D2441"), "Razer Huntsman"), - (new Guid("16BB5ABD-C1CD-4CB3-BDF7-62438748BD98"), "Razer Blackwidow Elite") - }; - - public static readonly List<(Guid guid, string model)> MICE = new() - { - (new Guid("7EC00450-E0EE-4289-89D5-0D879C19061A"), "Razer Mamba Chroma Tournament Edition"), - (new Guid("AEC50D91-B1F1-452F-8E16-7B73F376FDF3"), "Razer Deathadder Chroma "), - (new Guid("FF8A5929-4512-4257-8D59-C647BF9935D0"), "Razer Diamondback"), - (new Guid("D527CBDC-EB0A-483A-9E89-66D50463EC6C"), "Razer Mamba"), - (new Guid("D714C50B-7158-4368-B99C-601ACB985E98"), "Razer Naga Epic"), - (new Guid("F1876328-6CA4-46AE-BE04-BE812B414433"), "Razer Naga"), - (new Guid("52C15681-4ECE-4DD9-8A52-A1418459EB34"), "Razer Orochi Chroma"), - (new Guid("195D70F5-F285-4CFF-99F2-B8C0E9658DB4"), "Razer Naga Hex Chroma"), - (new Guid("77834867-3237-4A9F-AD77-4A46C4183003"), "Razer DeathAdder Elite Chroma") - }; - - public static readonly List<(Guid guid, string model)> HEADSETS = new() - { - (new Guid("DF3164D7-5408-4A0E-8A7F-A7412F26BEBF"), "Razer ManO'War"), - (new Guid("CD1E09A5-D5E6-4A6C-A93B-E6D9BF1D2092"), "Razer Kraken 7.1 Chroma"), - (new Guid("7FB8A36E-9E74-4BB3-8C86-CAC7F7891EBD"), "Razer Kraken 7.1 Chroma Refresh"), - (new Guid("FB357780-4617-43A7-960F-D1190ED54806"), "Razer Kraken Kitty") - }; - - public static readonly List<(Guid guid, string model)> MOUSEMATS = new() - { - (new Guid("80F95A94-73D2-48CA-AE9A-0986789A9AF2"), "Razer Firefly") - }; - - public static readonly List<(Guid guid, string model)> KEYPADS = new() - { - (new Guid("9D24B0AB-0162-466C-9640-7A924AA4D9FD"), "Razer Orbweaver"), - (new Guid("00F0545C-E180-4AD1-8E8A-419061CE505E"), "Razer Tartarus") - }; - - public static readonly List<(Guid guid, string model)> CHROMALINKS = new() - { - (new Guid("0201203B-62F3-4C50-83DD-598BABD208E0"), "Core Chroma"), - (new Guid("35F6F18D-1AE5-436C-A575-AB44A127903A"), "Lenovo Y900"), - (new Guid("47DB1FA7-6B9B-4EE6-B6F4-4071A3B2053B"), "Lenovo Y27"), - (new Guid("BB2E9C9B-B0D2-461A-BA52-230B5D6C3609"), "Chroma Box") - }; - - public static readonly List<(Guid guid, string model)> SPEAKERS = new() - { - (new Guid("45B308F2-CD44-4594-8375-4D5945AD880E"), "Nommo Chroma"), - (new Guid("3017280B-D7F9-4D7B-930E-7B47181B46B5"), "Nommo Chroma Pro") - }; -} \ No newline at end of file diff --git a/RGB.NET.Devices.Razer/Generic/RazerRGBDevice.cs b/RGB.NET.Devices.Razer/Generic/RazerRGBDevice.cs index 1a36595..c468948 100644 --- a/RGB.NET.Devices.Razer/Generic/RazerRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Generic/RazerRGBDevice.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using RGB.NET.Core; namespace RGB.NET.Devices.Razer; @@ -27,10 +26,7 @@ public abstract class RazerRGBDevice : AbstractRGBDevice, IR #endregion #region Methods - - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); - + /// public override void Dispose() { diff --git a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs index cec7f08..2b61b35 100644 --- a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents a razer headset. /// -public class RazerHeadsetRGBDevice : RazerRGBDevice, IHeadset +public sealed class RazerHeadsetRGBDevice : RazerRGBDevice, IHeadset { #region Constructors diff --git a/RGB.NET.Devices.Razer/Headset/RazerHeadsetUpdateQueue.cs b/RGB.NET.Devices.Razer/Headset/RazerHeadsetUpdateQueue.cs index 9cb3eaf..24cc57b 100644 --- a/RGB.NET.Devices.Razer/Headset/RazerHeadsetUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Headset/RazerHeadsetUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents the update-queue performing updates for razer headset devices. /// -public class RazerHeadsetUpdateQueue : RazerUpdateQueue +public sealed class RazerHeadsetUpdateQueue : RazerUpdateQueue { #region Constructors diff --git a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs index 3a4c5f2..1a5cbfb 100644 --- a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents a razer keyboard. /// -public class RazerKeyboardRGBDevice : RazerRGBDevice, IKeyboard +public sealed class RazerKeyboardRGBDevice : RazerRGBDevice, IKeyboard { #region Properties & Fields diff --git a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDeviceInfo.cs index 983d030..2a369f3 100644 --- a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDeviceInfo.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents a generic information for a . /// -public class RazerKeyboardRGBDeviceInfo : RazerRGBDeviceInfo, IKeyboardDeviceInfo +public sealed class RazerKeyboardRGBDeviceInfo : RazerRGBDeviceInfo, IKeyboardDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardUpdateQueue.cs b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardUpdateQueue.cs index 09b8c2d..b351d5f 100644 --- a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents the update-queue performing updates for razer keyboard devices. /// -public class RazerKeyboardUpdateQueue : RazerUpdateQueue +public sealed class RazerKeyboardUpdateQueue : RazerUpdateQueue { #region Constructors diff --git a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs index f620388..6c1c244 100644 --- a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents a razer keypad. /// -public class RazerKeypadRGBDevice : RazerRGBDevice, IKeypad +public sealed class RazerKeypadRGBDevice : RazerRGBDevice, IKeypad { #region Constructors diff --git a/RGB.NET.Devices.Razer/Keypad/RazerKeypadUpdateQueue.cs b/RGB.NET.Devices.Razer/Keypad/RazerKeypadUpdateQueue.cs index 2b6dcc6..9b6908a 100644 --- a/RGB.NET.Devices.Razer/Keypad/RazerKeypadUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Keypad/RazerKeypadUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents the update-queue performing updates for razer keypad devices. /// -public class RazerKeypadUpdateQueue : RazerUpdateQueue +public sealed class RazerKeypadUpdateQueue : RazerUpdateQueue { #region Constructors diff --git a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs index 1433449..fe00b6c 100644 --- a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents a razer mouse. /// -public class RazerMouseRGBDevice : RazerRGBDevice, IMouse +public sealed class RazerMouseRGBDevice : RazerRGBDevice, IMouse { #region Properties & Fields diff --git a/RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs b/RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs index 5a50911..22295d0 100644 --- a/RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Mouse/RazerMouseUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents the update-queue performing updates for razer mouse devices. /// -public class RazerMouseUpdateQueue : RazerUpdateQueue +public sealed class RazerMouseUpdateQueue : RazerUpdateQueue { #region Constructors diff --git a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs index af47df3..33932c4 100644 --- a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents a razer mousepad. /// -public class RazerMousepadRGBDevice : RazerRGBDevice, IMousepad +public sealed class RazerMousepadRGBDevice : RazerRGBDevice, IMousepad { #region Constructors diff --git a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadUpdateQueue.cs b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadUpdateQueue.cs index 3b01b67..57d912a 100644 --- a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadUpdateQueue.cs +++ b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents the update-queue performing updates for razer mousepad devices. /// -public class RazerMousepadUpdateQueue : RazerUpdateQueue +public sealed class RazerMousepadUpdateQueue : RazerUpdateQueue { #region Constructors diff --git a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj index 32fcbe0..27f7261 100644 --- a/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj +++ b/RGB.NET.Devices.Razer/RGB.NET.Devices.Razer.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -41,7 +41,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -49,7 +49,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index 04edecc..313ef08 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -15,7 +15,7 @@ namespace RGB.NET.Devices.Razer; /// /// Represents a device provider responsible for razer devices. /// -public class RazerDeviceProvider : AbstractRGBDeviceProvider +public sealed class RazerDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields @@ -308,8 +308,6 @@ public class RazerDeviceProvider : AbstractRGBDeviceProvider // DarthAffe 03.03.2020: Fails with an access-violation - verify if an unload is already triggered by uninit //try { _RazerSDK.UnloadRazerSDK(); } //catch { /* at least we tried */ } - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.SteelSeries/API/Model/CoreProps.cs b/RGB.NET.Devices.SteelSeries/API/Model/CoreProps.cs index c5cc970..8e74d0e 100644 --- a/RGB.NET.Devices.SteelSeries/API/Model/CoreProps.cs +++ b/RGB.NET.Devices.SteelSeries/API/Model/CoreProps.cs @@ -2,7 +2,7 @@ namespace RGB.NET.Devices.SteelSeries.API.Model; -internal class CoreProps +internal sealed class CoreProps { [JsonPropertyName("address")] public string? Address { get; set; } diff --git a/RGB.NET.Devices.SteelSeries/API/Model/Event.cs b/RGB.NET.Devices.SteelSeries/API/Model/Event.cs index 4aa335e..2862e94 100644 --- a/RGB.NET.Devices.SteelSeries/API/Model/Event.cs +++ b/RGB.NET.Devices.SteelSeries/API/Model/Event.cs @@ -3,7 +3,7 @@ using System.Text.Json.Serialization; namespace RGB.NET.Devices.SteelSeries.API.Model; -internal class Event +internal sealed class Event { #region Properties & Fields diff --git a/RGB.NET.Devices.SteelSeries/API/Model/Game.cs b/RGB.NET.Devices.SteelSeries/API/Model/Game.cs index b22cb1f..081d3dd 100644 --- a/RGB.NET.Devices.SteelSeries/API/Model/Game.cs +++ b/RGB.NET.Devices.SteelSeries/API/Model/Game.cs @@ -2,7 +2,7 @@ namespace RGB.NET.Devices.SteelSeries.API.Model; -internal class Game +internal sealed class Game { #region Properties & Fields diff --git a/RGB.NET.Devices.SteelSeries/API/Model/GoLispHandler.cs b/RGB.NET.Devices.SteelSeries/API/Model/GoLispHandler.cs index 3cd2ec4..1c6dba1 100644 --- a/RGB.NET.Devices.SteelSeries/API/Model/GoLispHandler.cs +++ b/RGB.NET.Devices.SteelSeries/API/Model/GoLispHandler.cs @@ -2,7 +2,7 @@ namespace RGB.NET.Devices.SteelSeries.API.Model; -internal class GoLispHandler +internal sealed class GoLispHandler { #region Properties & Fields diff --git a/RGB.NET.Devices.SteelSeries/Attribute/APIName.cs b/RGB.NET.Devices.SteelSeries/Attribute/APIName.cs index dbf9931..d500a53 100644 --- a/RGB.NET.Devices.SteelSeries/Attribute/APIName.cs +++ b/RGB.NET.Devices.SteelSeries/Attribute/APIName.cs @@ -1,6 +1,6 @@ namespace RGB.NET.Devices.SteelSeries; -internal class APIName : System.Attribute +internal sealed class APIName : System.Attribute { #region Properties & Fields diff --git a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs index 26d744d..c85f394 100644 --- a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesDeviceUpdateQueue.cs @@ -10,7 +10,7 @@ namespace RGB.NET.Devices.SteelSeries; /// /// Represents the update-queue performing updates for steelseries devices. /// -internal class SteelSeriesDeviceUpdateQueue : UpdateQueue +internal sealed class SteelSeriesDeviceUpdateQueue : UpdateQueue { #region Properties & Fields diff --git a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs index debe441..86b1bdf 100644 --- a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs +++ b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using RGB.NET.Core; +using RGB.NET.Core; namespace RGB.NET.Devices.SteelSeries; @@ -8,7 +7,7 @@ namespace RGB.NET.Devices.SteelSeries; /// /// Represents a SteelSeries-device. (keyboard, mouse, headset, mousepad). /// -public class SteelSeriesRGBDevice : AbstractRGBDevice, ISteelSeriesRGBDevice, IUnknownDevice//TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated +public sealed class SteelSeriesRGBDevice : AbstractRGBDevice, ISteelSeriesRGBDevice, IUnknownDevice//TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated { #region Properties & Fields @@ -43,8 +42,5 @@ public class SteelSeriesRGBDevice : AbstractRGBDevice, /// protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId]; - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); - #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDeviceInfo.cs b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDeviceInfo.cs index fe1f747..0ceebba 100644 --- a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDeviceInfo.cs +++ b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDeviceInfo.cs @@ -6,7 +6,7 @@ namespace RGB.NET.Devices.SteelSeries; /// /// Represents a generic information for a SteelSeries-. /// -public class SteelSeriesRGBDeviceInfo : IRGBDeviceInfo +public sealed class SteelSeriesRGBDeviceInfo : IRGBDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj index d8b2ab6..f75e2d8 100644 --- a/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj +++ b/RGB.NET.Devices.SteelSeries/RGB.NET.Devices.SteelSeries.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs index ee15533..417a448 100644 --- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs +++ b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProvider.cs @@ -10,11 +10,11 @@ namespace RGB.NET.Devices.SteelSeries; /// /// Represents a device provider responsible for SteelSeries-devices. /// -public class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider +public sealed class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider { #region Constants - private static readonly int HEARTBEAT_TIMER = 5000; // flush the device every 5 seconds to prevent timeouts + private const int HEARTBEAT_TIMER = 5000; // flush the device every 5 seconds to prevent timeouts #endregion @@ -137,8 +137,6 @@ public class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider try { SteelSeriesSDK.Dispose(); } catch { /* shit happens */ } - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs index 8d3d290..a22502e 100644 --- a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs +++ b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs @@ -11,7 +11,7 @@ namespace RGB.NET.Devices.WS281X.Arduino; /// /// Represents an arduino WS2812 device. /// -public class ArduinoWS2812USBDevice : AbstractRGBDevice, ILedStripe +public sealed class ArduinoWS2812USBDevice : AbstractRGBDevice, ILedStripe { #region Properties & Fields /// @@ -53,9 +53,6 @@ public class ArduinoWS2812USBDevice : AbstractRGBDevice protected override IEnumerable GetLedsToUpdate(bool flushLeds) => (flushLeds || LedMapping.Values.Any(x => x.IsDirty)) ? LedMapping.Values : Enumerable.Empty(); - - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); - + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDeviceInfo.cs b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDeviceInfo.cs index fede95c..a03fdf0 100644 --- a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDeviceInfo.cs +++ b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDeviceInfo.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.WS281X.Arduino; /// /// Represents a generic information for a . /// -public class ArduinoWS2812USBDeviceInfo : IRGBDeviceInfo +public sealed class ArduinoWS2812USBDeviceInfo : IRGBDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBUpdateQueue.cs b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBUpdateQueue.cs index 603b6f5..2d035ff 100644 --- a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBUpdateQueue.cs +++ b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBUpdateQueue.cs @@ -9,7 +9,7 @@ namespace RGB.NET.Devices.WS281X.Arduino; /// /// Represents the update-queue performing updates for arduino WS2812 devices. /// -public class ArduinoWS2812USBUpdateQueue : SerialConnectionUpdateQueue +public sealed class ArduinoWS2812USBUpdateQueue : SerialConnectionUpdateQueue { #region Constants diff --git a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS281XDeviceDefinition.cs b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS281XDeviceDefinition.cs index 612596d..e3d2545 100644 --- a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS281XDeviceDefinition.cs +++ b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS281XDeviceDefinition.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.WS281X.Arduino; /// /// Represents a definition of an arduino WS2812 devices. /// -public class ArduinoWS281XDeviceDefinition : IWS281XDeviceDefinition +public sealed class ArduinoWS281XDeviceDefinition : IWS281XDeviceDefinition { #region Properties & Fields diff --git a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs index a102126..94d7479 100644 --- a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs +++ b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs @@ -1,7 +1,6 @@ // ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedMember.Global -using System.Collections.Generic; using RGB.NET.Core; namespace RGB.NET.Devices.WS281X.Bitwizard; @@ -11,7 +10,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard; /// /// Represents an bitwizard WS2812 USB device. /// -public class BitwizardWS2812USBDevice : AbstractRGBDevice, ILedStripe +public sealed class BitwizardWS2812USBDevice : AbstractRGBDevice, ILedStripe { #region Properties & Fields @@ -47,9 +46,6 @@ public class BitwizardWS2812USBDevice : AbstractRGBDevice protected override object GetLedCustomData(LedId ledId) => _ledOffset + ((int)ledId - (int)LedId.LedStripe1); - - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); - + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDeviceInfo.cs b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDeviceInfo.cs index 65f0054..3e911b7 100644 --- a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDeviceInfo.cs +++ b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDeviceInfo.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard; /// /// Represents a generic information for a . /// -public class BitwizardWS2812USBDeviceInfo : IRGBDeviceInfo +public sealed class BitwizardWS2812USBDeviceInfo : IRGBDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBUpdateQueue.cs b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBUpdateQueue.cs index cb0ef7b..b970b54 100644 --- a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBUpdateQueue.cs +++ b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBUpdateQueue.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard; /// /// Represents the update-queue performing updates for a bitwizard WS2812 device. /// -public class BitwizardWS2812USBUpdateQueue : SerialConnectionUpdateQueue +public sealed class BitwizardWS2812USBUpdateQueue : SerialConnectionUpdateQueue { #region Constructors diff --git a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS281XDeviceDefinition.cs b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS281XDeviceDefinition.cs index 3da2203..131a879 100644 --- a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS281XDeviceDefinition.cs +++ b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS281XDeviceDefinition.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard; /// /// Represents a definition of an bitwizard WS2812 devices. /// -public class BitwizardWS281XDeviceDefinition : IWS281XDeviceDefinition +public sealed class BitwizardWS281XDeviceDefinition : IWS281XDeviceDefinition { #region Properties & Fields diff --git a/RGB.NET.Devices.WS281X/Generic/SerialPortConnection.cs b/RGB.NET.Devices.WS281X/Generic/SerialPortConnection.cs index f581e3f..7004a30 100644 --- a/RGB.NET.Devices.WS281X/Generic/SerialPortConnection.cs +++ b/RGB.NET.Devices.WS281X/Generic/SerialPortConnection.cs @@ -1,5 +1,4 @@ -using System; -using System.IO.Ports; +using System.IO.Ports; namespace RGB.NET.Devices.WS281X; @@ -7,7 +6,7 @@ namespace RGB.NET.Devices.WS281X; /// /// Represents a serial-connection using the default microsoft serial-port implementation. /// -public class SerialPortConnection : ISerialConnection +public sealed class SerialPortConnection : ISerialConnection { #region Properties & Fields @@ -65,8 +64,6 @@ public class SerialPortConnection : ISerialConnection public void Dispose() { SerialPort.Dispose(); - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs index d1a5b98..f297a60 100644 --- a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs +++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.WS281X.NodeMCU; /// /// Represents an NodeMCU WS2812 device. /// -public class NodeMCUWS2812USBDevice : AbstractRGBDevice, ILedStripe +public sealed class NodeMCUWS2812USBDevice : AbstractRGBDevice, ILedStripe { #region Properties & Fields @@ -55,9 +55,6 @@ public class NodeMCUWS2812USBDevice : AbstractRGBDevice protected override IEnumerable GetLedsToUpdate(bool flushLeds) => (flushLeds || LedMapping.Values.Any(x => x.IsDirty)) ? LedMapping.Values : Enumerable.Empty(); - - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); - + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs index 0caf3b6..d36813f 100644 --- a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs +++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs @@ -7,7 +7,7 @@ namespace RGB.NET.Devices.WS281X.NodeMCU; /// /// Represents a generic information for a . /// -public class NodeMCUWS2812USBDeviceInfo : IRGBDeviceInfo +public sealed class NodeMCUWS2812USBDeviceInfo : IRGBDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs index 9e6d30e..a78343c 100644 --- a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs +++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBUpdateQueue.cs @@ -14,7 +14,7 @@ namespace RGB.NET.Devices.WS281X.NodeMCU; /// /// Represents the update-queue performing updates for NodeMCU WS2812 devices. /// -public class NodeMCUWS2812USBUpdateQueue : UpdateQueue +public sealed class NodeMCUWS2812USBUpdateQueue : UpdateQueue { #region Properties & Fields @@ -183,8 +183,6 @@ public class NodeMCUWS2812USBUpdateQueue : UpdateQueue ResetDevice(); _httpClient.Dispose(); } - - GC.SuppressFinalize(this); } private string GetUrl(string path) => $"http://{_hostname}/{path}"; diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS281XDeviceDefinition.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS281XDeviceDefinition.cs index 0f68f2b..a345119 100644 --- a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS281XDeviceDefinition.cs +++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS281XDeviceDefinition.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Devices.WS281X.NodeMCU; /// /// Represents a definition of an NodeMCU WS2812 devices. /// -public class NodeMCUWS281XDeviceDefinition : IWS281XDeviceDefinition +public sealed class NodeMCUWS281XDeviceDefinition : IWS281XDeviceDefinition { #region Properties & Fields diff --git a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj index 0e0e08f..5487a8e 100644 --- a/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj +++ b/RGB.NET.Devices.WS281X/RGB.NET.Devices.WS281X.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE @@ -57,7 +57,7 @@ - + diff --git a/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs b/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs index 6a5c49d..4d2e047 100644 --- a/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs +++ b/RGB.NET.Devices.WS281X/WS281XDeviceProvider.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.WS281X; /// // ReSharper disable once InconsistentNaming // ReSharper disable once UnusedType.Global -public class WS281XDeviceProvider : AbstractRGBDeviceProvider +public sealed class WS281XDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields @@ -75,8 +75,6 @@ public class WS281XDeviceProvider : AbstractRGBDeviceProvider base.Dispose(); DeviceDefinitions.Clear(); - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs index 3791ba0..8a3012e 100644 --- a/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs +++ b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs @@ -8,10 +8,12 @@ namespace RGB.NET.Devices.Wooting.Generic; /// /// Represents the update-queue performing updates for cooler master devices. /// -public class WootingUpdateQueue : UpdateQueue +public sealed class WootingUpdateQueue : UpdateQueue { #region Properties & Fields + private readonly byte _deviceid; + #endregion #region Constructors diff --git a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs index eb0cc75..79e1baf 100644 --- a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using RGB.NET.Core; using RGB.NET.Devices.Wooting.Generic; using RGB.NET.Devices.Wooting.Native; @@ -10,7 +9,7 @@ namespace RGB.NET.Devices.Wooting.Keyboard; /// /// Represents a Wooting keyboard. /// -public class WootingKeyboardRGBDevice : WootingRGBDevice, IKeyboard +public sealed class WootingKeyboardRGBDevice : WootingRGBDevice, IKeyboard { #region Properties & Fields @@ -47,17 +46,12 @@ public class WootingKeyboardRGBDevice : WootingRGBDevice protected override object GetLedCustomData(LedId ledId) => WootingKeyboardLedMappings.Mapping[DeviceInfo.WootingDeviceType][ledId]; - /// - protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); - public override void Dispose() { _WootingSDK.SelectDevice(DeviceInfo.WootingDeviceIndex); _WootingSDK.Reset(); base.Dispose(); - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDeviceInfo.cs index dfcc8eb..e3f8bbf 100644 --- a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDeviceInfo.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Wooting.Keyboard; /// /// Represents a generic information for a . /// -public class WootingKeyboardRGBDeviceInfo : WootingRGBDeviceInfo, IKeyboardDeviceInfo +public sealed class WootingKeyboardRGBDeviceInfo : WootingRGBDeviceInfo, IKeyboardDeviceInfo { #region Properties & Fields diff --git a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj index ac158f0..8a34dcd 100644 --- a/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj +++ b/RGB.NET.Devices.Wooting/RGB.NET.Devices.Wooting.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -41,7 +41,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -49,7 +49,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs b/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs index c920ebb..484bbaf 100644 --- a/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs +++ b/RGB.NET.Devices.Wooting/WootingDeviceProvider.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Devices.Wooting; /// /// Represents a device provider responsible for Wooting devices. /// -public class WootingDeviceProvider : AbstractRGBDeviceProvider +public sealed class WootingDeviceProvider : AbstractRGBDeviceProvider { #region Properties & Fields @@ -44,6 +44,7 @@ public class WootingDeviceProvider : AbstractRGBDeviceProvider /// Gets a modifiable list of paths used to find the native SDK-dlls for x64 MacOS applications. /// The first match will be used. /// + // ReSharper disable once InconsistentNaming public static List PossibleNativePathsMacOS { get; } = new() { "x64/libwooting-rgb-sdk.dylib" }; #endregion @@ -102,8 +103,6 @@ public class WootingDeviceProvider : AbstractRGBDeviceProvider try { _WootingSDK.UnloadWootingSDK(); } catch { /* at least we tried */ } } - - GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.HID/HIDLoader.cs b/RGB.NET.HID/HIDLoader.cs index b0ecfe7..b39df67 100644 --- a/RGB.NET.HID/HIDLoader.cs +++ b/RGB.NET.HID/HIDLoader.cs @@ -19,7 +19,7 @@ public record HIDDeviceDefinition(int ProductId, RGBDeviceType Devi /// /// The type of the identifier leds are mapped to. /// The type of the custom data added to the HID-device. -public class HIDLoader : IEnumerable> +public sealed class HIDLoader : IEnumerable> where TLed : notnull { #region Properties & Fields diff --git a/RGB.NET.HID/RGB.NET.HID.csproj b/RGB.NET.HID/RGB.NET.HID.csproj index 5469438..7bf502b 100644 --- a/RGB.NET.HID/RGB.NET.HID.csproj +++ b/RGB.NET.HID/RGB.NET.HID.csproj @@ -1,6 +1,6 @@ - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Layout/RGB.NET.Layout.csproj b/RGB.NET.Layout/RGB.NET.Layout.csproj index f6330ed..3c90185 100644 --- a/RGB.NET.Layout/RGB.NET.Layout.csproj +++ b/RGB.NET.Layout/RGB.NET.Layout.csproj @@ -1,6 +1,6 @@ - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -40,7 +40,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -48,7 +48,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Presets/Decorators/FlashDecorator.cs b/RGB.NET.Presets/Decorators/FlashDecorator.cs index 64794b5..e30a5f2 100644 --- a/RGB.NET.Presets/Decorators/FlashDecorator.cs +++ b/RGB.NET.Presets/Decorators/FlashDecorator.cs @@ -12,7 +12,7 @@ namespace RGB.NET.Presets.Decorators; /// /// Represents a decorator which allows to flash a brush by modifying his opacity. /// -public class FlashDecorator : AbstractUpdateAwareDecorator, IBrushDecorator +public sealed class FlashDecorator : AbstractUpdateAwareDecorator, IBrushDecorator { #region Properties & Fields diff --git a/RGB.NET.Presets/Groups/RectangleLedGroup.cs b/RGB.NET.Presets/Groups/RectangleLedGroup.cs index d6cb650..62a59ac 100644 --- a/RGB.NET.Presets/Groups/RectangleLedGroup.cs +++ b/RGB.NET.Presets/Groups/RectangleLedGroup.cs @@ -2,6 +2,7 @@ // ReSharper disable AutoPropertyCanBeMadeGetOnly.Global // ReSharper disable UnusedMember.Global +using System; using System.Collections.Generic; using System.Linq; using RGB.NET.Core; @@ -12,7 +13,7 @@ namespace RGB.NET.Presets.Groups; /// /// Represents a containing which physically lay inside a . /// -public class RectangleLedGroup : AbstractLedGroup +public sealed class RectangleLedGroup : AbstractLedGroup { #region Properties & Fields @@ -121,7 +122,7 @@ public class RectangleLedGroup : AbstractLedGroup /// Gets a list containing all of this . /// /// The list containing all of this . - public override IList ToList() => _ledCache ??= (Surface?.Leds.Where(led => led.AbsoluteBoundary.CalculateIntersectPercentage(Rectangle) >= MinOverlayPercentage).ToList() ?? new List()); + public override IList ToList() => _ledCache ??= ((IList?)Surface?.Leds.Where(led => led.AbsoluteBoundary.CalculateIntersectPercentage(Rectangle) >= MinOverlayPercentage).ToList() ?? Array.Empty()); private void InvalidateCache() => _ledCache = null; diff --git a/RGB.NET.Presets/RGB.NET.Presets.csproj b/RGB.NET.Presets/RGB.NET.Presets.csproj index fc2d052..048087a 100644 --- a/RGB.NET.Presets/RGB.NET.Presets.csproj +++ b/RGB.NET.Presets/RGB.NET.Presets.csproj @@ -1,6 +1,6 @@  - net7.0;net6.0;net5.0 + net7.0;net6.0 latest enable @@ -41,7 +41,7 @@ - $(DefineConstants);TRACE;DEBUG + TRACE;DEBUG true false @@ -49,7 +49,7 @@ true $(NoWarn);CS1591;CS1572;CS1573 - $(DefineConstants);RELEASE + RELEASE diff --git a/RGB.NET.Presets/Textures/Gradients/GradientStop.cs b/RGB.NET.Presets/Textures/Gradients/GradientStop.cs index d7aa536..75b9842 100644 --- a/RGB.NET.Presets/Textures/Gradients/GradientStop.cs +++ b/RGB.NET.Presets/Textures/Gradients/GradientStop.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Presets.Textures.Gradients; /// /// Represents a stop on a gradient. /// -public class GradientStop : AbstractBindable +public sealed class GradientStop : AbstractBindable { #region Properties & Fields diff --git a/RGB.NET.Presets/Textures/Gradients/LinearGradient.cs b/RGB.NET.Presets/Textures/Gradients/LinearGradient.cs index 29a732a..18fa252 100644 --- a/RGB.NET.Presets/Textures/Gradients/LinearGradient.cs +++ b/RGB.NET.Presets/Textures/Gradients/LinearGradient.cs @@ -11,12 +11,12 @@ namespace RGB.NET.Presets.Textures.Gradients; /// /// Represents a linear interpolated gradient with n stops. /// -public class LinearGradient : AbstractGradient +public sealed class LinearGradient : AbstractGradient { #region Properties & Fields private bool _isOrderedGradientListDirty = true; - private LinkedList _orderedGradientStops = new(); + private readonly List _orderedGradientStops = new(); #endregion @@ -89,7 +89,10 @@ public class LinearGradient : AbstractGradient if (GradientStops.Count == 1) return GradientStops[0].Color; if (_isOrderedGradientListDirty) - _orderedGradientStops = new LinkedList(GradientStops.OrderBy(x => x.Offset)); + { + _orderedGradientStops.Clear(); + _orderedGradientStops.AddRange(GradientStops.OrderBy(x => x.Offset)); + } (GradientStop gsBefore, GradientStop gsAfter) = GetEnclosingGradientStops(offset, _orderedGradientStops, WrapGradient); @@ -112,7 +115,7 @@ public class LinearGradient : AbstractGradient /// The ordered list of to choose from. /// Bool indicating if the gradient should be wrapped or not. /// The two s encapsulating the specified offset. - protected virtual (GradientStop gsBefore, GradientStop gsAfter) GetEnclosingGradientStops(float offset, LinkedList orderedStops, bool wrap) + private (GradientStop gsBefore, GradientStop gsAfter) GetEnclosingGradientStops(float offset, IEnumerable orderedStops, bool wrap) { LinkedList gradientStops = new(orderedStops); diff --git a/RGB.NET.Presets/Textures/Gradients/RainbowGradient.cs b/RGB.NET.Presets/Textures/Gradients/RainbowGradient.cs index 46c1e5b..177997a 100644 --- a/RGB.NET.Presets/Textures/Gradients/RainbowGradient.cs +++ b/RGB.NET.Presets/Textures/Gradients/RainbowGradient.cs @@ -13,7 +13,7 @@ namespace RGB.NET.Presets.Textures.Gradients; /// Represents a rainbow gradient which circles through all colors of the HUE-color-space.
/// See as reference. /// -public class RainbowGradient : AbstractDecoratable, IGradient +public sealed class RainbowGradient : AbstractDecoratable, IGradient { #region Properties & Fields @@ -102,7 +102,7 @@ public class RainbowGradient : AbstractDecoratable, IGradien /// /// Should be called to indicate that the gradient was changed. /// - protected void OnGradientChanged() => GradientChanged?.Invoke(this, EventArgs.Empty); + private void OnGradientChanged() => GradientChanged?.Invoke(this, EventArgs.Empty); #endregion } \ No newline at end of file diff --git a/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs b/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs index 8d5b8b6..349afd7 100644 --- a/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs +++ b/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Presets.Textures.Sampler; /// /// Represents a sampled that averages multiple byte-data entries. /// -public class AverageByteSampler : ISampler +public sealed class AverageByteSampler : ISampler { #region Constants diff --git a/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs b/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs index 50e9563..d53ad5d 100644 --- a/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs +++ b/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs @@ -8,7 +8,7 @@ namespace RGB.NET.Presets.Textures.Sampler; /// /// Represents a sampled that averages multiple float-data entries. /// -public class AverageFloatSampler : ISampler +public sealed class AverageFloatSampler : ISampler { #region Methods diff --git a/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj b/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj index 0279d53..7e98ef5 100644 --- a/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj +++ b/Tests/RGB.NET.Core.Tests/RGB.NET.Core.Tests.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj b/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj index 5777739..ca57230 100644 --- a/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj +++ b/Tests/RGB.NET.Presets.Tests/RGB.NET.Presets.Tests.csproj @@ -7,9 +7,9 @@ - - - + + +