mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Merge pull request #313 from DarthAffe/Test/PerformanceOptimization
Test/performance optimization
This commit is contained in:
commit
25fef22218
@ -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<TDeviceInfo> : Placeable, IRGBDevice<TDe
|
||||
DeviceUpdate();
|
||||
|
||||
// Send LEDs to SDK
|
||||
List<Led> ledsToUpdate = GetLedsToUpdate(flushLeds).ToList();
|
||||
|
||||
foreach (Led led in ledsToUpdate)
|
||||
led.Update();
|
||||
|
||||
UpdateLeds(ledsToUpdate);
|
||||
UpdateLeds(GetLedsToUpdate(flushLeds));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -124,37 +121,39 @@ public abstract class AbstractRGBDevice<TDeviceInfo> : Placeable, IRGBDevice<TDe
|
||||
/// </remarks>
|
||||
/// <param name="leds">The enumerable of leds to convert.</param>
|
||||
/// <returns>The enumerable of custom data and color tuples for the specified leds.</returns>
|
||||
protected virtual IEnumerable<(object key, Color color)> GetUpdateData(IEnumerable<Led> 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends all the updated <see cref="Led"/> to the device.
|
||||
/// </summary>
|
||||
protected virtual void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
|
||||
protected virtual void UpdateLeds(IEnumerable<Led> 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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void Dispose()
|
||||
|
||||
@ -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<ILedGroupDecorator>
|
||||
/// <inheritdoc />
|
||||
public IEnumerator<Led> GetEnumerator() => GetLeds().GetEnumerator();
|
||||
|
||||
/// <inheritdoc />
|
||||
IDisposable? ILedGroup.ToListUnsafe(out IList<Led> leds) => ToListUnsafe(out leds);
|
||||
|
||||
protected virtual IDisposable? ToListUnsafe(out IList<Led> leds)
|
||||
{
|
||||
leds = ToList();
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@ -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<ILedGroupDecorator>, IEnumerable<Led>
|
||||
/// </summary>
|
||||
/// <returns>A list containing all <see cref="Led"/> in this group.</returns>
|
||||
IList<Led> ToList();
|
||||
|
||||
internal IDisposable? ToListUnsafe(out IList<Led> leds);
|
||||
}
|
||||
@ -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;
|
||||
/// <summary>
|
||||
/// Represents a ledgroup containing arbitrary <see cref="T:RGB.NET.Core.Led" />.
|
||||
/// </summary>
|
||||
public class ListLedGroup : AbstractLedGroup
|
||||
public sealed class ListLedGroup : AbstractLedGroup
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly ActionDisposable _unlockDisposable;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list containing the <see cref="Led"/> of this <see cref="ListLedGroup"/>.
|
||||
/// </summary>
|
||||
protected IList<Led> GroupLeds { get; } = new List<Led>();
|
||||
private readonly IList<Led> _groupLeds = new List<Led>();
|
||||
|
||||
#endregion
|
||||
|
||||
@ -29,7 +33,9 @@ public class ListLedGroup : AbstractLedGroup
|
||||
/// <param name="surface">Specifies the surface to attach this group to or <c>null</c> if the group should not be attached on creation.</param>
|
||||
public ListLedGroup(RGBSurface? surface)
|
||||
: base(surface)
|
||||
{ }
|
||||
{
|
||||
_unlockDisposable = new ActionDisposable(Unlock);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
@ -40,6 +46,8 @@ public class ListLedGroup : AbstractLedGroup
|
||||
public ListLedGroup(RGBSurface? surface, IEnumerable<Led> 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
|
||||
/// <param name="leds">The <see cref="Led"/> to add.</param>
|
||||
public void AddLeds(IEnumerable<Led> leds)
|
||||
{
|
||||
lock (GroupLeds)
|
||||
lock (_groupLeds)
|
||||
foreach (Led led in leds)
|
||||
if (!ContainsLed(led))
|
||||
GroupLeds.Add(led);
|
||||
_groupLeds.Add(led);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -89,9 +99,9 @@ public class ListLedGroup : AbstractLedGroup
|
||||
/// <param name="leds">The <see cref="Led"/> to remove.</param>
|
||||
public void RemoveLeds(IEnumerable<Led> leds)
|
||||
{
|
||||
lock (GroupLeds)
|
||||
lock (_groupLeds)
|
||||
foreach (Led led in leds)
|
||||
GroupLeds.Remove(led);
|
||||
_groupLeds.Remove(led);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -101,8 +111,8 @@ public class ListLedGroup : AbstractLedGroup
|
||||
/// <returns><c>true</c> if the LED is contained by this ledgroup; otherwise, <c>false</c>.</returns>
|
||||
public bool ContainsLed(Led led)
|
||||
{
|
||||
lock (GroupLeds)
|
||||
return GroupLeds.Contains(led);
|
||||
lock (_groupLeds)
|
||||
return _groupLeds.Contains(led);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -111,10 +121,10 @@ public class ListLedGroup : AbstractLedGroup
|
||||
/// <param name="groupToMerge">The ledgroup to merge.</param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -131,9 +141,18 @@ public class ListLedGroup : AbstractLedGroup
|
||||
/// <returns>The list containing the <see cref="T:RGB.NET.Core.Led" />.</returns>
|
||||
public override IList<Led> ToList()
|
||||
{
|
||||
lock (GroupLeds)
|
||||
return new List<Led>(GroupLeds);
|
||||
lock (_groupLeds)
|
||||
return new List<Led>(_groupLeds);
|
||||
}
|
||||
|
||||
protected override IDisposable ToListUnsafe(out IList<Led> leds)
|
||||
{
|
||||
Monitor.Enter(_groupLeds);
|
||||
leds = _groupLeds;
|
||||
return _unlockDisposable;
|
||||
}
|
||||
|
||||
private void Unlock() => Monitor.Exit(_groupLeds);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@ -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})";
|
||||
|
||||
@ -9,7 +9,7 @@ namespace RGB.NET.Core;
|
||||
/// Represents a single LED of a RGB-device.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Id} {Color}")]
|
||||
public class Led : Placeable
|
||||
public sealed class Led : Placeable
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ namespace RGB.NET.Core;
|
||||
/// Represents a mapping from <see cref="LedId"/> to a custom identifier.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The identifier the <see cref="LedId"/> is mapped to.</typeparam>
|
||||
public class LedMapping<T> : IEnumerable<(LedId ledId, T mapping)>
|
||||
public sealed class LedMapping<T> : IEnumerable<(LedId ledId, T mapping)>
|
||||
where T : notnull
|
||||
{
|
||||
#region Constants
|
||||
|
||||
@ -6,5 +6,4 @@ namespace RGB.NET.Core;
|
||||
/// Represents a basic bindable class which notifies when a property value changes.
|
||||
/// </summary>
|
||||
public interface IBindable : INotifyPropertyChanged
|
||||
{
|
||||
}
|
||||
{ }
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
27
RGB.NET.Core/Misc/ActionDisposable.cs
Normal file
27
RGB.NET.Core/Misc/ActionDisposable.cs
Normal file
@ -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
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
@ -49,7 +49,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
<DefineConstants>RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -208,26 +208,27 @@ public sealed class RGBSurface : AbstractBindable, IDisposable
|
||||
|
||||
if ((brush == null) || !brush.IsEnabled) return;
|
||||
|
||||
IList<Led> leds = ledGroup.ToList();
|
||||
|
||||
IEnumerable<(RenderTarget renderTarget, Color color)> render;
|
||||
switch (brush.CalculationMode)
|
||||
using (ledGroup.ToListUnsafe(out IList<Led> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Core;
|
||||
/// <summary>
|
||||
/// Represents a brush drawing only a single color.
|
||||
/// </summary>
|
||||
public class SolidColorBrush : AbstractBrush
|
||||
public sealed class SolidColorBrush : AbstractBrush
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
/// <summary>
|
||||
/// Represents a brush drawing a texture.
|
||||
/// </summary>
|
||||
public class TextureBrush : AbstractBrush
|
||||
public sealed class TextureBrush : AbstractBrush
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
namespace RGB.NET.Core;
|
||||
|
||||
internal class EmptyTexture : ITexture
|
||||
internal sealed class EmptyTexture : ITexture
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ public interface ICustomUpdateData
|
||||
/// <summary>
|
||||
/// Represents a set of custom data, each indexed by a string-key.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RGB.NET.Core;
|
||||
|
||||
@ -21,7 +20,7 @@ public interface IUpdateQueue<TIdentifier, TData> : IReferenceCounting, IDisposa
|
||||
/// </summary>
|
||||
/// <param name="dataSet">The set of data.</param>
|
||||
// ReSharper disable once MemberCanBeProtected.Global
|
||||
void SetData(IEnumerable<(TIdentifier, TData)> dataSet);
|
||||
void SetData(ReadOnlySpan<(TIdentifier, TData)> dataSet);
|
||||
|
||||
/// <summary>
|
||||
/// Resets the current data set.
|
||||
|
||||
@ -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<TIdentifier, TData> : AbstractReferenceCountin
|
||||
/// </summary>
|
||||
/// <param name="dataSet">The set of data.</param>
|
||||
// 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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose() => Stop();
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Core;
|
||||
/// <summary>
|
||||
/// Represents an update trigger that triggers in a set interval.
|
||||
/// </summary>
|
||||
public class TimerUpdateTrigger : AbstractUpdateTrigger
|
||||
public sealed class TimerUpdateTrigger : AbstractUpdateTrigger
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
@ -21,17 +21,17 @@ public class TimerUpdateTrigger : AbstractUpdateTrigger
|
||||
/// <summary>
|
||||
/// Gets or sets the update loop of this trigger.
|
||||
/// </summary>
|
||||
protected Task? UpdateTask { get; set; }
|
||||
private Task? _updateTask;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cancellation token source used to create the cancellation token checked by the <see cref="UpdateTask"/>.
|
||||
/// Gets or sets the cancellation token source used to create the cancellation token checked by the <see cref="_updateTask"/>.
|
||||
/// </summary>
|
||||
protected CancellationTokenSource? UpdateTokenSource { get; set; }
|
||||
private CancellationTokenSource? _updateTokenSource;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cancellation token checked by the <see cref="UpdateTask"/>.
|
||||
/// Gets or sets the cancellation token checked by the <see cref="_updateTask"/>.
|
||||
/// </summary>
|
||||
protected CancellationToken UpdateToken { get; set; }
|
||||
private CancellationToken _updateToken;
|
||||
|
||||
private double _updateFrequency = 1.0 / 30.0;
|
||||
/// <summary>
|
||||
@ -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);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
Stop();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -12,7 +12,7 @@ namespace RGB.NET.Devices.Asus;
|
||||
/// <summary>
|
||||
/// Represents a device provider responsible for Cooler Master devices.
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus;
|
||||
/// <summary>
|
||||
/// Represents a Asus headset.
|
||||
/// </summary>
|
||||
public class AsusUnspecifiedRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IUnknownDevice
|
||||
public sealed class AsusUnspecifiedRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IUnknownDevice
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Asus;
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for asus devices.
|
||||
/// </summary>
|
||||
public class AsusUpdateQueue : UpdateQueue
|
||||
public sealed class AsusUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
@ -17,7 +17,7 @@ public class AsusUpdateQueue : UpdateQueue
|
||||
/// <summary>
|
||||
/// The device to be updated.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus;
|
||||
/// <summary>
|
||||
/// Represents a Asus graphicsCard.
|
||||
/// </summary>
|
||||
public class AsusGraphicsCardRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IGraphicsCard
|
||||
public sealed class AsusGraphicsCardRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IGraphicsCard
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus;
|
||||
/// <summary>
|
||||
/// Represents a Asus headset.
|
||||
/// </summary>
|
||||
public class AsusHeadsetRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IHeadset
|
||||
public sealed class AsusHeadsetRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IHeadset
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ public record AsusKeyboardExtraMapping(Regex Regex, LedMapping<int> LedMapping);
|
||||
/// <summary>
|
||||
/// Represents a Asus keyboard.
|
||||
/// </summary>
|
||||
public class AsusKeyboardRGBDevice : AsusRGBDevice<AsusKeyboardRGBDeviceInfo>, IKeyboard
|
||||
public sealed class AsusKeyboardRGBDevice : AsusRGBDevice<AsusKeyboardRGBDeviceInfo>, IKeyboard
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Asus;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Asus.AsusKeyboardRGBDevice" />.
|
||||
/// </summary>
|
||||
public class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDeviceInfo
|
||||
public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus;
|
||||
/// <summary>
|
||||
/// Represents a Asus mainboard.
|
||||
/// </summary>
|
||||
public class AsusMainboardRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IMainboard
|
||||
public sealed class AsusMainboardRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IMainboard
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Asus;
|
||||
/// <summary>
|
||||
/// Represents a Asus mouse.
|
||||
/// </summary>
|
||||
public class AsusMouseRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IMouse
|
||||
public sealed class AsusMouseRGBDevice : AsusRGBDevice<AsusRGBDeviceInfo>, IMouse
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
@ -48,7 +48,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
<DefineConstants>RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -57,21 +57,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Management" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_PackageFiles Include="$(OutputPath)\net6.0\Interop.AuraServiceLib.dll">
|
||||
<BuildAction>None</BuildAction>
|
||||
<PackagePath>lib\net6.0\</PackagePath>
|
||||
</_PackageFiles>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_PackageFiles Include="$(OutputPath)\net5.0\Interop.AuraServiceLib.dll">
|
||||
<BuildAction>None</BuildAction>
|
||||
<PackagePath>lib\net5.0\</PackagePath>
|
||||
</_PackageFiles>
|
||||
<PackageReference Include="System.Management" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -8,7 +8,7 @@ namespace RGB.NET.Devices.CoolerMaster;
|
||||
/// Specifies the <see cref="T:RGB.NET.Core.RGBDeviceType" /> of a field.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class DeviceTypeAttribute : Attribute
|
||||
public sealed class DeviceTypeAttribute : Attribute
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ namespace RGB.NET.Devices.CoolerMaster;
|
||||
/// <summary>
|
||||
/// Represents a device provider responsible for Cooler Master devices.
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
@ -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;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Contains a list of available effects.
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
@ -8,7 +8,7 @@ namespace RGB.NET.Devices.CoolerMaster;
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for cooler master devices.
|
||||
/// </summary>
|
||||
public class CoolerMasterUpdateQueue : UpdateQueue
|
||||
public sealed class CoolerMasterUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.CoolerMaster;
|
||||
/// <summary>
|
||||
/// Represents a CoolerMaster keyboard.
|
||||
/// </summary>
|
||||
public class CoolerMasterKeyboardRGBDevice : CoolerMasterRGBDevice<CoolerMasterKeyboardRGBDeviceInfo>, IKeyboard
|
||||
public sealed class CoolerMasterKeyboardRGBDevice : CoolerMasterRGBDevice<CoolerMasterKeyboardRGBDeviceInfo>, IKeyboard
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace RGB.NET.Devices.CoolerMaster;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterKeyboardRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CoolerMasterKeyboardRGBDeviceInfo : CoolerMasterRGBDeviceInfo, IKeyboardDeviceInfo
|
||||
public sealed class CoolerMasterKeyboardRGBDeviceInfo : CoolerMasterRGBDeviceInfo, IKeyboardDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.CoolerMaster;
|
||||
/// <summary>
|
||||
/// Represents a CoolerMaster mouse.
|
||||
/// </summary>
|
||||
public class CoolerMasterMouseRGBDevice : CoolerMasterRGBDevice<CoolerMasterMouseRGBDeviceInfo>, IMouse
|
||||
public sealed class CoolerMasterMouseRGBDevice : CoolerMasterRGBDevice<CoolerMasterMouseRGBDeviceInfo>, IMouse
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ namespace RGB.NET.Devices.CoolerMaster;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterMouseRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CoolerMasterMouseRGBDeviceInfo : CoolerMasterRGBDeviceInfo
|
||||
public sealed class CoolerMasterMouseRGBDeviceInfo : CoolerMasterRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
@ -48,7 +48,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
<DefineConstants>RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair cooler.
|
||||
/// </summary>
|
||||
public class CorsairCoolerRGBDevice : CorsairRGBDevice<CorsairCoolerRGBDeviceInfo>, ICooler
|
||||
public sealed class CorsairCoolerRGBDevice : CorsairRGBDevice<CorsairCoolerRGBDeviceInfo>, ICooler
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairCoolerRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairCoolerRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairCoolerRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a device provider responsible for corsair (CUE) devices.
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
namespace RGB.NET.Devices.Corsair;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace RGB.NET.Devices.Corsair;
|
||||
|
||||
/// <summary>
|
||||
/// iCUE-SDK: contains a list of led groups. Led group is used as a part of led identifier
|
||||
|
||||
@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents an exception thrown by the CUE.
|
||||
/// </summary>
|
||||
public class CUEException : ApplicationException
|
||||
public sealed class CUEException : ApplicationException
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair fan.
|
||||
/// </summary>
|
||||
public class CorsairFanRGBDevice : CorsairRGBDevice<CorsairFanRGBDeviceInfo>, IFan
|
||||
public sealed class CorsairFanRGBDevice : CorsairRGBDevice<CorsairFanRGBDeviceInfo>, IFan
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairFanRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairFanRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairFanRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for corsair devices.
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents version information for the Corsair-SDK
|
||||
/// </summary>
|
||||
public class CorsairSessionDetails
|
||||
public sealed class CorsairSessionDetails
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ internal static class LedMappings
|
||||
{
|
||||
#region Constants
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
private static LedMapping<CorsairLedId> KEYBOARD_MAPPING => new()
|
||||
{
|
||||
{ LedId.Invalid, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Invalid) },
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair graphics card.
|
||||
/// </summary>
|
||||
public class CorsairGraphicsCardRGBDevice : CorsairRGBDevice<CorsairGraphicsCardRGBDeviceInfo>, IGraphicsCard
|
||||
public sealed class CorsairGraphicsCardRGBDevice : CorsairRGBDevice<CorsairGraphicsCardRGBDeviceInfo>, IGraphicsCard
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairGraphicsCardRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairGraphicsCardRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairGraphicsCardRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair headset.
|
||||
/// </summary>
|
||||
public class CorsairHeadsetRGBDevice : CorsairRGBDevice<CorsairHeadsetRGBDeviceInfo>, IHeadset
|
||||
public sealed class CorsairHeadsetRGBDevice : CorsairRGBDevice<CorsairHeadsetRGBDeviceInfo>, IHeadset
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairHeadsetRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairHeadsetRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair headset stand.
|
||||
/// </summary>
|
||||
public class CorsairHeadsetStandRGBDevice : CorsairRGBDevice<CorsairHeadsetStandRGBDeviceInfo>, IHeadsetStand
|
||||
public sealed class CorsairHeadsetStandRGBDevice : CorsairRGBDevice<CorsairHeadsetStandRGBDeviceInfo>, IHeadsetStand
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairHeadsetStandRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairHeadsetStandRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairHeadsetStandRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair keyboard.
|
||||
/// </summary>
|
||||
public class CorsairKeyboardRGBDevice : CorsairRGBDevice<CorsairKeyboardRGBDeviceInfo>, IKeyboard
|
||||
public sealed class CorsairKeyboardRGBDevice : CorsairRGBDevice<CorsairKeyboardRGBDeviceInfo>, IKeyboard
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairKeyboardRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairKeyboardRGBDeviceInfo : CorsairRGBDeviceInfo, IKeyboardDeviceInfo
|
||||
public sealed class CorsairKeyboardRGBDeviceInfo : CorsairRGBDeviceInfo, IKeyboardDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair ledStrip.
|
||||
/// </summary>
|
||||
public class CorsairLedStripRGBDevice : CorsairRGBDevice<CorsairLedStripRGBDeviceInfo>, ILedStripe
|
||||
public sealed class CorsairLedStripRGBDevice : CorsairRGBDevice<CorsairLedStripRGBDeviceInfo>, ILedStripe
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairLedStripRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairLedStripRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairLedStripRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair memory.
|
||||
/// </summary>
|
||||
public class CorsairMainboardRGBDevice : CorsairRGBDevice<CorsairMainboardRGBDeviceInfo>, IMainboard
|
||||
public sealed class CorsairMainboardRGBDevice : CorsairRGBDevice<CorsairMainboardRGBDeviceInfo>, IMainboard
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairMainboardRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairMainboardRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairMainboardRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair memory.
|
||||
/// </summary>
|
||||
public class CorsairMemoryRGBDevice : CorsairRGBDevice<CorsairMemoryRGBDeviceInfo>, IDRAM
|
||||
public sealed class CorsairMemoryRGBDevice : CorsairRGBDevice<CorsairMemoryRGBDeviceInfo>, IDRAM
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairMemoryRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairMemoryRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairMemoryRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair mouse.
|
||||
/// </summary>
|
||||
public class CorsairMouseRGBDevice : CorsairRGBDevice<CorsairMouseRGBDeviceInfo>, IMouse
|
||||
public sealed class CorsairMouseRGBDevice : CorsairRGBDevice<CorsairMouseRGBDeviceInfo>, IMouse
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairMouseRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairMouseRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairMouseRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair mousepad.
|
||||
/// </summary>
|
||||
public class CorsairMousepadRGBDevice : CorsairRGBDevice<CorsairMousepadRGBDeviceInfo>, IMousepad
|
||||
public sealed class CorsairMousepadRGBDevice : CorsairRGBDevice<CorsairMousepadRGBDeviceInfo>, IMousepad
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairMousepadRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairMousepadRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairMousepadRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -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]<CorsairSessionStateChangedHandler, nint, CorsairError>)LoadFunction("CorsairConnect");
|
||||
_corsairGetSessionDetails = (delegate* unmanaged[Cdecl]<nint, CorsairError>)LoadFunction("CorsairGetSessionDetails");
|
||||
|
||||
@ -12,7 +12,7 @@ namespace RGB.NET.Devices.Corsair.Native;
|
||||
/// iCUE-SDK: contains device search filter
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class _CorsairDeviceFilter
|
||||
internal sealed class _CorsairDeviceFilter
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ namespace RGB.NET.Devices.Corsair.Native;
|
||||
/// iCUE-SDK: contains information about device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class _CorsairDeviceInfo
|
||||
internal sealed class _CorsairDeviceInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// iCUE-SDK: enum describing device type
|
||||
|
||||
@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair.Native;
|
||||
/// iCUE-SDK: contains led id and position of led
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class _CorsairLedPosition
|
||||
internal sealed class _CorsairLedPosition
|
||||
{
|
||||
/// <summary>
|
||||
/// iCUE-SDK: unique identifier of led
|
||||
|
||||
@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair.Native;
|
||||
/// iCUE-SDK: contains information about SDK and iCUE versions
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class _CorsairSessionDetails
|
||||
internal sealed class _CorsairSessionDetails
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
|
||||
@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair.Native;
|
||||
/// iCUE-SDK: contains information about session state and client/server versions
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class _CorsairSessionStateChanged
|
||||
internal sealed class _CorsairSessionStateChanged
|
||||
{
|
||||
/// <summary>
|
||||
/// iCUE-SDK: new session state which SDK client has been transitioned to
|
||||
|
||||
@ -13,7 +13,7 @@ namespace RGB.NET.Devices.Corsair.Native;
|
||||
/// iCUE-SDK: contains information about version that consists of three components
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class _CorsairVersion
|
||||
internal sealed class _CorsairVersion
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
@ -49,7 +49,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
<DefineConstants>RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a corsair touchbar.
|
||||
/// </summary>
|
||||
public class CorsairTouchbarRGBDevice : CorsairRGBDevice<CorsairTouchbarRGBDeviceInfo>, ILedStripe
|
||||
public sealed class CorsairTouchbarRGBDevice : CorsairRGBDevice<CorsairTouchbarRGBDeviceInfo>, ILedStripe
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairTouchbarRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairTouchbarRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairTouchbarRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a unknown corsair device.
|
||||
/// </summary>
|
||||
public class CorsairUnknownRGBDevice : CorsairRGBDevice<CorsairUnknownRGBDeviceInfo>, IUnknownDevice
|
||||
public sealed class CorsairUnknownRGBDevice : CorsairRGBDevice<CorsairUnknownRGBDeviceInfo>, IUnknownDevice
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Corsair;
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairUnknownRGBDevice" />.
|
||||
/// </summary>
|
||||
public class CorsairUnknownRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
public sealed class CorsairUnknownRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ namespace RGB.NET.Devices.DMX;
|
||||
/// <summary>
|
||||
/// Represents a device provider responsible for DMX devices.
|
||||
/// </summary>
|
||||
public class DMXDeviceProvider : AbstractRGBDeviceProvider
|
||||
public sealed class DMXDeviceProvider : AbstractRGBDeviceProvider
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ namespace RGB.NET.Devices.DMX.E131;
|
||||
/// <summary>
|
||||
/// Represents the data used to create a E1.31 DMX-device.
|
||||
/// </summary>
|
||||
public class E131DMXDeviceDefinition : IDMXDeviceDefinition
|
||||
public sealed class E131DMXDeviceDefinition : IDMXDeviceDefinition
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.DMX.E131;
|
||||
/// <summary>
|
||||
/// Represents a E1.31-DXM-device.
|
||||
/// </summary>
|
||||
public class E131Device : AbstractRGBDevice<E131DeviceInfo>, IUnknownDevice
|
||||
public sealed class E131Device : AbstractRGBDevice<E131DeviceInfo>, IUnknownDevice
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.DMX.E131;
|
||||
/// <summary>
|
||||
/// Represents device information for a <see cref="E131Device"/> />.
|
||||
/// </summary>
|
||||
public class E131DeviceInfo : IRGBDeviceInfo
|
||||
public sealed class E131DeviceInfo : IRGBDeviceInfo
|
||||
{
|
||||
#region Constants
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ namespace RGB.NET.Devices.DMX.E131;
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for E131-DMX devices.
|
||||
/// </summary>
|
||||
public class E131UpdateQueue : UpdateQueue
|
||||
public sealed class E131UpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.DMX;
|
||||
|
||||
internal class LedChannelMapping : IEnumerable<(int channel, Func<Color, byte> getValue)>
|
||||
internal sealed class LedChannelMapping : IEnumerable<(int channel, Func<Color, byte> getValue)>
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
@ -48,7 +48,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
<DefineConstants>RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -12,7 +12,7 @@ namespace RGB.NET.Devices.Debug;
|
||||
/// <summary>
|
||||
/// Represents a device provider responsible for debug devices.
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
@ -3,7 +3,7 @@ using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Debug;
|
||||
|
||||
internal class DebugDeviceUpdateQueue : UpdateQueue
|
||||
internal sealed class DebugDeviceUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ namespace RGB.NET.Devices.Debug;
|
||||
/// <summary>
|
||||
/// Represents a debug device.
|
||||
/// </summary>
|
||||
public class DebugRGBDevice : AbstractRGBDevice<DebugRGBDeviceInfo>, IUnknownDevice
|
||||
public sealed class DebugRGBDevice : AbstractRGBDevice<DebugRGBDeviceInfo>, IUnknownDevice
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ namespace RGB.NET.Devices.Debug;
|
||||
/// <summary>
|
||||
/// Represents device information for a <see cref="DebugRGBDevice"/> />.
|
||||
/// </summary>
|
||||
public class DebugRGBDeviceInfo : IRGBDeviceInfo
|
||||
public sealed class DebugRGBDeviceInfo : IRGBDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
@ -48,7 +48,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
<DefineConstants>RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -14,7 +14,7 @@ namespace RGB.NET.Devices.Logitech.HID;
|
||||
/// </summary>
|
||||
/// <typeparam name="TLed">The type of the identifier leds are mapped to.</typeparam>
|
||||
/// <typeparam name="TData">The type of the custom data added to the HID-device.</typeparam>
|
||||
public class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefinition<TLed, TData>>
|
||||
public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefinition<TLed, TData>>
|
||||
where TLed : notnull
|
||||
{
|
||||
#region Constants
|
||||
|
||||
@ -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;
|
||||
/// <summary>
|
||||
/// Represents a logitech per-device-lightable device.
|
||||
/// </summary>
|
||||
public class LogitechPerDeviceRGBDevice : LogitechRGBDevice<LogitechRGBDeviceInfo>, 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<LogitechRGBDeviceInfo>, 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<LogitechRGBDeviceInf
|
||||
/// <inheritdoc />
|
||||
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate.Take(1)));
|
||||
|
||||
#endregion
|
||||
}
|
||||
@ -8,7 +8,7 @@ namespace RGB.NET.Devices.Logitech;
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for logitech per-device devices.
|
||||
/// </summary>
|
||||
public class LogitechPerDeviceUpdateQueue : UpdateQueue
|
||||
public sealed class LogitechPerDeviceUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
|
||||
@ -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;
|
||||
/// <summary>
|
||||
/// Represents a logitech per-key-lightable device.
|
||||
/// </summary>
|
||||
public class LogitechPerKeyRGBDevice : LogitechRGBDevice<LogitechRGBDeviceInfo>, 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<LogitechRGBDeviceInfo>, 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<LogitechRGBDeviceInfo>,
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object GetLedCustomData(LedId ledId) => _ledMapping.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : -1;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@ -7,7 +7,7 @@ namespace RGB.NET.Devices.Logitech;
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for logitech per-key devices.
|
||||
/// </summary>
|
||||
public class LogitechPerKeyUpdateQueue : UpdateQueue
|
||||
public sealed class LogitechPerKeyUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
@ -17,8 +17,7 @@ public class LogitechPerKeyUpdateQueue : UpdateQueue
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
public LogitechPerKeyUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
@ -49,7 +49,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
<DefineConstants>RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user