mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 13:06:24 +00:00
Updated Layouts to contain device-image infos
This commit is contained in:
1 parent
6fe54bd3ec
commit
739fbf8733
64 files changed
+143
-185
No files matched your search
@@ -56,10 +56,9 @@ namespace RGB.NET.Devices.Logitech
|
||||
protected virtual void InitializeLayout()
|
||||
{
|
||||
if (!(DeviceInfo is LogitechRGBDeviceInfo info)) return;
|
||||
string basePath = info.ImageBasePath;
|
||||
string layout = info.ImageLayout;
|
||||
string layoutPath = info.LayoutPath;
|
||||
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Logitech\{layoutPath}.xml"), layout, PathHelper.GetAbsolutePath($@"Images\Logitech\{basePath}"), true);
|
||||
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Logitech\{layoutPath}.xml"), layout, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
public string Model { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Uri Image { get; protected set; }
|
||||
public Uri Image { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public RGBDeviceLighting Lighting
|
||||
@@ -46,11 +46,6 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// </summary>
|
||||
public LogitechDeviceCaps DeviceCaps { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base of the image path used to load device-images.
|
||||
/// </summary>
|
||||
internal string ImageBasePath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the layout used to decide which images to load.
|
||||
/// </summary>
|
||||
@@ -74,17 +69,14 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <param name="imageBasePath">The base of the image path used to load device-images.</param>
|
||||
/// <param name="imageLayout">The layout used to decide which images to load.</param>
|
||||
/// <param name="layoutPath">The path/name of the layout-file.</param>
|
||||
internal LogitechRGBDeviceInfo(RGBDeviceType deviceType, string model, LogitechDeviceCaps deviceCaps,
|
||||
string imageBasePath, string imageLayout, string layoutPath)
|
||||
internal LogitechRGBDeviceInfo(RGBDeviceType deviceType, string model, LogitechDeviceCaps deviceCaps,
|
||||
string imageLayout, string layoutPath)
|
||||
{
|
||||
this.DeviceType = deviceType;
|
||||
this.Model = model;
|
||||
this.DeviceCaps = deviceCaps;
|
||||
this.ImageBasePath = imageBasePath;
|
||||
this.ImageLayout = imageLayout;
|
||||
this.LayoutPath = layoutPath;
|
||||
|
||||
Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Logitech\{LayoutPath}.png"), UriKind.Absolute);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -13,18 +13,18 @@ namespace RGB.NET.Devices.Logitech.HID
|
||||
private const int VENDOR_ID = 0x046D;
|
||||
|
||||
//TODO DarthAffe 14.11.2017: Add devices
|
||||
private static readonly List<(string model, RGBDeviceType deviceType, int id, string imageBasePath, string imageLayout, string layoutPath)> PER_KEY_DEVICES
|
||||
= new List<(string model, RGBDeviceType deviceType, int id, string imageBasePath, string imageLayout, string layoutPath)>
|
||||
private static readonly List<(string model, RGBDeviceType deviceType, int id, string imageLayout, string layoutPath)> PER_KEY_DEVICES
|
||||
= new List<(string model, RGBDeviceType deviceType, int id, string imageLayout, string layoutPath)>
|
||||
{
|
||||
("G910", RGBDeviceType.Keyboard, 0xC32B, "Keyboards", "DE", @"Keyboards\G910\UK"), //TODO DarthAffe 15.11.2017: Somehow detect the current layout
|
||||
("G610", RGBDeviceType.Keyboard, 0xC333, "Keyboards", "DE", @"Keyboards\G610\UK"),
|
||||
("G910", RGBDeviceType.Keyboard, 0xC32B, "DE", @"Keyboards\G910\UK"), //TODO DarthAffe 15.11.2017: Somehow detect the current layout
|
||||
("G610", RGBDeviceType.Keyboard, 0xC333, "DE", @"Keyboards\G610\UK"),
|
||||
};
|
||||
|
||||
private static readonly List<(string model, RGBDeviceType deviceType, int id, string imageBasePath, string imageLayout, string layoutPath)> PER_DEVICE_DEVICES
|
||||
= new List<(string model, RGBDeviceType deviceType, int id, string imageBasePath, string imageLayout, string layoutPath)>
|
||||
private static readonly List<(string model, RGBDeviceType deviceType, int id, string imageLayout, string layoutPath)> PER_DEVICE_DEVICES
|
||||
= new List<(string model, RGBDeviceType deviceType, int id, string imageLayout, string layoutPath)>
|
||||
{
|
||||
("G403", RGBDeviceType.Mouse, 0xC083, "Mice", "default", @"Mice\G403"),
|
||||
("G502", RGBDeviceType.Mouse, 0xC332, "Mice", "default", @"Mice\G502"),
|
||||
("G403", RGBDeviceType.Mouse, 0xC083, "default", @"Mice\G403"),
|
||||
("G502", RGBDeviceType.Mouse, 0xC332, "default", @"Mice\G502"),
|
||||
};
|
||||
|
||||
#endregion
|
||||
@@ -32,10 +32,10 @@ namespace RGB.NET.Devices.Logitech.HID
|
||||
#region Properties & Fields
|
||||
|
||||
public static bool IsPerKeyDeviceConnected { get; private set; }
|
||||
public static (string model, RGBDeviceType deviceType, int id, string imageBasePath, string imageLayout, string layoutPath) PerKeyDeviceData { get; private set; }
|
||||
public static (string model, RGBDeviceType deviceType, int id, string imageLayout, string layoutPath) PerKeyDeviceData { get; private set; }
|
||||
|
||||
public static bool IsPerDeviceDeviceConnected { get; private set; }
|
||||
public static (string model, RGBDeviceType deviceType, int id, string imageBasePath, string imageLayout, string layoutPath) PerDeviceDeviceData { get; private set; }
|
||||
public static (string model, RGBDeviceType deviceType, int id, string imageLayout, string layoutPath) PerDeviceDeviceData { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace RGB.NET.Devices.Logitech.HID
|
||||
HidDeviceLoader loader = new HidDeviceLoader();
|
||||
List<int> ids = loader.GetDevices(VENDOR_ID).Select(x => x.ProductID).Distinct().ToList();
|
||||
|
||||
foreach ((string model, RGBDeviceType deviceType, int id, string imageBasePath, string imageLayout, string layoutPath) deviceData in PER_KEY_DEVICES)
|
||||
foreach ((string model, RGBDeviceType deviceType, int id, string imageLayout, string layoutPath) deviceData in PER_KEY_DEVICES)
|
||||
if (ids.Contains(deviceData.id))
|
||||
{
|
||||
IsPerKeyDeviceConnected = true;
|
||||
@@ -54,7 +54,7 @@ namespace RGB.NET.Devices.Logitech.HID
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ((string model, RGBDeviceType deviceType, int id, string imageBasePath, string imageLayout, string layoutPath) deviceData in PER_DEVICE_DEVICES)
|
||||
foreach ((string model, RGBDeviceType deviceType, int id, string imageLayout, string layoutPath) deviceData in PER_DEVICE_DEVICES)
|
||||
if (ids.Contains(deviceData.id))
|
||||
{
|
||||
IsPerDeviceDeviceConnected = true;
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<xsd:element name="Shape" type="xsd:string" />
|
||||
<xsd:element name="Width" type="xsd:double" />
|
||||
<xsd:element name="Height" type="xsd:double" />
|
||||
<xsd:element name="ImageBasePath" type="xsd:string" />
|
||||
<xsd:element name="DeviceImage" type="xsd:string" />
|
||||
<xsd:element name="LedUnitWidth" type="xsd:double" />
|
||||
<xsd:element name="LedUnitHeight" type="xsd:double" />
|
||||
<xsd:element name="Leds">
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
<Model>G610</Model>
|
||||
<Width>442</Width>
|
||||
<Height>152</Height>
|
||||
<ImageBasePath>Images\Logitech\Keyboards</ImageBasePath>
|
||||
<DeviceImage></DeviceImage>
|
||||
<Leds>
|
||||
<!-- Esc -> Pause -->
|
||||
<Led Id="Keyboard_Escape">
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
<Model>G910</Model>
|
||||
<Width>491</Width>
|
||||
<Height>238</Height>
|
||||
<ImageBasePath>Images\Logitech\Keyboards</ImageBasePath>
|
||||
<DeviceImage>G910.png</DeviceImage>
|
||||
<Leds>
|
||||
<!-- Esc -> Pause -->
|
||||
<Led Id="Keyboard_Escape">
|
||||
@@ -367,7 +369,7 @@
|
||||
<LedImage Id="Keyboard_RightGui" Image="Raptor_Keys\Windows.png" />
|
||||
<LedImage Id="Keyboard_Application" Image="Raptor_Keys\Menu.png" />
|
||||
<LedImage Id="Keyboard_RightCtrl" Image="Raptor_Keys\Strg.png" />
|
||||
<LedImage Id="Keyboard_ArrowLef" Image="Raptor_Keys\CaretLeft.png" />
|
||||
<LedImage Id="Keyboard_ArrowLeft" Image="Raptor_Keys\CaretLeft.png" />
|
||||
<LedImage Id="Keyboard_ArrowDown" Image="Raptor_Keys\CaretDown.png" />
|
||||
<LedImage Id="Keyboard_ArrowRight" Image="Raptor_Keys\CaretRight.png" />
|
||||
<LedImage Id="Keyboard_Num0" Image="Raptor_Keys\Num0_Einfg.png" />
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
<Model>G403</Model>
|
||||
<Width>67</Width>
|
||||
<Height>125</Height>
|
||||
<ImageBasePath>Images\Logitech\Mice</ImageBasePath>
|
||||
<DeviceImage>G403.png</DeviceImage>
|
||||
<Leds>
|
||||
<Led Id="Custom1">
|
||||
<Shape>m 0.7025,0.00275 -0.15,0 -0,0.26 h 0.15 z m -0.16732,0.7925 c -0.7,0.0159 -0.55,0.19383 -0.006236,0.19067 l 0.001707,-0.0416 c -0.425,-0.0115 -0.225,-0.11 0.005116,-0.10 z m 0.410,0.0779 -0.435,0 0,0.0401 0.225,0 0,0.0437 0.21,0 z</Shape>
|
||||
<X>24</X>
|
||||
<Y>15</Y>
|
||||
<Width>17mm</Width>
|
||||
<Height>81mm</Height>
|
||||
<Width>17mm</Width>
|
||||
<Height>81mm</Height>
|
||||
</Led>
|
||||
</Leds>
|
||||
</Device>
|
||||
@@ -100,10 +100,10 @@ namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
if (DeviceChecker.IsPerKeyDeviceConnected)
|
||||
{
|
||||
(string model, RGBDeviceType deviceType, int _, string imageBasePath, string imageLayout, string layoutPath) = DeviceChecker.PerKeyDeviceData;
|
||||
(string model, RGBDeviceType deviceType, int _, string imageLayout, string layoutPath) = DeviceChecker.PerKeyDeviceData;
|
||||
if (loadFilter.HasFlag(deviceType)) //TODO DarthAffe 07.12.2017: Check if it's worth to try another device if the one returned doesn't match the filter
|
||||
{
|
||||
ILogitechRGBDevice device = new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.PerKeyRGB, imageBasePath, imageLayout, layoutPath));
|
||||
ILogitechRGBDevice device = new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.PerKeyRGB, imageLayout, layoutPath));
|
||||
device.Initialize();
|
||||
devices.Add(device);
|
||||
}
|
||||
@@ -115,10 +115,10 @@ namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
if (DeviceChecker.IsPerDeviceDeviceConnected)
|
||||
{
|
||||
(string model, RGBDeviceType deviceType, int _, string imageBasePath, string imageLayout, string layoutPath) = DeviceChecker.PerDeviceDeviceData;
|
||||
(string model, RGBDeviceType deviceType, int _, string imageLayout, string layoutPath) = DeviceChecker.PerDeviceDeviceData;
|
||||
if (loadFilter.HasFlag(deviceType)) //TODO DarthAffe 07.12.2017: Check if it's worth to try another device if the one returned doesn't match the filter
|
||||
{
|
||||
ILogitechRGBDevice device = new LogitechPerDeviceRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.DeviceRGB, imageBasePath, imageLayout, layoutPath));
|
||||
ILogitechRGBDevice device = new LogitechPerDeviceRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.DeviceRGB, imageLayout, layoutPath));
|
||||
device.Initialize();
|
||||
devices.Add(device);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user