mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Added memory- and cooler-support introduced with the new corsair-SDK-version
This commit is contained in:
parent
6995259ea8
commit
6c225bbfc4
@ -201,6 +201,11 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
yield return new CorsairHeadsetStandRGBDevice(new CorsairHeadsetStandRGBDeviceInfo(i, nativeDeviceInfo, modelCounter));
|
yield return new CorsairHeadsetStandRGBDevice(new CorsairHeadsetStandRGBDeviceInfo(i, nativeDeviceInfo, modelCounter));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CorsairDeviceType.MemoryModule:
|
||||||
|
yield return new CorsairMemoryRGBDevice(new CorsairMemoryRGBDeviceInfo(i, nativeDeviceInfo, modelCounter));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CorsairDeviceType.Cooler:
|
||||||
case CorsairDeviceType.CommanderPro:
|
case CorsairDeviceType.CommanderPro:
|
||||||
case CorsairDeviceType.LightningNodePro:
|
case CorsairDeviceType.LightningNodePro:
|
||||||
_CorsairChannelsInfo channelsInfo = nativeDeviceInfo.channels;
|
_CorsairChannelsInfo channelsInfo = nativeDeviceInfo.channels;
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// <param name="referenceCorsairLed">The id of the first led of this device.</param>
|
/// <param name="referenceCorsairLed">The id of the first led of this device.</param>
|
||||||
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo,
|
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo,
|
||||||
CorsairLedId referenceCorsairLed, Dictionary<string, int> modelCounter)
|
CorsairLedId referenceCorsairLed, Dictionary<string, int> modelCounter)
|
||||||
: base(deviceIndex, channelDeviceInfo.type == CorsairChannelDeviceType.Strip ? RGBDeviceType.LedStripe : RGBDeviceType.Fan, nativeInfo,
|
: base(deviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
|
||||||
GetModelName(channelDeviceInfo.type), modelCounter)
|
GetModelName(channelDeviceInfo.type), modelCounter)
|
||||||
{
|
{
|
||||||
this.ReferenceCorsairLed = referenceCorsairLed;
|
this.ReferenceCorsairLed = referenceCorsairLed;
|
||||||
@ -46,6 +46,31 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
|
private static RGBDeviceType GetDeviceType(CorsairChannelDeviceType deviceType)
|
||||||
|
{
|
||||||
|
switch (deviceType)
|
||||||
|
{
|
||||||
|
case CorsairChannelDeviceType.Invalid:
|
||||||
|
return RGBDeviceType.Unknown;
|
||||||
|
|
||||||
|
case CorsairChannelDeviceType.FanHD:
|
||||||
|
case CorsairChannelDeviceType.FanSP:
|
||||||
|
case CorsairChannelDeviceType.FanLL:
|
||||||
|
case CorsairChannelDeviceType.FanML:
|
||||||
|
case CorsairChannelDeviceType.DAP:
|
||||||
|
return RGBDeviceType.Fan;
|
||||||
|
|
||||||
|
case CorsairChannelDeviceType.Strip:
|
||||||
|
return RGBDeviceType.LedStripe;
|
||||||
|
|
||||||
|
case CorsairChannelDeviceType.Pump:
|
||||||
|
return RGBDeviceType.Cooler;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static string GetModelName(CorsairChannelDeviceType deviceType)
|
private static string GetModelName(CorsairChannelDeviceType deviceType)
|
||||||
{
|
{
|
||||||
switch (deviceType)
|
switch (deviceType)
|
||||||
@ -71,6 +96,9 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
case CorsairChannelDeviceType.DAP:
|
case CorsairChannelDeviceType.DAP:
|
||||||
return "DAP Fan";
|
return "DAP Fan";
|
||||||
|
|
||||||
|
case CorsairChannelDeviceType.Pump:
|
||||||
|
return "Pump";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null);
|
throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,5 +18,6 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
FanML = 4,
|
FanML = 4,
|
||||||
Strip = 5,
|
Strip = 5,
|
||||||
DAP = 6,
|
DAP = 6,
|
||||||
|
Pump = 7
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,11 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// For devices that has controlled lighting.
|
/// For devices that has controlled lighting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Lighting = 1
|
Lighting = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For devices that provide current state through set of properties.
|
||||||
|
/// </summary>
|
||||||
|
PropertyLookup = 2
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,8 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
Mousepad = 4,
|
Mousepad = 4,
|
||||||
HeadsetStand = 5,
|
HeadsetStand = 5,
|
||||||
CommanderPro = 6,
|
CommanderPro = 6,
|
||||||
LightningNodePro = 7
|
LightningNodePro = 7,
|
||||||
|
MemoryModule = 8,
|
||||||
|
Cooler = 9
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -517,5 +517,270 @@ namespace RGB.NET.Devices.Corsair
|
|||||||
CustomDeviceChannel2Led148 = 497,
|
CustomDeviceChannel2Led148 = 497,
|
||||||
CustomDeviceChannel2Led149 = 498,
|
CustomDeviceChannel2Led149 = 498,
|
||||||
CustomDeviceChannel2Led150 = 499,
|
CustomDeviceChannel2Led150 = 499,
|
||||||
|
|
||||||
|
OemLed1 = 500,
|
||||||
|
OemLed2 = 501,
|
||||||
|
OemLed3 = 502,
|
||||||
|
OemLed4 = 503,
|
||||||
|
OemLed5 = 504,
|
||||||
|
OemLed6 = 505,
|
||||||
|
OemLed7 = 506,
|
||||||
|
OemLed8 = 507,
|
||||||
|
OemLed9 = 508,
|
||||||
|
OemLed10 = 509,
|
||||||
|
OemLed11 = 510,
|
||||||
|
OemLed12 = 511,
|
||||||
|
OemLed13 = 512,
|
||||||
|
OemLed14 = 513,
|
||||||
|
OemLed15 = 514,
|
||||||
|
OemLed16 = 515,
|
||||||
|
OemLed17 = 516,
|
||||||
|
OemLed18 = 517,
|
||||||
|
OemLed19 = 518,
|
||||||
|
OemLed20 = 519,
|
||||||
|
OemLed21 = 520,
|
||||||
|
OemLed22 = 521,
|
||||||
|
OemLed23 = 522,
|
||||||
|
OemLed24 = 523,
|
||||||
|
OemLed25 = 524,
|
||||||
|
OemLed26 = 525,
|
||||||
|
OemLed27 = 526,
|
||||||
|
OemLed28 = 527,
|
||||||
|
OemLed29 = 528,
|
||||||
|
OemLed30 = 529,
|
||||||
|
OemLed31 = 530,
|
||||||
|
OemLed32 = 531,
|
||||||
|
OemLed33 = 532,
|
||||||
|
OemLed34 = 533,
|
||||||
|
OemLed35 = 534,
|
||||||
|
OemLed36 = 535,
|
||||||
|
OemLed37 = 536,
|
||||||
|
OemLed38 = 537,
|
||||||
|
OemLed39 = 538,
|
||||||
|
OemLed40 = 539,
|
||||||
|
OemLed41 = 540,
|
||||||
|
OemLed42 = 541,
|
||||||
|
OemLed43 = 542,
|
||||||
|
OemLed44 = 543,
|
||||||
|
OemLed45 = 544,
|
||||||
|
OemLed46 = 545,
|
||||||
|
OemLed47 = 546,
|
||||||
|
OemLed48 = 547,
|
||||||
|
OemLed49 = 548,
|
||||||
|
OemLed50 = 549,
|
||||||
|
OemLed51 = 550,
|
||||||
|
OemLed52 = 551,
|
||||||
|
OemLed53 = 552,
|
||||||
|
OemLed54 = 553,
|
||||||
|
OemLed55 = 554,
|
||||||
|
OemLed56 = 555,
|
||||||
|
OemLed57 = 556,
|
||||||
|
OemLed58 = 557,
|
||||||
|
OemLed59 = 558,
|
||||||
|
OemLed60 = 559,
|
||||||
|
OemLed61 = 560,
|
||||||
|
OemLed62 = 561,
|
||||||
|
OemLed63 = 562,
|
||||||
|
OemLed64 = 563,
|
||||||
|
OemLed65 = 564,
|
||||||
|
OemLed66 = 565,
|
||||||
|
OemLed67 = 566,
|
||||||
|
OemLed68 = 567,
|
||||||
|
OemLed69 = 568,
|
||||||
|
OemLed70 = 569,
|
||||||
|
OemLed71 = 570,
|
||||||
|
OemLed72 = 571,
|
||||||
|
OemLed73 = 572,
|
||||||
|
OemLed74 = 573,
|
||||||
|
OemLed75 = 574,
|
||||||
|
OemLed76 = 575,
|
||||||
|
OemLed77 = 576,
|
||||||
|
OemLed78 = 577,
|
||||||
|
OemLed79 = 578,
|
||||||
|
OemLed80 = 579,
|
||||||
|
OemLed81 = 580,
|
||||||
|
OemLed82 = 581,
|
||||||
|
OemLed83 = 582,
|
||||||
|
OemLed84 = 583,
|
||||||
|
OemLed85 = 584,
|
||||||
|
OemLed86 = 585,
|
||||||
|
OemLed87 = 586,
|
||||||
|
OemLed88 = 587,
|
||||||
|
OemLed89 = 588,
|
||||||
|
OemLed90 = 589,
|
||||||
|
OemLed91 = 590,
|
||||||
|
OemLed92 = 591,
|
||||||
|
OemLed93 = 592,
|
||||||
|
OemLed94 = 593,
|
||||||
|
OemLed95 = 594,
|
||||||
|
OemLed96 = 595,
|
||||||
|
OemLed97 = 596,
|
||||||
|
OemLed98 = 597,
|
||||||
|
OemLed99 = 598,
|
||||||
|
OemLed100 = 599,
|
||||||
|
|
||||||
|
DRAM1 = 600,
|
||||||
|
DRAM2 = 601,
|
||||||
|
DRAM3 = 602,
|
||||||
|
DRAM4 = 603,
|
||||||
|
DRAM5 = 604,
|
||||||
|
DRAM6 = 605,
|
||||||
|
DRAM7 = 606,
|
||||||
|
DRAM8 = 607,
|
||||||
|
DRAM9 = 608,
|
||||||
|
DRAM10 = 609,
|
||||||
|
DRAM11 = 610,
|
||||||
|
DRAM12 = 611,
|
||||||
|
|
||||||
|
CustomDeviceChannel3Led1 = 612,
|
||||||
|
CustomDeviceChannel3Led2 = 613,
|
||||||
|
CustomDeviceChannel3Led3 = 614,
|
||||||
|
CustomDeviceChannel3Led4 = 615,
|
||||||
|
CustomDeviceChannel3Led5 = 616,
|
||||||
|
CustomDeviceChannel3Led6 = 617,
|
||||||
|
CustomDeviceChannel3Led7 = 618,
|
||||||
|
CustomDeviceChannel3Led8 = 619,
|
||||||
|
CustomDeviceChannel3Led9 = 620,
|
||||||
|
CustomDeviceChannel3Led10 = 621,
|
||||||
|
CustomDeviceChannel3Led11 = 622,
|
||||||
|
CustomDeviceChannel3Led12 = 623,
|
||||||
|
CustomDeviceChannel3Led13 = 624,
|
||||||
|
CustomDeviceChannel3Led14 = 625,
|
||||||
|
CustomDeviceChannel3Led15 = 626,
|
||||||
|
CustomDeviceChannel3Led16 = 627,
|
||||||
|
CustomDeviceChannel3Led17 = 628,
|
||||||
|
CustomDeviceChannel3Led18 = 629,
|
||||||
|
CustomDeviceChannel3Led19 = 630,
|
||||||
|
CustomDeviceChannel3Led20 = 631,
|
||||||
|
CustomDeviceChannel3Led21 = 632,
|
||||||
|
CustomDeviceChannel3Led22 = 633,
|
||||||
|
CustomDeviceChannel3Led23 = 634,
|
||||||
|
CustomDeviceChannel3Led24 = 635,
|
||||||
|
CustomDeviceChannel3Led25 = 636,
|
||||||
|
CustomDeviceChannel3Led26 = 637,
|
||||||
|
CustomDeviceChannel3Led27 = 638,
|
||||||
|
CustomDeviceChannel3Led28 = 639,
|
||||||
|
CustomDeviceChannel3Led29 = 640,
|
||||||
|
CustomDeviceChannel3Led30 = 641,
|
||||||
|
CustomDeviceChannel3Led31 = 642,
|
||||||
|
CustomDeviceChannel3Led32 = 643,
|
||||||
|
CustomDeviceChannel3Led33 = 644,
|
||||||
|
CustomDeviceChannel3Led34 = 645,
|
||||||
|
CustomDeviceChannel3Led35 = 646,
|
||||||
|
CustomDeviceChannel3Led36 = 647,
|
||||||
|
CustomDeviceChannel3Led37 = 648,
|
||||||
|
CustomDeviceChannel3Led38 = 649,
|
||||||
|
CustomDeviceChannel3Led39 = 650,
|
||||||
|
CustomDeviceChannel3Led40 = 651,
|
||||||
|
CustomDeviceChannel3Led41 = 652,
|
||||||
|
CustomDeviceChannel3Led42 = 653,
|
||||||
|
CustomDeviceChannel3Led43 = 654,
|
||||||
|
CustomDeviceChannel3Led44 = 655,
|
||||||
|
CustomDeviceChannel3Led45 = 656,
|
||||||
|
CustomDeviceChannel3Led46 = 657,
|
||||||
|
CustomDeviceChannel3Led47 = 658,
|
||||||
|
CustomDeviceChannel3Led48 = 659,
|
||||||
|
CustomDeviceChannel3Led49 = 660,
|
||||||
|
CustomDeviceChannel3Led50 = 661,
|
||||||
|
CustomDeviceChannel3Led51 = 662,
|
||||||
|
CustomDeviceChannel3Led52 = 663,
|
||||||
|
CustomDeviceChannel3Led53 = 664,
|
||||||
|
CustomDeviceChannel3Led54 = 665,
|
||||||
|
CustomDeviceChannel3Led55 = 666,
|
||||||
|
CustomDeviceChannel3Led56 = 667,
|
||||||
|
CustomDeviceChannel3Led57 = 668,
|
||||||
|
CustomDeviceChannel3Led58 = 669,
|
||||||
|
CustomDeviceChannel3Led59 = 670,
|
||||||
|
CustomDeviceChannel3Led60 = 671,
|
||||||
|
CustomDeviceChannel3Led61 = 672,
|
||||||
|
CustomDeviceChannel3Led62 = 673,
|
||||||
|
CustomDeviceChannel3Led63 = 674,
|
||||||
|
CustomDeviceChannel3Led64 = 675,
|
||||||
|
CustomDeviceChannel3Led65 = 676,
|
||||||
|
CustomDeviceChannel3Led66 = 677,
|
||||||
|
CustomDeviceChannel3Led67 = 678,
|
||||||
|
CustomDeviceChannel3Led68 = 679,
|
||||||
|
CustomDeviceChannel3Led69 = 680,
|
||||||
|
CustomDeviceChannel3Led70 = 681,
|
||||||
|
CustomDeviceChannel3Led71 = 682,
|
||||||
|
CustomDeviceChannel3Led72 = 683,
|
||||||
|
CustomDeviceChannel3Led73 = 684,
|
||||||
|
CustomDeviceChannel3Led74 = 685,
|
||||||
|
CustomDeviceChannel3Led75 = 686,
|
||||||
|
CustomDeviceChannel3Led76 = 687,
|
||||||
|
CustomDeviceChannel3Led77 = 688,
|
||||||
|
CustomDeviceChannel3Led78 = 689,
|
||||||
|
CustomDeviceChannel3Led79 = 690,
|
||||||
|
CustomDeviceChannel3Led80 = 691,
|
||||||
|
CustomDeviceChannel3Led81 = 692,
|
||||||
|
CustomDeviceChannel3Led82 = 693,
|
||||||
|
CustomDeviceChannel3Led83 = 694,
|
||||||
|
CustomDeviceChannel3Led84 = 695,
|
||||||
|
CustomDeviceChannel3Led85 = 696,
|
||||||
|
CustomDeviceChannel3Led86 = 697,
|
||||||
|
CustomDeviceChannel3Led87 = 698,
|
||||||
|
CustomDeviceChannel3Led88 = 699,
|
||||||
|
CustomDeviceChannel3Led89 = 700,
|
||||||
|
CustomDeviceChannel3Led90 = 701,
|
||||||
|
CustomDeviceChannel3Led91 = 702,
|
||||||
|
CustomDeviceChannel3Led92 = 703,
|
||||||
|
CustomDeviceChannel3Led93 = 704,
|
||||||
|
CustomDeviceChannel3Led94 = 705,
|
||||||
|
CustomDeviceChannel3Led95 = 706,
|
||||||
|
CustomDeviceChannel3Led96 = 707,
|
||||||
|
CustomDeviceChannel3Led97 = 708,
|
||||||
|
CustomDeviceChannel3Led98 = 709,
|
||||||
|
CustomDeviceChannel3Led99 = 710,
|
||||||
|
CustomDeviceChannel3Led100 = 711,
|
||||||
|
CustomDeviceChannel3Led101 = 712,
|
||||||
|
CustomDeviceChannel3Led102 = 713,
|
||||||
|
CustomDeviceChannel3Led103 = 714,
|
||||||
|
CustomDeviceChannel3Led104 = 715,
|
||||||
|
CustomDeviceChannel3Led105 = 716,
|
||||||
|
CustomDeviceChannel3Led106 = 717,
|
||||||
|
CustomDeviceChannel3Led107 = 718,
|
||||||
|
CustomDeviceChannel3Led108 = 719,
|
||||||
|
CustomDeviceChannel3Led109 = 720,
|
||||||
|
CustomDeviceChannel3Led110 = 721,
|
||||||
|
CustomDeviceChannel3Led111 = 722,
|
||||||
|
CustomDeviceChannel3Led112 = 723,
|
||||||
|
CustomDeviceChannel3Led113 = 724,
|
||||||
|
CustomDeviceChannel3Led114 = 725,
|
||||||
|
CustomDeviceChannel3Led115 = 726,
|
||||||
|
CustomDeviceChannel3Led116 = 727,
|
||||||
|
CustomDeviceChannel3Led117 = 728,
|
||||||
|
CustomDeviceChannel3Led118 = 729,
|
||||||
|
CustomDeviceChannel3Led119 = 730,
|
||||||
|
CustomDeviceChannel3Led120 = 731,
|
||||||
|
CustomDeviceChannel3Led121 = 732,
|
||||||
|
CustomDeviceChannel3Led122 = 733,
|
||||||
|
CustomDeviceChannel3Led123 = 734,
|
||||||
|
CustomDeviceChannel3Led124 = 735,
|
||||||
|
CustomDeviceChannel3Led125 = 736,
|
||||||
|
CustomDeviceChannel3Led126 = 737,
|
||||||
|
CustomDeviceChannel3Led127 = 738,
|
||||||
|
CustomDeviceChannel3Led128 = 739,
|
||||||
|
CustomDeviceChannel3Led129 = 740,
|
||||||
|
CustomDeviceChannel3Led130 = 741,
|
||||||
|
CustomDeviceChannel3Led131 = 742,
|
||||||
|
CustomDeviceChannel3Led132 = 743,
|
||||||
|
CustomDeviceChannel3Led133 = 744,
|
||||||
|
CustomDeviceChannel3Led134 = 745,
|
||||||
|
CustomDeviceChannel3Led135 = 746,
|
||||||
|
CustomDeviceChannel3Led136 = 747,
|
||||||
|
CustomDeviceChannel3Led137 = 748,
|
||||||
|
CustomDeviceChannel3Led138 = 749,
|
||||||
|
CustomDeviceChannel3Led139 = 750,
|
||||||
|
CustomDeviceChannel3Led140 = 751,
|
||||||
|
CustomDeviceChannel3Led141 = 752,
|
||||||
|
CustomDeviceChannel3Led142 = 753,
|
||||||
|
CustomDeviceChannel3Led143 = 754,
|
||||||
|
CustomDeviceChannel3Led144 = 755,
|
||||||
|
CustomDeviceChannel3Led145 = 756,
|
||||||
|
CustomDeviceChannel3Led146 = 757,
|
||||||
|
CustomDeviceChannel3Led147 = 758,
|
||||||
|
CustomDeviceChannel3Led148 = 759,
|
||||||
|
CustomDeviceChannel3Led149 = 760,
|
||||||
|
CustomDeviceChannel3Led150 = 761,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
59
RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs
Normal file
59
RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using RGB.NET.Core;
|
||||||
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
|
|
||||||
|
namespace RGB.NET.Devices.Corsair
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a corsair memory.
|
||||||
|
/// </summary>
|
||||||
|
public class CorsairMemoryRGBDevice : CorsairRGBDevice<CorsairMemoryRGBDeviceInfo>
|
||||||
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Corsair.CorsairMemoryRGBDevice" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info">The specific information provided by CUE for the memory.</param>
|
||||||
|
internal CorsairMemoryRGBDevice(CorsairMemoryRGBDeviceInfo info)
|
||||||
|
: base(info)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void InitializeLayout()
|
||||||
|
{
|
||||||
|
_CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions));
|
||||||
|
|
||||||
|
int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition));
|
||||||
|
IntPtr ptr = nativeLedPositions.pLedPosition;
|
||||||
|
|
||||||
|
Dictionary<CorsairLedId, LedId> mapping = MemoryIdMapping.DEFAULT.SwapKeyValue();
|
||||||
|
for (int i = 0; i < nativeLedPositions.numberOfLed; i++)
|
||||||
|
{
|
||||||
|
_CorsairLedPosition ledPosition = (_CorsairLedPosition)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition));
|
||||||
|
InitializeLed(mapping.TryGetValue(ledPosition.LedId, out LedId ledId) ? ledId : LedId.Invalid, ledPosition.ToRectangle());
|
||||||
|
|
||||||
|
ptr = new IntPtr(ptr.ToInt64() + structSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
|
||||||
|
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Memory\{model}.xml"), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override object CreateLedCustomData(LedId ledId) => MemoryIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
31
RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs
Normal file
31
RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using RGB.NET.Core;
|
||||||
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
|
|
||||||
|
namespace RGB.NET.Devices.Corsair
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairMemoryRGBDevice" />.
|
||||||
|
/// </summary>
|
||||||
|
public class CorsairMemoryRGBDeviceInfo : CorsairRGBDeviceInfo
|
||||||
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
/// <summary>
|
||||||
|
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairMemoryRGBDeviceInfo" />.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairMemoryRGBDevice" />.</param>
|
||||||
|
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||||
|
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
|
||||||
|
internal CorsairMemoryRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, Dictionary<string, int> modelCounter)
|
||||||
|
: base(deviceIndex, RGBDeviceType.DRAM, nativeInfo, modelCounter)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
25
RGB.NET.Devices.Corsair/Memory/MemoryIdMapping.cs
Normal file
25
RGB.NET.Devices.Corsair/Memory/MemoryIdMapping.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using RGB.NET.Core;
|
||||||
|
|
||||||
|
namespace RGB.NET.Devices.Corsair
|
||||||
|
{
|
||||||
|
internal static class MemoryIdMapping
|
||||||
|
{
|
||||||
|
internal static readonly Dictionary<LedId, CorsairLedId> DEFAULT = new Dictionary<LedId, CorsairLedId>
|
||||||
|
{
|
||||||
|
{ LedId.Invalid, CorsairLedId.Invalid },
|
||||||
|
{ LedId.DRAM1, CorsairLedId.DRAM1 },
|
||||||
|
{ LedId.DRAM2, CorsairLedId.DRAM2 },
|
||||||
|
{ LedId.DRAM3, CorsairLedId.DRAM3 },
|
||||||
|
{ LedId.DRAM4, CorsairLedId.DRAM4 },
|
||||||
|
{ LedId.DRAM5, CorsairLedId.DRAM5 },
|
||||||
|
{ LedId.DRAM6, CorsairLedId.DRAM6 },
|
||||||
|
{ LedId.DRAM7, CorsairLedId.DRAM7 },
|
||||||
|
{ LedId.DRAM8, CorsairLedId.DRAM8 },
|
||||||
|
{ LedId.DRAM9, CorsairLedId.DRAM9 },
|
||||||
|
{ LedId.DRAM10, CorsairLedId.DRAM10 },
|
||||||
|
{ LedId.DRAM11, CorsairLedId.DRAM11 },
|
||||||
|
{ LedId.DRAM12, CorsairLedId.DRAM12 },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@
|
|||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=headsetstand/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=headsetstand/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=helper/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=helper/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=libs/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=libs/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=memory/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mousepad/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mousepad/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=native/@EntryIndexedValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=native/@EntryIndexedValue">False</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mousmat/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mousmat/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user