mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Compare commits
4 Commits
5e904eb748
...
aa67a606a5
| Author | SHA1 | Date | |
|---|---|---|---|
| aa67a606a5 | |||
| b3145a70d9 | |||
| 437ec50345 | |||
| ea44c0d203 |
@ -88,6 +88,11 @@ public enum RGBDeviceType
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Monitor = 1 << 14,
|
Monitor = 1 << 14,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a generic led-controller.
|
||||||
|
/// </summary>
|
||||||
|
LedController = 1 << 15,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a device where the type is not known or not present in the list.
|
/// Represents a device where the type is not known or not present in the list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -37,7 +37,9 @@ internal static class _CoolerMasterSDK
|
|||||||
if (_dllHandle != IntPtr.Zero) return;
|
if (_dllHandle != IntPtr.Zero) return;
|
||||||
|
|
||||||
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||||
List<string> possiblePathList = Environment.Is64BitProcess ? CoolerMasterDeviceProvider.PossibleX64NativePaths : CoolerMasterDeviceProvider.PossibleX86NativePaths;
|
List<string> possiblePathList = (Environment.Is64BitProcess ? CoolerMasterDeviceProvider.PossibleX64NativePaths : CoolerMasterDeviceProvider.PossibleX86NativePaths)
|
||||||
|
.Select(Environment.ExpandEnvironmentVariables)
|
||||||
|
.ToList();
|
||||||
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
||||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the CoolerMaster-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
if (dllPath == null) throw new RGBDeviceException($"Can't find the CoolerMaster-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
using RGB.NET.Devices.Corsair.Native;
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
@ -141,38 +142,30 @@ public class CorsairDeviceProvider : AbstractRGBDeviceProvider
|
|||||||
case CorsairDeviceType.Cooler:
|
case CorsairDeviceType.Cooler:
|
||||||
case CorsairDeviceType.CommanderPro:
|
case CorsairDeviceType.CommanderPro:
|
||||||
case CorsairDeviceType.LightningNodePro:
|
case CorsairDeviceType.LightningNodePro:
|
||||||
_CorsairChannelsInfo? channelsInfo = nativeDeviceInfo.channels;
|
List<_CorsairChannelInfo> channels = GetChannels(nativeDeviceInfo).ToList();
|
||||||
if (channelsInfo != null)
|
int channelsLedCount = channels.Sum(x => x.totalLedsCount);
|
||||||
|
int deviceLedCount = nativeDeviceInfo.ledsCount - channelsLedCount;
|
||||||
|
|
||||||
|
if (deviceLedCount > 0)
|
||||||
|
yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(i, nativeDeviceInfo, deviceLedCount), updateQueue);
|
||||||
|
|
||||||
|
int ledOffset = deviceLedCount;
|
||||||
|
foreach (_CorsairChannelInfo channelInfo in channels)
|
||||||
{
|
{
|
||||||
IntPtr channelInfoPtr = channelsInfo.channels;
|
int channelDeviceInfoStructSize = Marshal.SizeOf(typeof(_CorsairChannelDeviceInfo));
|
||||||
int ledOffset = 0;
|
IntPtr channelDeviceInfoPtr = channelInfo.devices;
|
||||||
|
for (int device = 0; (device < channelInfo.devicesCount) && (ledOffset < nativeDeviceInfo.ledsCount); device++)
|
||||||
for (int channel = 0; channel < channelsInfo.channelsCount; channel++)
|
|
||||||
{
|
{
|
||||||
CorsairLedId referenceLed = GetChannelReferenceId(nativeDeviceInfo.type, channel);
|
_CorsairChannelDeviceInfo channelDeviceInfo = (_CorsairChannelDeviceInfo)Marshal.PtrToStructure(channelDeviceInfoPtr, typeof(_CorsairChannelDeviceInfo))!;
|
||||||
if (referenceLed == CorsairLedId.Invalid) continue;
|
|
||||||
|
|
||||||
_CorsairChannelInfo channelInfo = (_CorsairChannelInfo)Marshal.PtrToStructure(channelInfoPtr, typeof(_CorsairChannelInfo))!;
|
yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(i, nativeDeviceInfo, channelDeviceInfo, ledOffset), updateQueue);
|
||||||
|
|
||||||
int channelDeviceInfoStructSize = Marshal.SizeOf(typeof(_CorsairChannelDeviceInfo));
|
ledOffset += channelDeviceInfo.deviceLedCount;
|
||||||
IntPtr channelDeviceInfoPtr = channelInfo.devices;
|
channelDeviceInfoPtr = new IntPtr(channelDeviceInfoPtr.ToInt64() + channelDeviceInfoStructSize);
|
||||||
|
|
||||||
for (int device = 0; (device < channelInfo.devicesCount) && (ledOffset < nativeDeviceInfo.ledsCount); device++)
|
|
||||||
{
|
|
||||||
_CorsairChannelDeviceInfo channelDeviceInfo = (_CorsairChannelDeviceInfo)Marshal.PtrToStructure(channelDeviceInfoPtr, typeof(_CorsairChannelDeviceInfo))!;
|
|
||||||
|
|
||||||
yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(i, nativeDeviceInfo, channelDeviceInfo, referenceLed, ledOffset), updateQueue);
|
|
||||||
referenceLed += channelDeviceInfo.deviceLedCount;
|
|
||||||
|
|
||||||
ledOffset += channelDeviceInfo.deviceLedCount;
|
|
||||||
channelDeviceInfoPtr = new IntPtr(channelDeviceInfoPtr.ToInt64() + channelDeviceInfoStructSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
int channelInfoStructSize = Marshal.SizeOf(typeof(_CorsairChannelInfo));
|
|
||||||
channelInfoPtr = new IntPtr(channelInfoPtr.ToInt64() + channelInfoStructSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Throw(new RGBDeviceException("Unknown Device-Type"));
|
Throw(new RGBDeviceException("Unknown Device-Type"));
|
||||||
break;
|
break;
|
||||||
@ -180,18 +173,19 @@ public class CorsairDeviceProvider : AbstractRGBDeviceProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CorsairLedId GetChannelReferenceId(CorsairDeviceType deviceType, int channel)
|
private static IEnumerable<_CorsairChannelInfo> GetChannels(_CorsairDeviceInfo deviceInfo)
|
||||||
{
|
{
|
||||||
if (deviceType == CorsairDeviceType.Cooler)
|
_CorsairChannelsInfo? channelsInfo = deviceInfo.channels;
|
||||||
return CorsairLedId.CustomLiquidCoolerChannel1Led1;
|
if (channelsInfo == null) yield break;
|
||||||
|
|
||||||
return channel switch
|
IntPtr channelInfoPtr = channelsInfo.channels;
|
||||||
|
for (int channel = 0; channel < channelsInfo.channelsCount; channel++)
|
||||||
{
|
{
|
||||||
0 => CorsairLedId.CustomDeviceChannel1Led1,
|
yield return (_CorsairChannelInfo)Marshal.PtrToStructure(channelInfoPtr, typeof(_CorsairChannelInfo))!;
|
||||||
1 => CorsairLedId.CustomDeviceChannel2Led1,
|
|
||||||
2 => CorsairLedId.CustomDeviceChannel3Led1,
|
int channelInfoStructSize = Marshal.SizeOf(typeof(_CorsairChannelInfo));
|
||||||
_ => CorsairLedId.Invalid
|
channelInfoPtr = new IntPtr(channelInfoPtr.ToInt64() + channelInfoStructSize);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@ -17,11 +17,6 @@ public class CorsairCustomRGBDeviceInfo : CorsairRGBDeviceInfo
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the corsair-id of the first LED of this device.
|
|
||||||
/// </summary>
|
|
||||||
public CorsairLedId ReferenceCorsairLed { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the amount of LEDs this device contains.
|
/// Gets the amount of LEDs this device contains.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -36,7 +31,6 @@ public class CorsairCustomRGBDeviceInfo : CorsairRGBDeviceInfo
|
|||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
//TODO DarthAffe 07.07.2018: DAP is a fan right now, that's most likely wrong
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairCustomRGBDeviceInfo" />.
|
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairCustomRGBDeviceInfo" />.
|
||||||
@ -44,18 +38,24 @@ public class CorsairCustomRGBDeviceInfo : CorsairRGBDeviceInfo
|
|||||||
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair._CorsairChannelDeviceInfo" />.</param>
|
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair._CorsairChannelDeviceInfo" />.</param>
|
||||||
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||||
/// <param name="channelDeviceInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairChannelDeviceInfo"/> representing this device.</param>
|
/// <param name="channelDeviceInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairChannelDeviceInfo"/> representing this device.</param>
|
||||||
/// <param name="referenceCorsairLed">The id of the first LED of this device.</param>
|
|
||||||
/// <param name="ledOffset">The offset used to find the LEDs of this device.</param>
|
/// <param name="ledOffset">The offset used to find the LEDs of this device.</param>
|
||||||
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo, CorsairLedId referenceCorsairLed, int ledOffset)
|
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo, int ledOffset)
|
||||||
: base(deviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
|
: base(deviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
|
||||||
GetModelName(nativeInfo.model == IntPtr.Zero ? string.Empty : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase), channelDeviceInfo))
|
GetModelName(nativeInfo.model == IntPtr.Zero ? string.Empty : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase), channelDeviceInfo))
|
||||||
{
|
{
|
||||||
this.ReferenceCorsairLed = referenceCorsairLed;
|
|
||||||
this.LedOffset = ledOffset;
|
this.LedOffset = ledOffset;
|
||||||
|
|
||||||
LedCount = channelDeviceInfo.deviceLedCount;
|
LedCount = channelDeviceInfo.deviceLedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, int ledCount)
|
||||||
|
: base(deviceIndex, GetDeviceType(nativeInfo.type), nativeInfo)
|
||||||
|
{
|
||||||
|
this.LedCount = ledCount;
|
||||||
|
|
||||||
|
LedOffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
@ -77,6 +77,24 @@ public class CorsairCustomRGBDeviceInfo : CorsairRGBDeviceInfo
|
|||||||
_ => throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null)
|
_ => throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static RGBDeviceType GetDeviceType(CorsairDeviceType deviceType)
|
||||||
|
=> deviceType switch
|
||||||
|
{
|
||||||
|
CorsairDeviceType.Unknown => RGBDeviceType.Unknown,
|
||||||
|
CorsairDeviceType.Mouse => RGBDeviceType.Mouse,
|
||||||
|
CorsairDeviceType.Keyboard => RGBDeviceType.Keyboard,
|
||||||
|
CorsairDeviceType.Headset => RGBDeviceType.Headset,
|
||||||
|
CorsairDeviceType.Mousepad => RGBDeviceType.Mousepad,
|
||||||
|
CorsairDeviceType.HeadsetStand => RGBDeviceType.HeadsetStand,
|
||||||
|
CorsairDeviceType.CommanderPro => RGBDeviceType.LedController,
|
||||||
|
CorsairDeviceType.LightningNodePro => RGBDeviceType.LedController,
|
||||||
|
CorsairDeviceType.MemoryModule => RGBDeviceType.DRAM,
|
||||||
|
CorsairDeviceType.Cooler => RGBDeviceType.Cooler,
|
||||||
|
CorsairDeviceType.Mainboard => RGBDeviceType.Mainboard,
|
||||||
|
CorsairDeviceType.GraphicsCard => RGBDeviceType.GraphicsCard,
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null)
|
||||||
|
};
|
||||||
|
|
||||||
private static string GetModelName(string model, _CorsairChannelDeviceInfo channelDeviceInfo)
|
private static string GetModelName(string model, _CorsairChannelDeviceInfo channelDeviceInfo)
|
||||||
{
|
{
|
||||||
switch (channelDeviceInfo.type)
|
switch (channelDeviceInfo.type)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ internal static class _CUESDK
|
|||||||
#region Libary Management
|
#region Libary Management
|
||||||
|
|
||||||
private static IntPtr _dllHandle = IntPtr.Zero;
|
private static IntPtr _dllHandle = IntPtr.Zero;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reloads the SDK.
|
/// Reloads the SDK.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -32,7 +32,9 @@ internal static class _CUESDK
|
|||||||
if (_dllHandle != IntPtr.Zero) return;
|
if (_dllHandle != IntPtr.Zero) return;
|
||||||
|
|
||||||
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||||
List<string> possiblePathList = Environment.Is64BitProcess ? CorsairDeviceProvider.PossibleX64NativePaths : CorsairDeviceProvider.PossibleX86NativePaths;
|
List<string> possiblePathList = (Environment.Is64BitProcess ? CorsairDeviceProvider.PossibleX64NativePaths : CorsairDeviceProvider.PossibleX86NativePaths)
|
||||||
|
.Select(Environment.ExpandEnvironmentVariables)
|
||||||
|
.ToList();
|
||||||
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
||||||
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 (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))}'");
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ internal class _LogitechGSDK
|
|||||||
#region Libary Management
|
#region Libary Management
|
||||||
|
|
||||||
private static IntPtr _dllHandle = IntPtr.Zero;
|
private static IntPtr _dllHandle = IntPtr.Zero;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reloads the SDK.
|
/// Reloads the SDK.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -33,7 +33,9 @@ internal class _LogitechGSDK
|
|||||||
if (_dllHandle != IntPtr.Zero) return;
|
if (_dllHandle != IntPtr.Zero) return;
|
||||||
|
|
||||||
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||||
List<string> possiblePathList = Environment.Is64BitProcess ? LogitechDeviceProvider.PossibleX64NativePaths : LogitechDeviceProvider.PossibleX86NativePaths;
|
List<string> possiblePathList = (Environment.Is64BitProcess ? LogitechDeviceProvider.PossibleX64NativePaths : LogitechDeviceProvider.PossibleX86NativePaths)
|
||||||
|
.Select(Environment.ExpandEnvironmentVariables)
|
||||||
|
.ToList();
|
||||||
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
||||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the Logitech-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
if (dllPath == null) throw new RGBDeviceException($"Can't find the Logitech-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,9 @@ internal static class _MsiSDK
|
|||||||
if (_dllHandle != IntPtr.Zero) return;
|
if (_dllHandle != IntPtr.Zero) return;
|
||||||
|
|
||||||
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||||
List<string> possiblePathList = Environment.Is64BitProcess ? MsiDeviceProvider.PossibleX64NativePaths : MsiDeviceProvider.PossibleX86NativePaths;
|
List<string> possiblePathList = (Environment.Is64BitProcess ? MsiDeviceProvider.PossibleX64NativePaths : MsiDeviceProvider.PossibleX86NativePaths)
|
||||||
|
.Select(Environment.ExpandEnvironmentVariables)
|
||||||
|
.ToList();
|
||||||
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
||||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the Msi-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
if (dllPath == null) throw new RGBDeviceException($"Can't find the Msi-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||||
|
|
||||||
|
|||||||
@ -32,8 +32,10 @@ internal static class _RazerSDK
|
|||||||
if (_dllHandle != IntPtr.Zero) return;
|
if (_dllHandle != IntPtr.Zero) return;
|
||||||
|
|
||||||
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||||
List<string> possiblePathList = Environment.Is64BitProcess ? RazerDeviceProvider.PossibleX64NativePaths : RazerDeviceProvider.PossibleX86NativePaths;
|
List<string> possiblePathList = (Environment.Is64BitProcess ? RazerDeviceProvider.PossibleX64NativePaths : RazerDeviceProvider.PossibleX86NativePaths)
|
||||||
string? dllPath = possiblePathList.Select(Environment.ExpandEnvironmentVariables).FirstOrDefault(File.Exists);
|
.Select(Environment.ExpandEnvironmentVariables)
|
||||||
|
.ToList();
|
||||||
|
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
||||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the Razer-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
if (dllPath == null) throw new RGBDeviceException($"Can't find the Razer-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||||
|
|
||||||
_dllHandle = LoadLibrary(dllPath);
|
_dllHandle = LoadLibrary(dllPath);
|
||||||
@ -163,15 +165,15 @@ internal static class _RazerSDK
|
|||||||
internal static RazerError CreateEffect(Guid deviceId, int effectType, IntPtr param, ref Guid effectId) => (_createEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(deviceId, effectType, param, ref effectId);
|
internal static RazerError CreateEffect(Guid deviceId, int effectType, IntPtr param, ref Guid effectId) => (_createEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(deviceId, effectType, param, ref effectId);
|
||||||
|
|
||||||
internal static RazerError CreateHeadsetEffect(int effectType, IntPtr param, ref Guid effectId) => (_createHeadsetEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
internal static RazerError CreateHeadsetEffect(int effectType, IntPtr param, ref Guid effectId) => (_createHeadsetEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||||
|
|
||||||
internal static RazerError CreateChromaLinkEffect(int effectType, IntPtr param, ref Guid effectId) => (_createChromaLinkEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
internal static RazerError CreateChromaLinkEffect(int effectType, IntPtr param, ref Guid effectId) => (_createChromaLinkEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||||
|
|
||||||
internal static RazerError CreateKeyboardEffect(int effectType, IntPtr param, ref Guid effectId) => (_createKeyboardEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
internal static RazerError CreateKeyboardEffect(int effectType, IntPtr param, ref Guid effectId) => (_createKeyboardEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||||
|
|
||||||
internal static RazerError CreateKeypadEffect(int effectType, IntPtr param, ref Guid effectId) => (_createKeypadEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
internal static RazerError CreateKeypadEffect(int effectType, IntPtr param, ref Guid effectId) => (_createKeypadEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||||
|
|
||||||
internal static RazerError CreateMouseEffect(int effectType, IntPtr param, ref Guid effectId) => (_createMouseEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
internal static RazerError CreateMouseEffect(int effectType, IntPtr param, ref Guid effectId) => (_createMouseEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||||
|
|
||||||
internal static RazerError CreateMousepadEffect(int effectType, IntPtr param, ref Guid effectId) => (_createMousepadEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
internal static RazerError CreateMousepadEffect(int effectType, IntPtr param, ref Guid effectId) => (_createMousepadEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectType, param, ref effectId);
|
||||||
|
|
||||||
internal static RazerError SetEffect(Guid effectId) => (_setEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectId);
|
internal static RazerError SetEffect(Guid effectId) => (_setEffectPointer ?? throw new RGBDeviceException("The Razer-SDK is not initialized.")).Invoke(effectId);
|
||||||
|
|||||||
@ -32,7 +32,9 @@ internal static class _WootingSDK
|
|||||||
if (_dllHandle != IntPtr.Zero) return;
|
if (_dllHandle != IntPtr.Zero) return;
|
||||||
|
|
||||||
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||||
List<string> possiblePathList = Environment.Is64BitProcess ? WootingDeviceProvider.PossibleX64NativePaths : WootingDeviceProvider.PossibleX86NativePaths;
|
List<string> possiblePathList = (Environment.Is64BitProcess ? WootingDeviceProvider.PossibleX64NativePaths : WootingDeviceProvider.PossibleX86NativePaths)
|
||||||
|
.Select(Environment.ExpandEnvironmentVariables)
|
||||||
|
.ToList();
|
||||||
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
string? dllPath = possiblePathList.FirstOrDefault(File.Exists);
|
||||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the Wooting-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
if (dllPath == null) throw new RGBDeviceException($"Can't find the Wooting-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user