// ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedAutoPropertyAccessor.Global using System; using System.Runtime.InteropServices; using RGB.NET.Devices.Corsair.Native; namespace RGB.NET.Devices.Corsair; /// /// Managed wrapper for CorsairProtocolDetails. /// public class CorsairProtocolDetails { #region Properties & Fields /// /// String containing version of SDK(like "1.0.0.1"). /// Always contains valid value even if there was no CUE found. /// public string? SdkVersion { get; } /// /// String containing version of CUE(like "1.0.0.1") or NULL if CUE was not found. /// public string? ServerVersion { get; } /// /// Integer that specifies version of protocol that is implemented by current SDK. /// Numbering starts from 1. /// Always contains valid value even if there was no CUE found. /// public int SdkProtocolVersion { get; } /// /// Integer that specifies version of protocol that is implemented by CUE. /// Numbering starts from 1. /// If CUE was not found then this value will be 0. /// public int ServerProtocolVersion { get; } /// /// Boolean that specifies if there were breaking changes between version of protocol implemented by server and client. /// public bool BreakingChanges { get; } #endregion #region Constructors /// /// Internal constructor of managed CorsairProtocolDetails. /// /// The native CorsairProtocolDetails-struct internal CorsairProtocolDetails(_CorsairProtocolDetails nativeDetails) { this.SdkVersion = nativeDetails.sdkVersion == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(nativeDetails.sdkVersion); this.ServerVersion = nativeDetails.serverVersion == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(nativeDetails.serverVersion); this.SdkProtocolVersion = nativeDetails.sdkProtocolVersion; this.ServerProtocolVersion = nativeDetails.serverProtocolVersion; this.BreakingChanges = nativeDetails.breakingChanges != 0; } #endregion }