mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-12 16:58:29 +00:00
Added check for SDK-dll existance
This commit is contained in:
parent
28232a768b
commit
e0790cbc2a
@ -147,6 +147,8 @@ namespace CUE.NET
|
|||||||
if (IsInitialized)
|
if (IsInitialized)
|
||||||
throw new WrapperException("CueSDK is already initialized.");
|
throw new WrapperException("CueSDK is already initialized.");
|
||||||
|
|
||||||
|
_CUESDK.Reload();
|
||||||
|
|
||||||
ProtocolDetails = new CorsairProtocolDetails(_CUESDK.CorsairPerformProtocolHandshake());
|
ProtocolDetails = new CorsairProtocolDetails(_CUESDK.CorsairPerformProtocolHandshake());
|
||||||
|
|
||||||
CorsairError error = LastError;
|
CorsairError error = LastError;
|
||||||
|
|||||||
@ -2,8 +2,10 @@
|
|||||||
// ReSharper disable UnusedMember.Global
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using CUE.NET.Devices.Generic.Enums;
|
using CUE.NET.Devices.Generic.Enums;
|
||||||
|
using CUE.NET.Exceptions;
|
||||||
|
|
||||||
namespace CUE.NET.Native
|
namespace CUE.NET.Native
|
||||||
{
|
{
|
||||||
@ -18,12 +20,7 @@ namespace CUE.NET.Native
|
|||||||
/// Gets the loaded architecture (x64/x86).
|
/// Gets the loaded architecture (x64/x86).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string LoadedArchitecture { get; private set; }
|
internal static string LoadedArchitecture { get; private set; }
|
||||||
|
|
||||||
static _CUESDK()
|
|
||||||
{
|
|
||||||
LoadCUESDK();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reloads the SDK.
|
/// Reloads the SDK.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -38,7 +35,10 @@ namespace CUE.NET.Native
|
|||||||
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
|
||||||
_dllHandle = LoadLibrary((LoadedArchitecture = Environment.Is64BitProcess ? "x64" : "x86") + "/CUESDK_2015.dll");
|
string dllPath = (LoadedArchitecture = Environment.Is64BitProcess ? "x64" : "x86") + "/CUESDK_2015.dll";
|
||||||
|
if (!File.Exists(dllPath)) throw new WrapperException($"Can't find the CUE-SDK at the expected location '{Path.GetFullPath(dllPath)}'");
|
||||||
|
|
||||||
|
_dllHandle = LoadLibrary(dllPath);
|
||||||
|
|
||||||
_corsairSetLedsColorsPointer = (CorsairSetLedsColorsPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairSetLedsColors"), typeof(CorsairSetLedsColorsPointer));
|
_corsairSetLedsColorsPointer = (CorsairSetLedsColorsPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairSetLedsColors"), typeof(CorsairSetLedsColorsPointer));
|
||||||
_corsairGetDeviceCountPointer = (CorsairGetDeviceCountPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairGetDeviceCount"), typeof(CorsairGetDeviceCountPointer));
|
_corsairGetDeviceCountPointer = (CorsairGetDeviceCountPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairGetDeviceCount"), typeof(CorsairGetDeviceCountPointer));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user