diff --git a/Wrapper/CorsairDeviceInfo.cs b/Wrapper/CorsairDeviceInfo.cs index 09d6634..f6c68e0 100644 --- a/Wrapper/CorsairDeviceInfo.cs +++ b/Wrapper/CorsairDeviceInfo.cs @@ -43,6 +43,10 @@ namespace CUE.NET.Wrapper #region Constructors + /// + /// Internal constructor of managed CorsairDeviceInfo. + /// + /// The native CorsairDeviceInfo-struct public CorsairDeviceInfo(_CorsairDeviceInfo nativeInfo) { this.Type = nativeInfo.type; diff --git a/Wrapper/CorsairProtocolDetails.cs b/Wrapper/CorsairProtocolDetails.cs index ea31c73..f6db84d 100644 --- a/Wrapper/CorsairProtocolDetails.cs +++ b/Wrapper/CorsairProtocolDetails.cs @@ -42,7 +42,7 @@ namespace CUE.NET.Wrapper /// /// Boolean that specifies if there were breaking changes between version of protocol implemented by server and client. /// - public byte BreakingChanges { get; } + public bool BreakingChanges { get; } #endregion @@ -58,7 +58,7 @@ namespace CUE.NET.Wrapper this.ServerVersion = nativeDetails.serverVersion == IntPtr.Zero ? null : Marshal.PtrToStringAuto(nativeDetails.serverVersion); this.SdkProtocolVersion = nativeDetails.sdkProtocolVersion; this.ServerProtocolVersion = nativeDetails.serverProtocolVersion; - this.BreakingChanges = nativeDetails.breakingChanges; + this.BreakingChanges = nativeDetails.breakingChanges != 0; } #endregion diff --git a/Wrapper/CueSDK.cs b/Wrapper/CueSDK.cs index 51fff3a..4315e9b 100644 --- a/Wrapper/CueSDK.cs +++ b/Wrapper/CueSDK.cs @@ -38,6 +38,11 @@ namespace CUE.NET.Wrapper if (error != CorsairError.CE_Success) Throw(error); + if (ProtocolDetails.BreakingChanges) + throw new WrapperException("The SDK currently used isn't compatible with the installed version of CUE.\r\n" + + $"CUE-Version: {ProtocolDetails.ServerVersion} (Protocol {ProtocolDetails.ServerProtocolVersion})\r\n" + + $"SDK-Version: {ProtocolDetails.SdkVersion} (Protocol {ProtocolDetails.SdkProtocolVersion})"); + if (exclusiveAccess) { if (!_CUESDK.CorsairRequestControl(CorsairAccessMode.CAM_ExclusiveLightingControl)) @@ -50,6 +55,9 @@ namespace CUE.NET.Wrapper for (int i = 0; i < deviceCount; i++) { CorsairDeviceInfo info = new CorsairDeviceInfo((_CorsairDeviceInfo)Marshal.PtrToStructure(_CUESDK.CorsairGetDeviceInfo(i), typeof(_CorsairDeviceInfo))); + if (!info.CapsMask.HasFlag(CorsairDeviceCaps.CDC_Lighting)) + continue; // Everything that doesn't support lighting control is useless + switch (info.Type) { case CorsairDeviceType.CDT_Keyboard: