/// <summary> /// Internal constructor of managed <see cref="CorsairRGBDeviceInfo"/>. /// </summary> /// <param name="deviceIndex">The index of the <see cref="CorsairRGBDevice{TDeviceInfo}"/>.</param> /// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param> /// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param> internal CorsairRGBDeviceInfo(int deviceIndex, RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo) { this.CorsairDeviceIndex = deviceIndex; this.DeviceType = deviceType; this.CorsairDeviceType = nativeInfo.type; this.Model = nativeInfo.model == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(nativeInfo.model); this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask; }
internal CorsairRGBDeviceInfo(int deviceIndex, string deviceType, _CorsairDeviceInfo nativeInfo, string modelName, Dictionary <string, int> modelCounter) { this.CorsairDeviceIndex = deviceIndex; this.DeviceType = deviceType; this.CorsairDeviceType = nativeInfo.type; this.Model = modelName; this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask; DeviceName = GetUniqueModelName(modelCounter); }
/// <summary> /// Internal constructor of managed <see cref="CorsairRGBDeviceInfo"/>. /// </summary> /// <param name="deviceIndex">The index of the <see cref="CorsairRGBDevice{TDeviceInfo}"/>.</param> /// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param> /// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param> /// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param> internal CorsairRGBDeviceInfo(int deviceIndex, RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo, Dictionary <string, int> modelCounter) { this.CorsairDeviceIndex = deviceIndex; this.DeviceType = deviceType; this.CorsairDeviceType = nativeInfo.type; this.Model = nativeInfo.model == IntPtr.Zero ? null : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase); this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask; DeviceName = GetUniqueModelName(modelCounter); }
/// <summary> /// Internal constructor of managed CorsairDeviceInfo. /// </summary> /// <param name="nativeInfo">The native CorsairDeviceInfo-struct</param> internal GenericDeviceInfo(_CorsairDeviceInfo nativeInfo) { this.Type = nativeInfo.type; this.Model = nativeInfo.model == IntPtr.Zero ? null : Marshal.PtrToStringAuto(nativeInfo.model); this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask; }
/// <summary> /// Internal constructor of managed <see cref="GenericDeviceInfo"/>. /// </summary> /// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param> internal GenericDeviceInfo(_CorsairDeviceInfo nativeInfo) { this.Type = nativeInfo.type; this.Model = nativeInfo.model == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(nativeInfo.model); this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask; }