1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 01:58:30 +00:00

Fixed code issues

This commit is contained in:
Darth Affe 2021-06-01 23:53:56 +02:00
parent 4466acfbf7
commit 7b0e9152fd
54 changed files with 330 additions and 275 deletions

View File

@ -155,8 +155,8 @@ namespace RGB.NET.Core
/// <returns>The color created from the values.</returns>
public static Color Create(float alpha, float h, float c, float l)
{
(float r, float g, float _b) = CalculateRGBFromHcl(h, c, l);
return new Color(alpha, r, g, _b);
(float r, float g, float b) = CalculateRGBFromHcl(h, c, l);
return new Color(alpha, r, g, b);
}
#endregion
@ -167,6 +167,7 @@ namespace RGB.NET.Core
{
const float RADIANS_DEGREES_CONVERSION = 180.0f / MathF.PI;
// ReSharper disable once InconsistentNaming - b is used above
(float l, float a, float _b) = LabColor.CalculateLabFromRGB(r, g, b);
float h, c;

View File

@ -155,6 +155,7 @@ namespace RGB.NET.Core
/// <returns>The color created from the values.</returns>
public static Color Create(float alpha, float l, float a, float b)
{
// ReSharper disable once InconsistentNaming - b is used above
(float r, float g, float _b) = CalculateRGBFromLab(l, a, b);
return new Color(alpha, r, g, _b);
}

View File

@ -1,4 +1,6 @@
using System;
// ReSharper disable EventNeverSubscribedTo.Global
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

View File

@ -33,7 +33,7 @@ namespace RGB.NET.Core
x = (x * cos) - (y * sin);
y = (x * sin) + (y * cos);
return new Point(x + origin.X, y + origin.Y); ;
return new Point(x + origin.X, y + origin.Y);
}
#endregion

View File

@ -73,7 +73,7 @@ namespace RGB.NET.Core
{
lock (GroupLeds)
foreach (Led led in leds)
if ((led != null) && !ContainsLed(led))
if (!ContainsLed(led))
GroupLeds.Add(led);
}
@ -91,7 +91,6 @@ namespace RGB.NET.Core
{
lock (GroupLeds)
foreach (Led led in leds)
if (led != null)
GroupLeds.Remove(led);
}

View File

@ -1,4 +1,6 @@
using System;
// ReSharper disable EventNeverSubscribedTo.Global
using System;
namespace RGB.NET.Core
{

View File

@ -1,6 +1,7 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using System;
using System.Diagnostics;
namespace RGB.NET.Core
@ -65,9 +66,8 @@ namespace RGB.NET.Core
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="Point" /> equivalent to this <see cref="Point" />; otherwise, <c>false</c>.</returns>
public override bool Equals(object? obj)
{
if (!(obj is Point)) return false;
if (obj is not Point comparePoint) return false;
Point comparePoint = (Point)obj;
return ((float.IsNaN(X) && float.IsNaN(comparePoint.X)) || X.EqualsInTolerance(comparePoint.X))
&& ((float.IsNaN(Y) && float.IsNaN(comparePoint.Y)) || Y.EqualsInTolerance(comparePoint.Y));
}
@ -76,15 +76,7 @@ namespace RGB.NET.Core
/// Returns a hash code for this <see cref="Point" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="Point" />.</returns>
public override int GetHashCode()
{
unchecked
{
int hashCode = X.GetHashCode();
hashCode = (hashCode * 397) ^ Y.GetHashCode();
return hashCode;
}
}
public override int GetHashCode() => HashCode.Combine(X, Y);
#endregion

View File

@ -74,7 +74,7 @@ namespace RGB.NET.Core
{
T[] rent = ArrayPool<T>.Shared.Rent(bufferSize);
Span<T> buffer = new Span<T>(rent).Slice(0, bufferSize);
Span<T> buffer = new Span<T>(rent)[..bufferSize];
GetRegionData(x, y, width, height, buffer);
Span<T> pixelData = stackalloc T[_dataPerPixel];

View File

@ -9,6 +9,7 @@ namespace RGB.NET.Core
{
#region Properties & Fields
/// <inheritdoc />
public abstract double LastUpdateTime { get; protected set; }
#endregion

View File

@ -53,7 +53,7 @@ namespace RGB.NET.Core
if (_currentDataSet.Count == 0) return;
dataSet = ArrayPool<(TIdentifier, TData)>.Shared.Rent(_currentDataSet.Count);
data = new Span<(TIdentifier, TData)>(dataSet).Slice(0, _currentDataSet.Count);
data = new Span<(TIdentifier, TData)>(dataSet)[.._currentDataSet.Count];
int i = 0;
foreach ((TIdentifier key, TData value) in _currentDataSet)
@ -115,6 +115,8 @@ namespace RGB.NET.Core
_updateTrigger.Update -= OnUpdate;
Reset();
GC.SuppressFinalize(this);
}
#endregion

View File

@ -14,7 +14,7 @@ namespace RGB.NET.Core
{
#region Properties & Fields
private AutoResetEvent _mutex = new(false);
private readonly AutoResetEvent _mutex = new(false);
private Task? UpdateTask { get; set; }
private CancellationTokenSource? UpdateTokenSource { get; set; }
private CancellationToken UpdateToken { get; set; }

View File

@ -1,5 +1,6 @@
// ReSharper disable MemberCanBePrivate.Global
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
@ -14,7 +15,7 @@ namespace RGB.NET.Core
{
#region Properties & Fields
private object _lock = new();
private readonly object _lock = new();
protected Task? UpdateTask { get; set; }
protected CancellationTokenSource? UpdateTokenSource { get; set; }
@ -46,6 +47,7 @@ namespace RGB.NET.Core
public TimerUpdateTrigger(bool autostart = true)
{
if (autostart)
// ReSharper disable once VirtualMemberCallInConstructor - HACK DarthAffe 01.06.2021: I've no idea how to correctly handle that case, for now just disable it
Start();
}
@ -109,7 +111,11 @@ namespace RGB.NET.Core
}
/// <inheritdoc />
public override void Dispose() => Stop();
public override void Dispose()
{
Stop();
GC.SuppressFinalize(this);
}
#endregion
}

View File

@ -7,8 +7,7 @@ namespace RGB.NET.Devices.Asus
/// <summary>
/// A LED mapping containing ASUS keyboard LED IDs
/// </summary>
public static readonly LedMapping<AsusLedId> KeyboardMapping =
new()
public static LedMapping<AsusLedId> KeyboardMapping { get; } = new()
{
{ LedId.Keyboard_Escape, AsusLedId.KEY_ESCAPE },
{ LedId.Keyboard_F1, AsusLedId.KEY_F1 },
@ -170,8 +169,7 @@ namespace RGB.NET.Devices.Asus
/// </para>
/// <para>You may add more of these by further populating <see cref="AsusKeyboardRGBDevice.ExtraLedMappings"/>.</para>
/// </summary>
public static readonly LedMapping<int> ROGZephyrusDuo15 =
new()
public static LedMapping<int> ROGZephyrusDuo15 { get; } = new()
{
{ LedId.Keyboard_Custom50, 39 }, // Mapping starts at Custom50 to avoid possible conflicts with KeyboardMapping above
{ LedId.Keyboard_Custom51, 40 },

View File

@ -15,7 +15,7 @@ namespace RGB.NET.Devices.Asus
/// The ASUS SDK returns useless names for notebook keyboards, possibly for others as well.
/// Keep a list of those and rely on <see cref="WMIHelper.GetSystemModelInfo()"/> to get the real model
/// </summary>
private static List<string> GenericDeviceNames = new() {"NotebookKeyboard"};
private static readonly List<string> GENERIC_DEVICE_NAMES = new() { "NotebookKeyboard" };
/// <inheritdoc />
public KeyboardLayoutType Layout => KeyboardLayoutType.Unknown;
@ -37,10 +37,7 @@ namespace RGB.NET.Devices.Asus
#region Methods
private static string? GetKeyboardModel(string deviceName)
{
return GenericDeviceNames.Contains(deviceName) ? WMIHelper.GetSystemModelInfo() : deviceName;
}
private static string? GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? WMIHelper.GetSystemModelInfo() : deviceName;
#endregion
}

View File

@ -44,7 +44,7 @@ namespace RGB.NET.Devices.CoolerMaster
this.DeviceType = deviceType;
this.DeviceIndex = deviceIndex;
Model = deviceIndex.GetDescription() ?? "Unknown";
Model = deviceIndex.GetDescription();
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
}

View File

@ -12,7 +12,7 @@ namespace RGB.NET.Devices.CoolerMaster
{
#region Properties & Fields
private CoolerMasterDevicesIndexes _deviceIndex;
private readonly CoolerMasterDevicesIndexes _deviceIndex;
private readonly _CoolerMasterColorMatrix _deviceMatrix;
#endregion
@ -29,8 +29,7 @@ namespace RGB.NET.Devices.CoolerMaster
{
this._deviceIndex = deviceIndex;
_deviceMatrix = new _CoolerMasterColorMatrix();
_deviceMatrix.KeyColor = new _CoolerMasterKeyColor[_CoolerMasterColorMatrix.ROWS, _CoolerMasterColorMatrix.COLUMNS];
_deviceMatrix = new _CoolerMasterColorMatrix { KeyColor = new _CoolerMasterKeyColor[_CoolerMasterColorMatrix.ROWS, _CoolerMasterColorMatrix.COLUMNS] };
}
#endregion

View File

@ -15,7 +15,7 @@ namespace RGB.NET.Devices.CoolerMaster.Helper
/// </summary>
/// <param name="source">The enum value to get the description from.</param>
/// <returns>The value of the <see cref="DescriptionAttribute"/> or the <see cref="Enum.ToString()" /> result of the source.</returns>
internal static string? GetDescription(this Enum source)
internal static string GetDescription(this Enum source)
=> source.GetAttribute<DescriptionAttribute>()?.Description ?? source.ToString();
/// <summary>

View File

@ -18,7 +18,9 @@ namespace RGB.NET.Devices.CoolerMaster
/// <param name="info">The specific information provided by CoolerMaster for the mouse</param>
internal CoolerMasterMouseRGBDevice(CoolerMasterMouseRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
: base(info, updateTrigger)
{ }
{
InitializeLayout();
}
#endregion

View File

@ -1,4 +1,5 @@
// ReSharper disable UnusedMethodReturnValue.Global
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable UnusedMethodReturnValue.Global
// ReSharper disable UnusedMember.Global
using System;
@ -53,13 +54,10 @@ namespace RGB.NET.Devices.CoolerMaster.Native
_setAllLedColorPointer = (SetAllLedColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetAllLedColor"), typeof(SetAllLedColorPointer));
}
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
private static extern bool FreeLibrary(IntPtr dllHandle);
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr GetProcAddress(IntPtr dllHandle, string name);
#endregion

View File

@ -80,7 +80,7 @@ namespace RGB.NET.Devices.Corsair
// DarthAffe 02.02.2021: 127 is iCUE
if (!_CUESDK.CorsairSetLayerPriority(128))
Throw(new CUEException(LastError), false);
Throw(new CUEException(LastError));
}
/// <inheritdoc />

View File

@ -1,4 +1,5 @@
// ReSharper disable UnusedMethodReturnValue.Global
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable UnusedMethodReturnValue.Global
// ReSharper disable UnusedMember.Global
using System;
@ -61,13 +62,13 @@ namespace RGB.NET.Devices.Corsair.Native
_dllHandle = IntPtr.Zero;
}
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
private static extern bool FreeLibrary(IntPtr dllHandle);
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr GetProcAddress(IntPtr dllHandle, string name);
#endregion

View File

@ -1,6 +1,8 @@
#pragma warning disable 169 // Field 'x' is never used
#pragma warning disable 414 // Field 'x' is assigned but its value never used
#pragma warning disable 649 // Field 'x' is never assigned
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable NotAccessedField.Global
using System.Runtime.InteropServices;

View File

@ -15,7 +15,7 @@ namespace RGB.NET.Devices.DMX.E131
/// <summary>
/// The UDP-Connection used to send data.
/// </summary>
private UdpClient _socket;
private readonly UdpClient _socket;
/// <summary>
/// Gets the byte-representation of a E1.31 packet as described in http://tsp.esta.org/tsp/documents/docs/E1-31-2016.pdf.
@ -26,7 +26,7 @@ namespace RGB.NET.Devices.DMX.E131
/// <summary>
/// The sequence-number used to detect the order in which packages where sent.
/// </summary>
private byte _sequenceNumber = 0;
private byte _sequenceNumber;
#endregion

View File

@ -1,4 +1,4 @@
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
// ReSharper disable InconsistentNaming
namespace RGB.NET.Devices.Logitech
{

View File

@ -140,10 +140,10 @@ namespace RGB.NET.Devices.Logitech
//TODO DarthAffe 04.03.2021: Rework device selection and configuration for HID-based providers
protected override IEnumerable<IRGBDevice> LoadDevices()
{
IEnumerable<(HIDDeviceDefinition<LogitechLedId, int> definition, HidDevice device)> perKeyDevices = PerKeyDeviceDefinitions.GetConnectedDevices();
if ((_perKeyUpdateQueue != null) && perKeyDevices.Any())
(HIDDeviceDefinition<LogitechLedId, int> definition, HidDevice device) perKeyDevice = PerKeyDeviceDefinitions.GetConnectedDevices().FirstOrDefault();
if ((_perKeyUpdateQueue != null) && (perKeyDevice != default))
{
(HIDDeviceDefinition<LogitechLedId, int> definition, _) = perKeyDevices.First();
(HIDDeviceDefinition<LogitechLedId, int> definition, _) = perKeyDevice;
yield return new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(definition.DeviceType, definition.Name, LogitechDeviceCaps.PerKeyRGB, 0), _perKeyUpdateQueue, definition.LedMapping);
}
@ -154,10 +154,10 @@ namespace RGB.NET.Devices.Logitech
yield return new LogitechZoneRGBDevice(new LogitechRGBDeviceInfo(definition.DeviceType, definition.Name, LogitechDeviceCaps.DeviceRGB, definition.CustomData.zones), updateQueue, definition.LedMapping);
}
IEnumerable<(HIDDeviceDefinition<int, int> definition, HidDevice device)> perDeviceDevices = PerDeviceDeviceDefinitions.GetConnectedDevices();
if ((_perDeviceUpdateQueue != null) && perDeviceDevices.Any())
(HIDDeviceDefinition<int, int> definition, HidDevice device) perDeviceDevice = PerDeviceDeviceDefinitions.GetConnectedDevices().FirstOrDefault();
if ((_perDeviceUpdateQueue != null) && (perDeviceDevice != default))
{
(HIDDeviceDefinition<int, int> definition, _) = perDeviceDevices.First();
(HIDDeviceDefinition<int, int> definition, _) = perDeviceDevice;
yield return new LogitechPerDeviceRGBDevice(new LogitechRGBDeviceInfo(definition.DeviceType, definition.Name, LogitechDeviceCaps.DeviceRGB, 0), _perDeviceUpdateQueue, definition.LedMapping);
}
}
@ -172,6 +172,8 @@ namespace RGB.NET.Devices.Logitech
try { _LogitechGSDK.UnloadLogitechGSDK(); }
catch { /* at least we tried */ }
GC.SuppressFinalize(this);
}
#endregion

View File

@ -1,4 +1,5 @@
// ReSharper disable UnusedMethodReturnValue.Global
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable UnusedMethodReturnValue.Global
// ReSharper disable UnusedMember.Global
// ReSharper disable MemberCanBePrivate.Global
@ -62,13 +63,13 @@ namespace RGB.NET.Devices.Logitech.Native
_dllHandle = IntPtr.Zero;
}
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
private static extern bool FreeLibrary(IntPtr dllHandle);
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr GetProcAddress(IntPtr dllHandle, string name);
#endregion

View File

@ -40,7 +40,7 @@ namespace RGB.NET.Devices.Logitech
}
/// <inheritdoc />
protected override object? GetLedCustomData(LedId ledId) => _ledMapping[ledId];
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));

View File

@ -1,4 +1,5 @@
// ReSharper disable UnusedMethodReturnValue.Global
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable UnusedMethodReturnValue.Global
// ReSharper disable UnusedMember.Global
using System;
@ -65,16 +66,16 @@ namespace RGB.NET.Devices.Msi.Native
_dllHandle = IntPtr.Zero;
}
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern bool SetDllDirectory(string lpPathName);
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
private static extern bool FreeLibrary(IntPtr dllHandle);
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr GetProcAddress(IntPtr dllHandle, string name);
#endregion

View File

@ -41,16 +41,13 @@ namespace RGB.NET.Devices.Novation
{
(double hue, double _, double value) = color.GetHSV();
if ((hue >= 330) || (hue < 30))
return (int)Math.Ceiling(value * 3); // red with brightness 1, 2 or 3
if ((hue >= 30) && (hue < 90)) // yellow with brightness 17, 34 or 51
return (int)Math.Ceiling(value * 3) * 17;
if ((hue >= 90) && (hue < 150)) // green with brightness 16, 32 or 48
return (int)Math.Ceiling(value * 3) * 16;
return 0;
return hue switch
{
>= 330 or < 30 => (int)Math.Ceiling(value * 3), // red with brightness 1, 2 or 3
>= 30 and < 90 => (int)Math.Ceiling(value * 3) * 17, // yellow with brightness 17, 34 or 51
>= 90 and < 150 => (int)Math.Ceiling(value * 3) * 16, // green with brightness 16, 32 or 48
_ => 0
};
}
/// <inheritdoc />

View File

@ -5,11 +5,10 @@ using Sanford.Multimedia.Midi;
namespace RGB.NET.Devices.Novation
{
/// <inheritdoc cref="UpdateQueue" />
/// <inheritdoc cref="IDisposable" />
/// <summary>
/// Represents the update-queue performing updates for midi devices.
/// </summary>
public abstract class MidiUpdateQueue : UpdateQueue, IDisposable
public abstract class MidiUpdateQueue : UpdateQueue
{
#region Properties & Fields
@ -66,6 +65,8 @@ namespace RGB.NET.Devices.Novation
base.Dispose();
_outputDevice.Dispose();
GC.SuppressFinalize(this);
}
#endregion

View File

@ -40,7 +40,9 @@ namespace RGB.NET.Devices.Novation
}
/// <inheritdoc />
// ReSharper disable RedundantCast
protected override object GetLedCustomData(LedId ledId) => GetDeviceMapping().TryGetValue(ledId, out (byte mode, byte id, int _, int __) data) ? (data.mode, data.id) : ((byte)0x00, (byte)0x00);
// ReSharper restore RedundantCast
protected virtual Dictionary<LedId, (byte mode, byte id, int x, int y)> GetDeviceMapping()
=> DeviceInfo.LedIdMapping switch

View File

@ -1,4 +1,6 @@
namespace RGB.NET.Devices.PicoPi.Enum
// ReSharper disable InconsistentNaming
namespace RGB.NET.Devices.PicoPi.Enum
{
public enum UpdateMode
{

View File

@ -38,7 +38,7 @@ namespace RGB.NET.Devices.PicoPi
private readonly byte[] _hidSendBuffer;
private readonly byte[] _bulkSendBuffer;
private int _bulkTransferLength = 0;
private int _bulkTransferLength;
public bool IsBulkSupported { get; private set; }
@ -181,7 +181,7 @@ namespace RGB.NET.Devices.PicoPi
{
if ((data.Length == 0) || !IsBulkSupported) return;
Span<byte> sendBuffer = new Span<byte>(_bulkSendBuffer).Slice(2);
Span<byte> sendBuffer = new Span<byte>(_bulkSendBuffer)[2..];
int payloadSize = data.Length;
sendBuffer[_bulkTransferLength++] = (byte)((channel << 4) | COMMAND_UPDATE_BULK);
@ -212,6 +212,8 @@ namespace RGB.NET.Devices.PicoPi
_hidStream.Dispose();
_bulkDevice?.Dispose();
_usbContext?.Dispose();
GC.SuppressFinalize(this);
}
#endregion

View File

@ -3,7 +3,7 @@
/// <summary>
/// Razer-SDK: Error codes for Chroma SDK. If the error is not defined here, refer to WinError.h from the Windows SDK.
/// </summary>
public enum RazerError : int
public enum RazerError
{
/// <summary>
/// Razer-SDK: Invalid.

View File

@ -5,7 +5,7 @@ namespace RGB.NET.Devices.Razer
{
public static class LedMappings
{
public static readonly LedMapping<int> Keyboard = new()
public static LedMapping<int> Keyboard { get; } = new()
{
//Row 0 is empty
@ -154,7 +154,7 @@ namespace RGB.NET.Devices.Razer
//Row 7 is also empty
};
public static readonly LedMapping<int> LaptopKeyboard = new()
public static LedMapping<int> LaptopKeyboard { get; } = new()
{
//Row 0 is empty
@ -272,7 +272,7 @@ namespace RGB.NET.Devices.Razer
//Row 7 is also empty
};
public static readonly LedMapping<int> Mouse = new()
public static LedMapping<int> Mouse { get; } = new()
{
//row 0 empty
@ -316,12 +316,12 @@ namespace RGB.NET.Devices.Razer
};
//TODO DarthAffe 27.04.2021: Are mappings for these possible?
public static readonly LedMapping<int> Mousepad = new();
public static LedMapping<int> Mousepad { get; } = new();
public static readonly LedMapping<int> Headset = new();
public static LedMapping<int> Headset { get; } = new();
public static readonly LedMapping<int> Keypad = new();
public static LedMapping<int> Keypad { get; } = new();
public static readonly LedMapping<int> ChromaLink = new();
public static LedMapping<int> ChromaLink { get; } = new();
}
}

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Razer
@ -32,10 +33,12 @@ namespace RGB.NET.Devices.Razer
/// <inheritdoc />
public override void Dispose()
{
try { UpdateQueue?.Dispose(); }
try { UpdateQueue.Dispose(); }
catch { /* at least we tried */ }
base.Dispose();
GC.SuppressFinalize(this);
}
#endregion

View File

@ -48,7 +48,7 @@ namespace RGB.NET.Devices.Razer
}
/// <inheritdoc />
protected override object? GetLedCustomData(LedId ledId) => _ledMapping[ledId];
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
#endregion
}

View File

@ -46,7 +46,7 @@ namespace RGB.NET.Devices.Razer
}
/// <inheritdoc />
protected override object? GetLedCustomData(LedId ledId) => _ledMapping[ledId];
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
#endregion
}

View File

@ -1,4 +1,7 @@
using System.Runtime.InteropServices;
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
namespace RGB.NET.Devices.Razer.Native
{

View File

@ -1,4 +1,7 @@
namespace RGB.NET.Devices.Razer.Native
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable InconsistentNaming
namespace RGB.NET.Devices.Razer.Native
{
internal static class _Defines
{

View File

@ -1,4 +1,7 @@
using System.Runtime.InteropServices;
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
namespace RGB.NET.Devices.Razer.Native
{

View File

@ -1,4 +1,7 @@
using System.Runtime.InteropServices;
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
namespace RGB.NET.Devices.Razer.Native
{

View File

@ -1,4 +1,7 @@
using System.Runtime.InteropServices;
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
namespace RGB.NET.Devices.Razer.Native
{

View File

@ -1,4 +1,7 @@
using System.Runtime.InteropServices;
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
namespace RGB.NET.Devices.Razer.Native
{

View File

@ -1,4 +1,7 @@
using System.Runtime.InteropServices;
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
namespace RGB.NET.Devices.Razer.Native
{

View File

@ -1,4 +1,5 @@
// ReSharper disable UnusedMethodReturnValue.Global
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable UnusedMethodReturnValue.Global
// ReSharper disable UnusedMember.Global
using System;
@ -61,13 +62,13 @@ namespace RGB.NET.Devices.Razer.Native
_dllHandle = IntPtr.Zero;
}
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
private static extern bool FreeLibrary(IntPtr dllHandle);
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr GetProcAddress(IntPtr dllHandle, string name);
#endregion

View File

@ -13,6 +13,7 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
[JsonPropertyName("event")]
public string? Name { get; set; }
// ReSharper disable once CollectionNeverQueried.Global
[JsonPropertyName("data")]
public Dictionary<string, object> Data { get; } = new();

View File

@ -114,6 +114,9 @@ namespace RGB.NET.Devices.SteelSeries.API
_client.Dispose();
}
#pragma warning disable IDE0051 // Remove unused private members
// ReSharper disable UnusedMethodReturnValue.Local
// ReSharper disable UnusedMember.Local
private static string TriggerEvent(Event e) => PostJson("/game_event", e);
private static string RegisterGoLispHandler(GoLispHandler handler) => PostJson("/load_golisp_handlers", handler);
private static string RegisterEvent(Event e) => PostJson("/register_game_event", e);
@ -122,6 +125,9 @@ namespace RGB.NET.Devices.SteelSeries.API
private static string UnregisterGame(Game game) => PostJson("/remove_game", game);
private static string StopGame(Game game) => PostJson("/stop_game", game);
private static string SendHeartbeat(Game game) => PostJson("/game_heartbeat", game);
// ReSharper restore UnusedMember.Local
// ReSharper restore UnusedMethodReturnValue.Local
#pragma warning restore IDE0051 // Remove unused private members
private static string PostJson(string urlSuffix, object o)
{

View File

@ -1,4 +1,6 @@
namespace RGB.NET.Devices.SteelSeries
// ReSharper disable InconsistentNaming
namespace RGB.NET.Devices.SteelSeries
{
public enum SteelSeriesLedId
{

View File

@ -1,4 +1,6 @@
namespace RGB.NET.Devices.Wooting.Enum
// ReSharper disable InconsistentNaming
namespace RGB.NET.Devices.Wooting.Enum
{
public enum WootingDeviceType
{

View File

@ -1,4 +1,7 @@
using System.Runtime.InteropServices;
#pragma warning disable IDE1006 // Naming Styles
// ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
using RGB.NET.Devices.Wooting.Enum;
namespace RGB.NET.Devices.Wooting.Native

View File

@ -149,8 +149,6 @@ namespace RGB.NET.Layout
XmlNode? node = (customData as XmlNode) ?? (customData as IEnumerable<XmlNode>)?.FirstOrDefault()?.ParentNode; //HACK DarthAffe 16.01.2021: This gives us the CustomData-Node
if ((node == null) || (type == null)) return null;
if (type == null) return null;
using MemoryStream ms = new();
using StreamWriter writer = new(ms);

View File

@ -1,4 +1,6 @@
using System;
// ReSharper disable EventNeverSubscribedTo.Global
using System;
using RGB.NET.Core;
using RGB.NET.Presets.Decorators;

View File

@ -258,13 +258,16 @@
<s:String x:Key="/Default/CodeStyle/Generate/=Properties/Options/=DebuggerStepsThrough/@EntryIndexedValue">False</s:String>
<s:String x:Key="/Default/CodeStyle/Generate/=Properties/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
<s:Boolean x:Key="/Default/CodeStyle/IntroduceVariableUseVar/UseVarForIntroduceVariableRefactoringEvident/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=131DMX/@EntryIndexedValue">131DMX</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AFBG/@EntryIndexedValue">AFBG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=API/@EntryIndexedValue">API</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ARGB/@EntryIndexedValue">ARGB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BGR/@EntryIndexedValue">BGR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BWZ/@EntryIndexedValue">BWZ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CID/@EntryIndexedValue">CID</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CM/@EntryIndexedValue">CM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CMSDK/@EntryIndexedValue">CMSDK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CUE/@EntryIndexedValue">CUE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CUESDK/@EntryIndexedValue">CUESDK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DB/@EntryIndexedValue">DB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DG/@EntryIndexedValue">DG</s:String>
@ -273,6 +276,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EK/@EntryIndexedValue">EK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FM/@EntryIndexedValue">FM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GEZ/@EntryIndexedValue">GEZ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GSDK/@EntryIndexedValue">GSDK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HID/@EntryIndexedValue">HID</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HS/@EntryIndexedValue">HS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HSV/@EntryIndexedValue">HSV</s:String>
@ -284,6 +288,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PDF/@EntryIndexedValue">PDF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PLZ/@EntryIndexedValue">PLZ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RGB/@EntryIndexedValue">RGB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ROG/@EntryIndexedValue">ROG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SAP/@EntryIndexedValue">SAP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SDK/@EntryIndexedValue">SDK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String>