diff --git a/Documentation/DeviceLayout.xsd b/Documentation/DeviceLayout.xsd index 5590825..91ced39 100644 --- a/Documentation/DeviceLayout.xsd +++ b/Documentation/DeviceLayout.xsd @@ -13,6 +13,8 @@ + + diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs index 5e74c61..ba6b84d 100644 --- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs +++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs @@ -16,7 +16,7 @@ namespace RGB.NET.Core /// Represents a generic RGB-device /// public abstract class AbstractRGBDevice : AbstractBindable, IRGBDevice - where TDeviceInfo : IRGBDeviceInfo + where TDeviceInfo : class, IRGBDeviceInfo { #region Properties & Fields @@ -130,13 +130,16 @@ namespace RGB.NET.Core /// /// The file containing the layout. /// The name of the layout used to get the images of the leds. - /// The path images for this device are collected in. /// If set to true a new led is initialized for every id in the layout if it doesn't already exist. - protected virtual void ApplyLayoutFromFile(string layoutPath, string imageLayout, string imageBasePath, bool createMissingLeds = false) + protected virtual DeviceLayout ApplyLayoutFromFile(string layoutPath, string imageLayout, bool createMissingLeds = false) { DeviceLayout layout = DeviceLayout.Load(layoutPath); if (layout != null) { + string imageBasePath = string.IsNullOrWhiteSpace(layout.ImageBasePath) ? null : PathHelper.GetAbsolutePath(layout.ImageBasePath); + if ((imageBasePath != null) && !string.IsNullOrWhiteSpace(layout.DeviceImage) && (DeviceInfo != null)) + DeviceInfo.Image = new Uri(Path.Combine(imageBasePath, layout.DeviceImage), UriKind.Absolute); + LedImageLayout ledImageLayout = layout.LedImageLayouts.FirstOrDefault(x => string.Equals(x.Layout, imageLayout, StringComparison.OrdinalIgnoreCase)); Size = new Size(layout.Width, layout.Height); @@ -158,13 +161,14 @@ namespace RGB.NET.Core led.ShapeData = layoutLed.ShapeData; LedImage image = ledImageLayout?.LedImages.FirstOrDefault(x => x.Id == layoutLed.Id); - led.Image = (!string.IsNullOrEmpty(image?.Image)) - ? new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute) - : new Uri(Path.Combine(imageBasePath, "Missing.png"), UriKind.Absolute); + if ((imageBasePath != null) && !string.IsNullOrEmpty(image?.Image)) + led.Image = new Uri(Path.Combine(imageBasePath, image.Image), UriKind.Absolute); } } } } + + return layout; } /// diff --git a/RGB.NET.Core/Devices/IRGBDeviceInfo.cs b/RGB.NET.Core/Devices/IRGBDeviceInfo.cs index 718f889..61cc868 100644 --- a/RGB.NET.Core/Devices/IRGBDeviceInfo.cs +++ b/RGB.NET.Core/Devices/IRGBDeviceInfo.cs @@ -37,7 +37,7 @@ namespace RGB.NET.Core /// /// Gets the URI of an image of the or null if there is no image. /// - Uri Image { get; } + Uri Image { get; set; } #endregion } diff --git a/RGB.NET.Core/Devices/Layout/DeviceLayout.cs b/RGB.NET.Core/Devices/Layout/DeviceLayout.cs index 2259ce2..267c7d0 100644 --- a/RGB.NET.Core/Devices/Layout/DeviceLayout.cs +++ b/RGB.NET.Core/Devices/Layout/DeviceLayout.cs @@ -84,6 +84,18 @@ namespace RGB.NET.Core.Layout [DefaultValue(19.0)] public double LedUnitHeight { get; set; } = 19.0; + /// + /// The path images for this device are collected in. + /// + [XmlElement("ImageBasePath")] + public string ImageBasePath { get; set; } + + /// + /// The image file for this device. + /// + [XmlElement("DeviceImage")] + public string DeviceImage { get; set; } + /// /// Gets or sets a list of representing all the of the . /// diff --git a/RGB.NET.Devices.Asus/Dram/AsusDramRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Dram/AsusDramRGBDeviceInfo.cs index ac9f411..9f92cac 100644 --- a/RGB.NET.Devices.Asus/Dram/AsusDramRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Dram/AsusDramRGBDeviceInfo.cs @@ -26,9 +26,7 @@ namespace RGB.NET.Devices.Asus /// The handle of the . internal AsusDramRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle) : base(deviceType, handle) - { - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Asus\Drams\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs index 343c2bc..488a2b7 100644 --- a/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs @@ -21,7 +21,7 @@ namespace RGB.NET.Devices.Asus public string Model { get; } /// - public Uri Image { get; protected set; } + public Uri Image { get; set; } /// public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; diff --git a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs index dd02fc4..7730e88 100644 --- a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs @@ -33,8 +33,7 @@ namespace RGB.NET.Devices.Asus InitializeLed(LedId.GraphicsCard1 + 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\Asus\GraphicsCards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), - null, PathHelper.GetAbsolutePath(@"Images\Asus\GraphicsCards")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\GraphicsCards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// diff --git a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs index 2547d3f..bdc5977 100644 --- a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs @@ -26,9 +26,7 @@ namespace RGB.NET.Devices.Asus /// The handle of the . internal AsusGraphicsCardRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle) : base(deviceType, handle) - { - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Asus\GraphicsCards\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs index d333e7b..4c47ee4 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs @@ -33,8 +33,7 @@ namespace RGB.NET.Devices.Asus InitializeLed(LedId.Keyboard_Escape + i, new Rectangle(i * 19, 0, 19, 19)); string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), - DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Asus\Keyboards")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), DeviceInfo.LogicalLayout.ToString()); } /// diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs index 01d8fe7..db343c0 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDeviceInfo.cs @@ -37,17 +37,15 @@ namespace RGB.NET.Devices.Asus /// The handle of the . /// The of the layout this keyboard is using. internal AsusKeyboardRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle, CultureInfo culture) - : base(deviceType, handle, "Asus", "Claymore") + : base(deviceType, handle, "Claymore") { SetLayouts(culture.KeyboardLayoutId); - - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Asus\Keyboards\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); } #endregion #region Methods - + private void SetLayouts(int keyboardLayoutId) { switch (keyboardLayoutId) diff --git a/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml b/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml index 642eb9e..ad9c378 100644 --- a/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml +++ b/RGB.NET.Devices.Asus/Layouts/Asus/Mainboards/PRIMEX370-PRO.xml @@ -9,6 +9,8 @@ Prime X370-PRO 252 305 + Images\Asus\Mainboards + PRIMEX370-PRO.png 0 diff --git a/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd index 5590825..91ced39 100644 --- a/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd +++ b/RGB.NET.Devices.Asus/Layouts/DeviceLayout.xsd @@ -13,6 +13,8 @@ + + diff --git a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs index dc36764..e7b495b 100644 --- a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs @@ -32,9 +32,8 @@ namespace RGB.NET.Devices.Asus for (int i = 0; i < ledCount; i++) InitializeLed(LedId.Mainboard1 + i, new Rectangle(i * 40, 0, 40, 8)); - //TODO DarthAffe 07.10.2017: We don'T know the model, how to save layouts and images? - ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), - null, PathHelper.GetAbsolutePath(@"Images\Asus\Mainboards")); + //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images? + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// diff --git a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDeviceInfo.cs index 88c8358..172f55d 100644 --- a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDeviceInfo.cs @@ -26,9 +26,7 @@ namespace RGB.NET.Devices.Asus /// The handle of the . internal AsusMainboardRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle) : base(deviceType, handle, WMIHelper.GetMainboardInfo()?.model ?? "Generic Asus-Device") - { - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Asus\Mainboards\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs index c1b689b..68414eb 100644 --- a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs @@ -32,8 +32,7 @@ namespace RGB.NET.Devices.Asus for (int i = 0; i < ledCount; i++) InitializeLed(LedId.Mouse1 + i, new Rectangle(i * 10, 0, 10, 10)); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mouses\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), - null, PathHelper.GetAbsolutePath(@"Images\Asus\Mouses")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mouses\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// diff --git a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDeviceInfo.cs index d83f79b..ddb7135 100644 --- a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDeviceInfo.cs @@ -25,10 +25,8 @@ namespace RGB.NET.Devices.Asus /// The type of the . /// The handle of the . internal AsusMouseRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle) - : base(deviceType, handle, "Asus", "Rog") - { - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Asus\Mouses\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); - } + : base(deviceType, handle, "Rog") + { } #endregion } diff --git a/RGB.NET.Devices.Asus/Native/_AsusSDK.cs b/RGB.NET.Devices.Asus/Native/_AsusSDK.cs index 09a3f02..91e564f 100644 --- a/RGB.NET.Devices.Asus/Native/_AsusSDK.cs +++ b/RGB.NET.Devices.Asus/Native/_AsusSDK.cs @@ -121,11 +121,11 @@ namespace RGB.NET.Devices.Asus.Native private static SetRogMouseModePointer _setRogMouseModePointer; private static SetRogMouseColorPointer _setRogMouseColorPointer; - private static EnumerateDramPointer _enumerateDramPointer; - private static SetDramModePointer _setDramModePointer; - private static GetDramLedCountPointer _getDramLedCountPointer; - private static SetDramColorPointer _setDramColorPointer; - private static GetDramColorPointer _getDramColorPointer; + //private static EnumerateDramPointer _enumerateDramPointer; + //private static SetDramModePointer _setDramModePointer; + //private static GetDramLedCountPointer _getDramLedCountPointer; + //private static SetDramColorPointer _setDramColorPointer; + //private static GetDramColorPointer _getDramColorPointer; #endregion @@ -169,16 +169,16 @@ namespace RGB.NET.Devices.Asus.Native [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void SetRogMouseColorPointer(IntPtr handle, byte[] colors, int size); - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int EnumerateDramPointer(IntPtr handles, int size); - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int GetDramLedCountPointer(IntPtr handle); - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void SetDramModePointer(IntPtr handle, int mode); - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void SetDramColorPointer(IntPtr handle, byte[] colors, int size); - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int GetDramColorPointer(IntPtr handle, IntPtr colors, int size); + //[UnmanagedFunctionPointer(CallingConvention.StdCall)] + //private delegate int EnumerateDramPointer(IntPtr handles, int size); + //[UnmanagedFunctionPointer(CallingConvention.StdCall)] + //private delegate int GetDramLedCountPointer(IntPtr handle); + //[UnmanagedFunctionPointer(CallingConvention.StdCall)] + //private delegate void SetDramModePointer(IntPtr handle, int mode); + //[UnmanagedFunctionPointer(CallingConvention.StdCall)] + //private delegate void SetDramColorPointer(IntPtr handle, byte[] colors, int size); + //[UnmanagedFunctionPointer(CallingConvention.StdCall)] + //private delegate int GetDramColorPointer(IntPtr handle, IntPtr colors, int size); #endregion diff --git a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs index 25d67e9..b9790ca 100644 --- a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs +++ b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs @@ -22,7 +22,7 @@ namespace RGB.NET.Devices.CoolerMaster public string Model { get; } /// - public Uri Image { get; protected set; } + public Uri Image { get; set; } /// public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; diff --git a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs index 558ba80..79ab16d 100644 --- a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs @@ -57,8 +57,7 @@ namespace RGB.NET.Devices.CoolerMaster string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); ApplyLayoutFromFile(PathHelper.GetAbsolutePath( - $@"Layouts\CoolerMaster\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), - DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\CoolerMaster\Keyboards")); + $@"Layouts\CoolerMaster\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), DeviceInfo.LogicalLayout.ToString()); } /// diff --git a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDeviceInfo.cs index e3017a4..c13e4cc 100644 --- a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System; -using System.Globalization; +using System.Globalization; using RGB.NET.Core; namespace RGB.NET.Devices.CoolerMaster @@ -39,8 +38,6 @@ namespace RGB.NET.Devices.CoolerMaster this.PhysicalLayout = physicalKeyboardLayout; SetLayouts(culture.KeyboardLayoutId); - - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\CoolerMaster\Keyboards\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); } private void SetLayouts(int keyboardLayoutId) diff --git a/RGB.NET.Devices.CoolerMaster/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.CoolerMaster/Layouts/DeviceLayout.xsd index 5590825..91ced39 100644 --- a/RGB.NET.Devices.CoolerMaster/Layouts/DeviceLayout.xsd +++ b/RGB.NET.Devices.CoolerMaster/Layouts/DeviceLayout.xsd @@ -13,6 +13,8 @@ + + diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs index 446dc4f..80965e1 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs @@ -33,7 +33,7 @@ namespace RGB.NET.Devices.Corsair public string Model { get; } /// - public Uri Image { get; protected set; } + public Uri Image { get; set; } /// public bool SupportsSyncBack => true; diff --git a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs index 723d4e4..1f5f951 100644 --- a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs @@ -32,8 +32,7 @@ namespace RGB.NET.Devices.Corsair InitializeLed(LedId.Headset1, new Rectangle(0, 0, 10, 10)); InitializeLed(LedId.Headset2, new Rectangle(10, 0, 10, 10)); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Headsets\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), - null, PathHelper.GetAbsolutePath(@"Images\Corsair\Headsets")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Headsets\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// diff --git a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs index 0efcf01..560077a 100644 --- a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System; -using RGB.NET.Core; +using RGB.NET.Core; using RGB.NET.Devices.Corsair.Native; namespace RGB.NET.Devices.Corsair @@ -20,9 +19,7 @@ namespace RGB.NET.Devices.Corsair /// The native -struct internal CorsairHeadsetRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) : base(deviceIndex, RGBDeviceType.Headset, nativeInfo) - { - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Corsair\Headsets\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs index 059e2a3..bdb8488 100644 --- a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs @@ -51,8 +51,7 @@ namespace RGB.NET.Devices.Corsair foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.LedId)) InitializeLed(mapping.TryGetValue(ledPosition.LedId, out LedId ledId) ? ledId : LedId.Invalid, new Rectangle(ledPosition.left, ledPosition.top, ledPosition.width, ledPosition.height)); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\HeadsetStands\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), - null, PathHelper.GetAbsolutePath(@"Images\Corsair\HeadsetStands")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\HeadsetStands\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// diff --git a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs index d8a571b..e5237ac 100644 --- a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System; -using RGB.NET.Core; +using RGB.NET.Core; using RGB.NET.Devices.Corsair.Native; namespace RGB.NET.Devices.Corsair @@ -20,9 +19,7 @@ namespace RGB.NET.Devices.Corsair /// The native -struct internal CorsairHeadsetStandRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) : base(deviceIndex, RGBDeviceType.HeadsetStand, nativeInfo) - { - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Corsair\HeadsetStands\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs index 050c323..9ec251e 100644 --- a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs @@ -50,8 +50,7 @@ namespace RGB.NET.Devices.Corsair string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); ApplyLayoutFromFile(PathHelper.GetAbsolutePath( - $@"Layouts\Corsair\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), - DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Corsair\Keyboards")); + $@"Layouts\Corsair\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), DeviceInfo.LogicalLayout.ToString()); } /// diff --git a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs index c8d67a1..32f7fbf 100644 --- a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs @@ -1,7 +1,6 @@ // ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedMember.Global -using System; using RGB.NET.Core; using RGB.NET.Devices.Corsair.Native; @@ -40,9 +39,6 @@ namespace RGB.NET.Devices.Corsair { this.PhysicalLayout = (CorsairPhysicalKeyboardLayout)nativeInfo.physicalLayout; this.LogicalLayout = (CorsairLogicalKeyboardLayout)nativeInfo.logicalLayout; - - string model = Model.Replace(" ", string.Empty).ToUpper(); - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Corsair\Keyboards\{model}.png"), UriKind.Absolute); } #endregion diff --git a/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K70RGB/UK.xml b/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K70RGB/UK.xml index 6739f39..7fd6642 100644 --- a/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K70RGB/UK.xml +++ b/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K70RGB/UK.xml @@ -9,6 +9,8 @@ K70 RGB 436 165 + Images\Corsair\Keyboards + K70RGB.png diff --git a/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K95RGB/UK.xml b/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K95RGB/UK.xml index 2e3a8bb..20a50e5 100644 --- a/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K95RGB/UK.xml +++ b/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K95RGB/UK.xml @@ -9,6 +9,8 @@ K95 RGB 500 165 + Images\Corsair\Keyboards + K95RGB.png diff --git a/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K95RGBPLATINUM/UK.xml b/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K95RGBPLATINUM/UK.xml index 9132ffb..d4a9c42 100644 --- a/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K95RGBPLATINUM/UK.xml +++ b/RGB.NET.Devices.Corsair/Layouts/Corsair/Keyboards/K95RGBPLATINUM/UK.xml @@ -9,6 +9,8 @@ K95 RGB Platinum 465 169 + Images\Corsair\Keyboards + K95RGBPLATINUM.png diff --git a/RGB.NET.Devices.Corsair/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Corsair/Layouts/DeviceLayout.xsd index 5590825..91ced39 100644 --- a/RGB.NET.Devices.Corsair/Layouts/DeviceLayout.xsd +++ b/RGB.NET.Devices.Corsair/Layouts/DeviceLayout.xsd @@ -13,6 +13,8 @@ + + diff --git a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs index 3b5259f..afa275d 100644 --- a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs @@ -54,8 +54,7 @@ namespace RGB.NET.Devices.Corsair throw new RGBDeviceException($"Can't initialize mouse with layout '{DeviceInfo.PhysicalLayout}'"); } - ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Mice\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), - null, PathHelper.GetAbsolutePath(@"Images\Corsair\Mice")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Mice\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// diff --git a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs index 290a5cc..4d828ae 100644 --- a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System; -using RGB.NET.Core; +using RGB.NET.Core; using RGB.NET.Devices.Corsair.Native; namespace RGB.NET.Devices.Corsair @@ -31,8 +30,6 @@ namespace RGB.NET.Devices.Corsair : base(deviceIndex, RGBDeviceType.Mouse, nativeInfo) { this.PhysicalLayout = (CorsairPhysicalMouseLayout)nativeInfo.physicalLayout; - - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Corsair\Mice\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); } #endregion diff --git a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs index 3c5b0c8..2b448f8 100644 --- a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs @@ -51,8 +51,7 @@ namespace RGB.NET.Devices.Corsair foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.LedId)) InitializeLed(mapping.TryGetValue(ledPosition.LedId, out LedId ledId) ? ledId : LedId.Invalid, new Rectangle(ledPosition.left, ledPosition.top, ledPosition.width, ledPosition.height)); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Mousepads\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), - null, PathHelper.GetAbsolutePath(@"Images\Corsair\Mousepads")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Mousepads\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// diff --git a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs index aeda0aa..c5e5823 100644 --- a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System; -using RGB.NET.Core; +using RGB.NET.Core; using RGB.NET.Devices.Corsair.Native; namespace RGB.NET.Devices.Corsair @@ -20,9 +19,7 @@ namespace RGB.NET.Devices.Corsair /// The native -struct internal CorsairMousepadRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) : base(deviceIndex, RGBDeviceType.Mousepad, nativeInfo) - { - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Corsair\Mousepad\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs index bb664ae..8c60d0b 100644 --- a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs +++ b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs @@ -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 diff --git a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs index b5370dd..1aebbe1 100644 --- a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs @@ -21,7 +21,7 @@ namespace RGB.NET.Devices.Logitech public string Model { get; } /// - public Uri Image { get; protected set; } + public Uri Image { get; set; } /// public RGBDeviceLighting Lighting @@ -46,11 +46,6 @@ namespace RGB.NET.Devices.Logitech /// public LogitechDeviceCaps DeviceCaps { get; } - /// - /// Gets the base of the image path used to load device-images. - /// - internal string ImageBasePath { get; } - /// /// Gets the layout used to decide which images to load. /// @@ -74,17 +69,14 @@ namespace RGB.NET.Devices.Logitech /// The base of the image path used to load device-images. /// The layout used to decide which images to load. /// The path/name of the layout-file. - 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 diff --git a/RGB.NET.Devices.Logitech/HID/DeviceChecker.cs b/RGB.NET.Devices.Logitech/HID/DeviceChecker.cs index e17ab27..30998a6 100644 --- a/RGB.NET.Devices.Logitech/HID/DeviceChecker.cs +++ b/RGB.NET.Devices.Logitech/HID/DeviceChecker.cs @@ -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 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; diff --git a/RGB.NET.Devices.Logitech/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Logitech/Layouts/DeviceLayout.xsd index 5590825..91ced39 100644 --- a/RGB.NET.Devices.Logitech/Layouts/DeviceLayout.xsd +++ b/RGB.NET.Devices.Logitech/Layouts/DeviceLayout.xsd @@ -13,6 +13,8 @@ + + diff --git a/RGB.NET.Devices.Logitech/Layouts/Logitech/Keyboards/G610/UK.xml b/RGB.NET.Devices.Logitech/Layouts/Logitech/Keyboards/G610/UK.xml index 959ae32..72023df 100644 --- a/RGB.NET.Devices.Logitech/Layouts/Logitech/Keyboards/G610/UK.xml +++ b/RGB.NET.Devices.Logitech/Layouts/Logitech/Keyboards/G610/UK.xml @@ -9,6 +9,8 @@ G610 442 152 + Images\Logitech\Keyboards + diff --git a/RGB.NET.Devices.Logitech/Layouts/Logitech/Keyboards/G910/UK.xml b/RGB.NET.Devices.Logitech/Layouts/Logitech/Keyboards/G910/UK.xml index bc30030..f1b94c4 100644 --- a/RGB.NET.Devices.Logitech/Layouts/Logitech/Keyboards/G910/UK.xml +++ b/RGB.NET.Devices.Logitech/Layouts/Logitech/Keyboards/G910/UK.xml @@ -9,6 +9,8 @@ G910 491 238 + Images\Logitech\Keyboards + G910.png @@ -367,7 +369,7 @@ - + diff --git a/RGB.NET.Devices.Logitech/Layouts/Logitech/Mice/G403.xml b/RGB.NET.Devices.Logitech/Layouts/Logitech/Mice/G403.xml index fe89842..f60da74 100644 --- a/RGB.NET.Devices.Logitech/Layouts/Logitech/Mice/G403.xml +++ b/RGB.NET.Devices.Logitech/Layouts/Logitech/Mice/G403.xml @@ -9,13 +9,15 @@ G403 67 125 + Images\Logitech\Mice + G403.png 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 24 15 - 17mm - 81mm + 17mm + 81mm \ No newline at end of file diff --git a/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs b/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs index 3d85ff8..3d6beb0 100644 --- a/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs +++ b/RGB.NET.Devices.Logitech/LogitechDeviceProvider.cs @@ -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); } diff --git a/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs b/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs index 450f5b8..f0d5c15 100644 --- a/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs @@ -26,7 +26,7 @@ namespace RGB.NET.Devices.Msi public string Model { get; } /// - public Uri Image { get; protected set; } + public Uri Image { get; set; } /// public bool SupportsSyncBack => false; diff --git a/RGB.NET.Devices.Msi/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Msi/Layouts/DeviceLayout.xsd index 5590825..91ced39 100644 --- a/RGB.NET.Devices.Msi/Layouts/DeviceLayout.xsd +++ b/RGB.NET.Devices.Msi/Layouts/DeviceLayout.xsd @@ -13,6 +13,8 @@ + + diff --git a/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs b/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs index 31f848e..c419719 100644 --- a/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs @@ -21,7 +21,7 @@ namespace RGB.NET.Devices.Novation public string Model { get; } /// - public Uri Image { get; protected set; } + public Uri Image { get; set; } /// public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; diff --git a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs index cab89d6..c0abd7f 100644 --- a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs +++ b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs @@ -47,8 +47,7 @@ namespace RGB.NET.Devices.Novation } string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath( - $@"Layouts\Novation\Launchpads\{model.ToUpper()}.xml"), "Default", PathHelper.GetAbsolutePath(@"Images\Novation\Launchpads")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Novation\Launchpads\{model.ToUpper()}.xml"), "Default"); } /// diff --git a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs index 13cc326..b854c26 100644 --- a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System; -using RGB.NET.Core; +using RGB.NET.Core; namespace RGB.NET.Devices.Novation { @@ -20,9 +19,7 @@ namespace RGB.NET.Devices.Novation /// The of the . internal NovationLaunchpadRGBDeviceInfo(string model, int deviceId, NovationColorCapabilities colorCapabilities) : base(RGBDeviceType.LedMatrix, model, deviceId, colorCapabilities) - { - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Novation\Launchpads\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Novation/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Novation/Layouts/DeviceLayout.xsd index 5590825..91ced39 100644 --- a/RGB.NET.Devices.Novation/Layouts/DeviceLayout.xsd +++ b/RGB.NET.Devices.Novation/Layouts/DeviceLayout.xsd @@ -13,6 +13,8 @@ + + diff --git a/RGB.NET.Devices.Novation/Layouts/Novation/Launchpads/LaunchpadS.xml b/RGB.NET.Devices.Novation/Layouts/Novation/Launchpads/LaunchpadS.xml index 8d8de91..53e1975 100644 --- a/RGB.NET.Devices.Novation/Layouts/Novation/Launchpads/LaunchpadS.xml +++ b/RGB.NET.Devices.Novation/Layouts/Novation/Launchpads/LaunchpadS.xml @@ -11,6 +11,8 @@ 240 20 20 + Images\Novation\Launchpads + LaunchpadS.png diff --git a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs index 0d7c684..3d12c74 100644 --- a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs +++ b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs @@ -34,8 +34,7 @@ namespace RGB.NET.Devices.Razer protected override void InitializeLayout() { string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath( - $@"Layouts\Razer\ChromaLink\{model}.xml"), null, PathHelper.GetAbsolutePath(@"Images\Razer\ChromaLink")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Razer\ChromaLink\{model}.xml"), null); if (LedMapping.Count == 0) for (int i = 0; i < _Defines.CHROMALINK_MAX_LEDS; i++) diff --git a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDeviceInfo.cs index 34746d5..fb9c3c4 100644 --- a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDeviceInfo.cs @@ -1,7 +1,4 @@ -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedMember.Global - -using System; +using System; using RGB.NET.Core; namespace RGB.NET.Devices.Razer @@ -22,10 +19,7 @@ namespace RGB.NET.Devices.Razer /// The model of the . internal RazerChromaLinkRGBDeviceInfo(Guid deviceId, string model) : base(deviceId, RGBDeviceType.LedStripe, model) - { - string modelName = Model.Replace(" ", string.Empty).ToUpper(); - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Razer\ChromaLinks\{modelName}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs index 84b307e..2385b01 100644 --- a/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs @@ -26,7 +26,7 @@ namespace RGB.NET.Devices.Razer public string Model { get; } /// - public Uri Image { get; protected set; } + public Uri Image { get; set; } /// public bool SupportsSyncBack => false; diff --git a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs index d825a62..2594236 100644 --- a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs @@ -34,8 +34,7 @@ namespace RGB.NET.Devices.Razer protected override void InitializeLayout() { string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath( - $@"Layouts\Razer\Headset\{model}.xml"), null, PathHelper.GetAbsolutePath(@"Images\Razer\Headset")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Razer\Headset\{model}.xml"), null); if (LedMapping.Count == 0) for (int i = 0; i < _Defines.HEADSET_MAX_LEDS; i++) diff --git a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDeviceInfo.cs index 34604cb..bbe77fe 100644 --- a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDeviceInfo.cs @@ -1,7 +1,4 @@ -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedMember.Global - -using System; +using System; using RGB.NET.Core; namespace RGB.NET.Devices.Razer @@ -22,10 +19,7 @@ namespace RGB.NET.Devices.Razer /// The model of the . internal RazerHeadsetRGBDeviceInfo(Guid deviceId, string model) : base(deviceId, RGBDeviceType.Headset, model) - { - string modelName = Model.Replace(" ", string.Empty).ToUpper(); - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Razer\Headsets\{modelName}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDeviceInfo.cs index d9173fc..1057ecc 100644 --- a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDeviceInfo.cs @@ -40,9 +40,6 @@ namespace RGB.NET.Devices.Razer : base(deviceId, RGBDeviceType.Keyboard, model) { SetLayouts(culture.KeyboardLayoutId); - - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Razer\Keyboards\{Model.Replace(" ", string.Empty).ToUpper()}.png"), - UriKind.Absolute); } #endregion diff --git a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs index f2ce8e9..3098ac2 100644 --- a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs @@ -34,8 +34,7 @@ namespace RGB.NET.Devices.Razer protected override void InitializeLayout() { string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath( - $@"Layouts\Razer\Keypad\{model}.xml"), null, PathHelper.GetAbsolutePath(@"Images\Razer\Keypad")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Razer\Keypad\{model}.xml"), null); if (LedMapping.Count == 0) { diff --git a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDeviceInfo.cs index a41ccc5..8fc0d4d 100644 --- a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDeviceInfo.cs @@ -1,7 +1,4 @@ -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedMember.Global - -using System; +using System; using RGB.NET.Core; namespace RGB.NET.Devices.Razer @@ -22,10 +19,7 @@ namespace RGB.NET.Devices.Razer /// The model of the . internal RazerKeypadRGBDeviceInfo(Guid deviceId, string model) : base(deviceId, RGBDeviceType.Keypad, model) - { - string modelName = Model.Replace(" ", string.Empty).ToUpper(); - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Razer\Keypads\{modelName}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Razer/Layouts/DeviceLayout.xsd b/RGB.NET.Devices.Razer/Layouts/DeviceLayout.xsd index 5590825..91ced39 100644 --- a/RGB.NET.Devices.Razer/Layouts/DeviceLayout.xsd +++ b/RGB.NET.Devices.Razer/Layouts/DeviceLayout.xsd @@ -13,6 +13,8 @@ + + diff --git a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs index a05b2aa..0e39afa 100644 --- a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs @@ -34,8 +34,7 @@ namespace RGB.NET.Devices.Razer protected override void InitializeLayout() { string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath( - $@"Layouts\Razer\Mice\{model}.xml"), null, PathHelper.GetAbsolutePath(@"Images\Razer\Mice")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Razer\Mice\{model}.xml"), null); if (LedMapping.Count == 0) { diff --git a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDeviceInfo.cs index 72782d6..c6d119c 100644 --- a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDeviceInfo.cs @@ -1,7 +1,4 @@ -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedMember.Global - -using System; +using System; using RGB.NET.Core; namespace RGB.NET.Devices.Razer @@ -22,10 +19,7 @@ namespace RGB.NET.Devices.Razer /// The model of the . internal RazerMouseRGBDeviceInfo(Guid deviceId, string model) : base(deviceId, RGBDeviceType.Mouse, model) - { - string modelName = Model.Replace(" ", string.Empty).ToUpper(); - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Razer\Mice\{modelName}.png"), UriKind.Absolute); - } + { } #endregion } diff --git a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs index 0909e18..f91138e 100644 --- a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs @@ -34,8 +34,7 @@ namespace RGB.NET.Devices.Razer protected override void InitializeLayout() { string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath( - $@"Layouts\Razer\Mousepad\{model}.xml"), null, PathHelper.GetAbsolutePath(@"Images\Razer\Mousepad")); + ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Razer\Mousepad\{model}.xml"), null); if (LedMapping.Count == 0) for (int i = 0; i < _Defines.MOUSEPAD_MAX_LEDS; i++) diff --git a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDeviceInfo.cs index b21d49a..eef2aae 100644 --- a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDeviceInfo.cs @@ -1,7 +1,4 @@ -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedMember.Global - -using System; +using System; using RGB.NET.Core; namespace RGB.NET.Devices.Razer @@ -22,10 +19,7 @@ namespace RGB.NET.Devices.Razer /// The model of the . internal RazerMousepadRGBDeviceInfo(Guid deviceId, string model) : base(deviceId, RGBDeviceType.Mousepad, model) - { - string modelName = Model.Replace(" ", string.Empty).ToUpper(); - Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Razer\Mousepads\{modelName}.png"), UriKind.Absolute); - } + { } #endregion }