mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
commit
4580a5dff1
@ -48,7 +48,7 @@ namespace RGB.NET.Devices.Msi
|
|||||||
/// <param name="msiDeviceType">The internal type of the <see cref="IRGBDevice"/>.</param>
|
/// <param name="msiDeviceType">The internal type of the <see cref="IRGBDevice"/>.</param>
|
||||||
/// <param name="manufacturer">The manufacturer-name of the <see cref="IRGBDevice"/>.</param>
|
/// <param name="manufacturer">The manufacturer-name of the <see cref="IRGBDevice"/>.</param>
|
||||||
/// <param name="model">The model-name of the <see cref="IRGBDevice"/>.</param>
|
/// <param name="model">The model-name of the <see cref="IRGBDevice"/>.</param>
|
||||||
internal MsiRGBDeviceInfo(RGBDeviceType deviceType, string msiDeviceType, string manufacturer = "Msi", string model = "Generic Msi-Device")
|
internal MsiRGBDeviceInfo(RGBDeviceType deviceType, string msiDeviceType, string manufacturer = "MSI", string model = "Generic Msi-Device")
|
||||||
{
|
{
|
||||||
this.DeviceType = deviceType;
|
this.DeviceType = deviceType;
|
||||||
this.MsiDeviceType = msiDeviceType;
|
this.MsiDeviceType = msiDeviceType;
|
||||||
|
|||||||
54
RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs
Normal file
54
RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using RGB.NET.Core;
|
||||||
|
using RGB.NET.Devices.Msi.Native;
|
||||||
|
|
||||||
|
namespace RGB.NET.Devices.Msi
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a MSI mouse.
|
||||||
|
/// </summary>
|
||||||
|
public class MsiMouseRGBDevice : MsiRGBDevice<MsiRGBDeviceInfo>
|
||||||
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Msi.MsiMouseRGBDevice" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info">The specific information provided by MSI for the mouse.</param>
|
||||||
|
internal MsiMouseRGBDevice(MsiRGBDeviceInfo info)
|
||||||
|
: base(info)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void InitializeLayout(int ledCount)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ledCount; i++)
|
||||||
|
{
|
||||||
|
//Hex3l: Should it be configurable in order to provide style access?
|
||||||
|
//Hex3l: Sets led style to "Steady" in order to have a solid color output therefore a controllable led color
|
||||||
|
//Hex3l: This is a string defined by the output of _MsiSDK.GetLedStyle, "Steady" should be always present
|
||||||
|
const string LED_STYLE = "Steady";
|
||||||
|
|
||||||
|
_MsiSDK.SetLedStyle(DeviceInfo.MsiDeviceType, i, LED_STYLE);
|
||||||
|
InitializeLed(LedId.Mouse1 + i, new Rectangle(i * 10, 0, 10, 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images?
|
||||||
|
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\MSI\Mouses\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void SyncBack()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -118,7 +118,7 @@ namespace RGB.NET.Devices.Msi
|
|||||||
if (deviceType.Equals("MSI_MB"))
|
if (deviceType.Equals("MSI_MB"))
|
||||||
{
|
{
|
||||||
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
|
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
|
||||||
IMsiRGBDevice motherboard = new MsiMainboardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mainboard, deviceType, "Msi", "Motherboard"));
|
IMsiRGBDevice motherboard = new MsiMainboardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mainboard, deviceType, "MSI", "Motherboard"));
|
||||||
motherboard.Initialize(updateQueue, ledCount);
|
motherboard.Initialize(updateQueue, ledCount);
|
||||||
devices.Add(motherboard);
|
devices.Add(motherboard);
|
||||||
}
|
}
|
||||||
@ -128,10 +128,20 @@ namespace RGB.NET.Devices.Msi
|
|||||||
//Hex3l: The led name is the name of the card (e.g. NVIDIA GeForce RTX 2080 Ti) we could provide it in device info.
|
//Hex3l: The led name is the name of the card (e.g. NVIDIA GeForce RTX 2080 Ti) we could provide it in device info.
|
||||||
|
|
||||||
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
|
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
|
||||||
IMsiRGBDevice graphicscard = new MsiGraphicsCardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.GraphicsCard, deviceType, "Msi", "GraphicsCard"));
|
IMsiRGBDevice graphicscard = new MsiGraphicsCardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.GraphicsCard, deviceType, "MSI", "GraphicsCard"));
|
||||||
graphicscard.Initialize(updateQueue, ledCount);
|
graphicscard.Initialize(updateQueue, ledCount);
|
||||||
devices.Add(graphicscard);
|
devices.Add(graphicscard);
|
||||||
}
|
}
|
||||||
|
else if (deviceType.Equals("MSI_MOUSE"))
|
||||||
|
{
|
||||||
|
//Hex3l: Every led under MSI_MOUSE should be a different mouse. Handling all the mouses together seems a good way to avoid overlapping of leds
|
||||||
|
//Hex3l: The led name is the name of the mouse (e.g. msi CLUTCH GM11) we could provide it in device info.
|
||||||
|
|
||||||
|
MsiDeviceUpdateQueue updateQueue = new MsiDeviceUpdateQueue(UpdateTrigger, deviceType);
|
||||||
|
IMsiRGBDevice mouses = new MsiMouseRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mouse, deviceType, "MSI", "Mouse"));
|
||||||
|
mouses.Initialize(updateQueue, ledCount);
|
||||||
|
devices.Add(mouses);
|
||||||
|
}
|
||||||
|
|
||||||
//TODO DarthAffe 22.02.2020: Add other devices
|
//TODO DarthAffe 22.02.2020: Add other devices
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user