mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 09:38:31 +00:00
More code issues fixed
This commit is contained in:
parent
5633f82b3b
commit
aae509b275
@ -1,5 +1,6 @@
|
||||
#if NET8_0
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace RGB.NET.Core.Compatibility.Net8;
|
||||
|
||||
public sealed class Lock;
|
||||
|
||||
@ -154,9 +154,9 @@ public static class RectangleExtensions
|
||||
Point[] points =
|
||||
[
|
||||
rect.Location, // top left
|
||||
new Point(rect.Location.X + rect.Size.Width, rect.Location.Y), // top right
|
||||
new Point(rect.Location.X + rect.Size.Width, rect.Location.Y + rect.Size.Height), // bottom right
|
||||
new Point(rect.Location.X, rect.Location.Y + rect.Size.Height), // bottom right
|
||||
new(rect.Location.X + rect.Size.Width, rect.Location.Y), // top right
|
||||
new(rect.Location.X + rect.Size.Width, rect.Location.Y + rect.Size.Height), // bottom right
|
||||
new(rect.Location.X, rect.Location.Y + rect.Size.Height), // bottom right
|
||||
];
|
||||
|
||||
float sin = MathF.Sin(rotation.Radians);
|
||||
|
||||
@ -40,7 +40,7 @@ public static class ConversionHelper
|
||||
public static byte[] HexToBytes(ReadOnlySpan<char> hexString)
|
||||
{
|
||||
if ((hexString.Length == 0) || ((hexString.Length % 2) != 0))
|
||||
return Array.Empty<byte>();
|
||||
return [];
|
||||
|
||||
byte[] buffer = new byte[hexString.Length / 2];
|
||||
for (int bx = 0, sx = 0; bx < buffer.Length; ++bx, ++sx)
|
||||
|
||||
@ -37,8 +37,8 @@ public sealed class AsusKeyboardRGBDevice : AsusRGBDevice<AsusKeyboardRGBDeviceI
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static readonly List<AsusKeyboardExtraMapping> ExtraLedMappings =
|
||||
[
|
||||
new AsusKeyboardExtraMapping(new Regex("(ROG Zephyrus Duo 15).*?"), LedMappings.ROGZephyrusDuo15),
|
||||
new AsusKeyboardExtraMapping(new Regex("(ROG Strix G513QM).*?"), LedMappings.ROGStrixG15)
|
||||
new(new Regex("(ROG Zephyrus Duo 15).*?"), LedMappings.ROGZephyrusDuo15),
|
||||
new(new Regex("(ROG Strix G513QM).*?"), LedMappings.ROGStrixG15)
|
||||
];
|
||||
|
||||
#endregion
|
||||
|
||||
@ -36,7 +36,7 @@ public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDevi
|
||||
|
||||
#region Methods
|
||||
|
||||
private static string? GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? "Asus Keyboard" : deviceName;
|
||||
private static string GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? "Asus Keyboard" : deviceName;
|
||||
|
||||
#endregion
|
||||
}
|
||||
@ -133,7 +133,7 @@ internal static unsafe class _CUESDK
|
||||
if (OperatingSystem.IsWindows())
|
||||
possibleLibraryPaths = Environment.Is64BitProcess ? CorsairDeviceProvider.PossibleX64NativePaths : CorsairDeviceProvider.PossibleX86NativePaths;
|
||||
else
|
||||
possibleLibraryPaths = Enumerable.Empty<string>();
|
||||
possibleLibraryPaths = [];
|
||||
|
||||
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
|
||||
}
|
||||
|
||||
@ -124,16 +124,19 @@ public class CorsairCustomRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||
// LS100 Led Strips are reported as one big strip if configured in monitor mode in iCUE, 138 LEDs for dual monitor, 84 for single
|
||||
if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 138))
|
||||
return "LS100 LED Strip (dual monitor)";
|
||||
else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 84))
|
||||
|
||||
if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 84))
|
||||
return "LS100 LED Strip (single monitor)";
|
||||
|
||||
// Any other value means an "External LED Strip" in iCUE, these are reported per-strip, 15 for short strips, 27 for long
|
||||
else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15))
|
||||
if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15))
|
||||
return "LS100 LED Strip (short)";
|
||||
else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 27))
|
||||
|
||||
if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 27))
|
||||
return "LS100 LED Strip (long)";
|
||||
|
||||
// Device model is "Commander Pro" for regular LED strips
|
||||
else
|
||||
return "LED Strip";
|
||||
return "LED Strip";
|
||||
|
||||
case CorsairChannelDeviceType.DAP:
|
||||
return "DAP Fan";
|
||||
|
||||
@ -64,7 +64,7 @@ internal static class _CUESDK
|
||||
if (OperatingSystem.IsWindows())
|
||||
possibleLibraryPaths = Environment.Is64BitProcess ? CorsairLegacyDeviceProvider.PossibleX64NativePaths : CorsairLegacyDeviceProvider.PossibleX86NativePaths;
|
||||
else
|
||||
possibleLibraryPaths = Enumerable.Empty<string>();
|
||||
possibleLibraryPaths = [];
|
||||
|
||||
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
|
||||
getConnectedDevices.Init(LOGITECH_RECEIVER_ADDRESS, LOGITECH_GET_REGISTER_REQUEST);
|
||||
|
||||
stream.Write(getConnectedDevices.AsSpan());
|
||||
stream.Read(response.AsSpan());
|
||||
stream.ReadExactly(response.AsSpan());
|
||||
|
||||
bool wirelessNotifications = (response.Data01 & 1) == 1;
|
||||
if (!wirelessNotifications)
|
||||
@ -150,7 +150,7 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
|
||||
getConnectedDevices.Data1 = 1;
|
||||
|
||||
stream.Write(getConnectedDevices.AsSpan());
|
||||
stream.Read(response.AsSpan());
|
||||
stream.ReadExactly(response.AsSpan());
|
||||
|
||||
if (getConnectedDevices.FeatureIndex == 0x8f)
|
||||
{
|
||||
@ -164,7 +164,7 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
|
||||
getConnectedDevices.FeatureCommand = 0x02;
|
||||
|
||||
stream.Write(getConnectedDevices.AsSpan());
|
||||
stream.Read(response.AsSpan());
|
||||
stream.ReadExactly(response.AsSpan());
|
||||
int deviceCount = response.Data01;
|
||||
if (deviceCount <= 0)
|
||||
return map;
|
||||
@ -180,7 +180,7 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
|
||||
for (int i = 0; i < deviceCount; i++)
|
||||
{
|
||||
FapResponse devices = new();
|
||||
stream.Read(devices.AsSpan());
|
||||
stream.ReadExactly(devices.AsSpan());
|
||||
int wirelessPid = (devices.Data02 << 8) | devices.Data01;
|
||||
if (devices.DeviceIndex != 0xff)
|
||||
map.Add(wirelessPid, devices.DeviceIndex);
|
||||
|
||||
@ -63,7 +63,7 @@ internal static class _LogitechGSDK
|
||||
if (OperatingSystem.IsWindows())
|
||||
possibleLibraryPaths = Environment.Is64BitProcess ? LogitechDeviceProvider.PossibleX64NativePaths : LogitechDeviceProvider.PossibleX86NativePaths;
|
||||
else
|
||||
possibleLibraryPaths = Enumerable.Empty<string>();
|
||||
possibleLibraryPaths = [];
|
||||
|
||||
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ internal static class _MsiSDK
|
||||
if (OperatingSystem.IsWindows())
|
||||
possibleLibraryPaths = Environment.Is64BitProcess ? MsiDeviceProvider.PossibleX64NativePaths : MsiDeviceProvider.PossibleX86NativePaths;
|
||||
else
|
||||
possibleLibraryPaths = Enumerable.Empty<string>();
|
||||
possibleLibraryPaths = [];
|
||||
|
||||
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ internal static class _RazerSDK
|
||||
if (OperatingSystem.IsWindows())
|
||||
possibleLibraryPaths = Environment.Is64BitProcess ? RazerDeviceProvider.PossibleX64NativePaths : RazerDeviceProvider.PossibleX86NativePaths;
|
||||
else
|
||||
possibleLibraryPaths = Enumerable.Empty<string>();
|
||||
possibleLibraryPaths = [];
|
||||
|
||||
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ internal static class _WootingSDK
|
||||
else if (OperatingSystem.IsMacOS())
|
||||
possibleLibraryPaths = WootingDeviceProvider.PossibleNativePathsMacOS;
|
||||
else
|
||||
possibleLibraryPaths = Enumerable.Empty<string>();
|
||||
possibleLibraryPaths = [];
|
||||
|
||||
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user