diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs index bc8c0e6..ad4bc5a 100644 --- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs +++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs @@ -172,7 +172,7 @@ namespace RGB.NET.Core { if ((ledId == LedId.Invalid) || LedMapping.ContainsKey(ledId)) return null; - Led led = new(this, ledId, location, size, customData); + Led led = new(this, ledId, location, size, customData ?? GetLedCustomData(ledId)); LedMapping.Add(ledId, led); return led; } @@ -186,6 +186,8 @@ namespace RGB.NET.Core return led; } + protected virtual object? GetLedCustomData(LedId ledId) => null; + #region Enumerator /// diff --git a/RGB.NET.Devices.Asus/AsusDeviceProviderLoader.cs b/RGB.NET.Devices.Asus/AsusDeviceProviderLoader.cs deleted file mode 100644 index 576dfb5..0000000 --- a/RGB.NET.Devices.Asus/AsusDeviceProviderLoader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.Asus -{ - /// - /// Represents a device provider loaded used to dynamically load asus devices into an application. - /// - public class AsusDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => false; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => AsusDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs b/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs index 7ee2183..6920a01 100644 --- a/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Dram/AsusDramRGBDevice.cs @@ -26,18 +26,13 @@ namespace RGB.NET.Devices.Asus /// protected override void InitializeLayout() { - //TODO DarthAffe 07.10.2017: Look for a good default layout int ledCount = DeviceInfo.Device.Lights.Count; for (int i = 0; i < ledCount; i++) - InitializeLed(LedId.DRAM1 + i, new Rectangle(i * 10, 0, 10, 10)); - - //TODO DarthAffe 21.10.2017: We don't know the model, how to save layouts and images? - //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images? - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Asus\Drams", $"{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + AddLed(LedId.DRAM1 + i, new Point(i * 10, 0), new Size(10, 10)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.DRAM1; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.DRAM1; #endregion } diff --git a/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs index 42d61e6..f54a26b 100644 --- a/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System; -using AuraServiceLib; +using AuraServiceLib; using RGB.NET.Core; namespace RGB.NET.Devices.Asus @@ -24,12 +23,8 @@ namespace RGB.NET.Devices.Asus /// public string Model { get; } - /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } - /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; - public IAuraSyncDevice Device { get; } #endregion diff --git a/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs b/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs index 40eb602..c114b52 100644 --- a/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Generic/AsusUnspecifiedRGBDevice.cs @@ -36,14 +36,11 @@ namespace RGB.NET.Devices.Asus { int ledCount = DeviceInfo.Device.Lights.Count; for (int i = 0; i < ledCount; i++) - InitializeLed(_baseLedId + i, new Rectangle(i * 10, 0, 10, 10)); - - //TODO DarthAffe 19.05.2019: Add a way to define a layout for this kind of devies + AddLed(_baseLedId + i, new Point(i * 10, 0), new Size(10, 10)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)_baseLedId; - + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)_baseLedId; #endregion } } diff --git a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs index f50f70f..8c0f98a 100644 --- a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDevice.cs @@ -26,17 +26,13 @@ namespace RGB.NET.Devices.Asus /// protected override void InitializeLayout() { - //TODO DarthAffe 07.10.2017: Look for a good default layout int ledCount = DeviceInfo.Device.Lights.Count; for (int i = 0; i < ledCount; i++) - 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(this, @"Layouts\Asus\GraphicsCards", $"{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + AddLed(LedId.GraphicsCard1 + i, new Point(i * 10, 0), new Size(10, 10)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.GraphicsCard1; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.GraphicsCard1; #endregion } diff --git a/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs b/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs index a3727d1..96c4c87 100644 --- a/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Headset/AsusHeadsetRGBDevice.cs @@ -26,17 +26,13 @@ namespace RGB.NET.Devices.Asus /// protected override void InitializeLayout() { - //TODO DarthAffe 07.10.2017: Look for a good default layout int ledCount = DeviceInfo.Device.Lights.Count; for (int i = 0; i < ledCount; i++) - InitializeLed(LedId.Headset1 + 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(this, @"Layouts\Asus\Headsets", $"{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + AddLed(LedId.Headset1 + i, new Point(i * 40, 0), new Size(40, 8)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Headset1; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Headset1; #endregion } diff --git a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs index 7c444cf..9a00a24 100644 --- a/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Keyboard/AsusKeyboardRGBDevice.cs @@ -35,26 +35,23 @@ namespace RGB.NET.Devices.Asus { int pos = 0; foreach (IAuraRgbKey key in ((IAuraSyncKeyboard)DeviceInfo.Device).Keys) - InitializeLed(reversedMapping[(AsusLedId)key.Code], new Point(pos++ * 19, 0), new Size(19, 19)); + AddLed(reversedMapping[(AsusLedId)key.Code], new Point(pos++ * 19, 0), new Size(19, 19)); //UK Layout - InitializeLed(reversedMapping[AsusLedId.KEY_OEM_102], new Point(pos++ * 19, 0), new Size(19, 19)); + AddLed(reversedMapping[AsusLedId.KEY_OEM_102], new Point(pos++ * 19, 0), new Size(19, 19)); - InitializeLed(reversedMapping[AsusLedId.UNDOCUMENTED_1], new Point(pos * 19, 0), new Size(19, 19)); + AddLed(reversedMapping[AsusLedId.UNDOCUMENTED_1], new Point(pos * 19, 0), new Size(19, 19)); } else { int ledCount = DeviceInfo.Device.Lights.Count; for (int i = 0; i < ledCount; i++) - InitializeLed(LedId.Keyboard_Custom1 + i, new Point(i * 19, 0), new Size(19, 19)); + AddLed(LedId.Keyboard_Custom1 + i, new Point(i * 19, 0), new Size(19, 19)); } - - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\Asus\Keyboards\{model}", $"{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), DeviceInfo.LogicalLayout.ToString()); } /// - protected override object CreateLedCustomData(LedId ledId) + protected override object? GetLedCustomData(LedId ledId) { if (DeviceInfo.Device.Type == (uint)AsusDeviceType.NB_KB_4ZONE_RGB) return ledId - LedId.Keyboard_Custom1; diff --git a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs index 2109aee..71ee547 100644 --- a/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Mainboard/AsusMainboardRGBDevice.cs @@ -26,18 +26,14 @@ namespace RGB.NET.Devices.Asus /// protected override void InitializeLayout() { - //TODO DarthAffe 07.10.2017: Look for a good default layout int ledCount = DeviceInfo.Device.Lights.Count; 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(this, @"Layouts\Asus\Mainboards", $"{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + AddLed(LedId.Mainboard1 + i, new Point(i * 40, 0), new Size(40, 8)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1; - + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1; + #endregion } } diff --git a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs index 030e547..cd97e88 100644 --- a/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs +++ b/RGB.NET.Devices.Asus/Mouse/AsusMouseRGBDevice.cs @@ -26,16 +26,13 @@ namespace RGB.NET.Devices.Asus /// protected override void InitializeLayout() { - //TODO DarthAffe 07.10.2017: Look for a good default layout int ledCount = DeviceInfo.Device.Lights.Count; for (int i = 0; i < ledCount; i++) - InitializeLed(LedId.Mouse1 + i, new Rectangle(i * 10, 0, 10, 10)); - - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Asus\Mouses", $"{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + AddLed(LedId.Mouse1 + i, new Point(i * 10, 0), new Size(10, 10)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1; #endregion } diff --git a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProviderLoader.cs b/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProviderLoader.cs deleted file mode 100644 index d8c0b9e..0000000 --- a/RGB.NET.Devices.CoolerMaster/CoolerMasterDeviceProviderLoader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.CoolerMaster -{ - /// - /// Represents a device provider loaded used to dynamically load cooler-master devices into an application. - /// - public class CoolerMasterDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => false; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => CoolerMasterDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs index 9e98e92..dccc434 100644 --- a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs +++ b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs @@ -24,12 +24,8 @@ namespace RGB.NET.Devices.CoolerMaster /// public string Model { get; } - /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } - /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; - /// /// Gets the of the . /// diff --git a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs index 8a8c17a..e3dfc27 100644 --- a/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.CoolerMaster/Keyboard/CoolerMasterKeyboardRGBDevice.cs @@ -31,18 +31,14 @@ namespace RGB.NET.Devices.CoolerMaster throw new RGBDeviceException($"Failed to find a CoolerMasterKeyboardLedMapping for device index {DeviceInfo.DeviceIndex}"); if (!deviceMappings.TryGetValue(DeviceInfo.PhysicalLayout, out Dictionary mapping)) throw new RGBDeviceException($"Failed to find a CoolerMasterKeyboardLedMapping for device index {DeviceInfo.DeviceIndex} with physical layout {DeviceInfo.PhysicalLayout}"); - - foreach (KeyValuePair led in mapping) - InitializeLed(led.Key, new Rectangle(led.Value.column * 19, led.Value.row * 19, 19, 19)); - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\CoolerMaster\Keyboards\{model}", $"{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), - DeviceInfo.LogicalLayout.ToString()); + foreach (KeyValuePair led in mapping) + AddLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19, 19)); } /// - protected override object CreateLedCustomData(LedId ledId) => CoolerMasterKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout][ledId]; - + protected override object GetLedCustomData(LedId ledId) => CoolerMasterKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout][ledId]; + #endregion } } diff --git a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs index a59b1ce..e1efb77 100644 --- a/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs +++ b/RGB.NET.Devices.CoolerMaster/Mouse/CoolerMasterMouseRGBDevice.cs @@ -30,15 +30,12 @@ namespace RGB.NET.Devices.CoolerMaster Dictionary mapping = CoolerMasterMouseLedMappings.Mapping[DeviceInfo.DeviceIndex]; foreach (KeyValuePair led in mapping) - InitializeLed(led.Key, new Rectangle(led.Value.column * 19, led.Value.row * 19, 19, 19)); - - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\CoolerMaster\Mice", $"{model}.xml"), null); + AddLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19, 19)); } /// - protected override object CreateLedCustomData(LedId ledId) => CoolerMasterMouseLedMappings.Mapping[DeviceInfo.DeviceIndex][ledId]; - + protected override object GetLedCustomData(LedId ledId) => CoolerMasterMouseLedMappings.Mapping[DeviceInfo.DeviceIndex][ledId]; + #endregion } } diff --git a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs b/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs index 5854623..174fd47 100644 --- a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs @@ -42,15 +42,11 @@ namespace RGB.NET.Devices.Corsair { LedId ledId = referenceId + i; _idMapping.Add(ledId, DeviceInfo.ReferenceCorsairLed + i); - InitializeLed(ledId, new Rectangle(i * 10, 0, 10, 10)); + AddLed(ledId, new Point(i * 10, 0), new Size(10, 10)); } - - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Corsair\Customs", $"{model}.xml"), null); } - - /// - protected override object CreateLedCustomData(LedId ledId) => _idMapping.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; + + protected override object? GetLedCustomData(LedId ledId) => _idMapping.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; protected virtual LedId GetReferenceLed(RGBDeviceType deviceType) { diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs index 2e68418..5b579e8 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs @@ -37,11 +37,7 @@ namespace RGB.NET.Devices.Corsair /// public string Model { get; } - /// - public Uri Image { get; set; } - - /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; + public object? LayoutMetadata { get; set; } /// /// Gets a flag that describes device capabilities. () @@ -64,7 +60,7 @@ namespace RGB.NET.Devices.Corsair 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.Model = nativeInfo.model == IntPtr.Zero ? string.Empty : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase); this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask; DeviceName = GetUniqueModelName(modelCounter); @@ -95,9 +91,9 @@ namespace RGB.NET.Devices.Corsair private string GetUniqueModelName(Dictionary modelCounter) { - if (modelCounter.TryGetValue(Model, out int counter)) + if (modelCounter.TryGetValue(Model, out int _)) { - counter = ++modelCounter[Model]; + int counter = ++modelCounter[Model]; return $"{Manufacturer} {Model} {counter}"; } else diff --git a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs index 8152a2c..7a39b28 100644 --- a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs @@ -29,14 +29,11 @@ namespace RGB.NET.Devices.Corsair /// protected override void InitializeLayout() { - InitializeLed(LedId.Headset1, new Rectangle(0, 0, 10, 10)); - InitializeLed(LedId.Headset2, new Rectangle(10, 0, 10, 10)); - - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Corsair\Headsets", $"{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + AddLed(LedId.Headset1, new Point(0, 0), new Size(10, 10)); + AddLed(LedId.Headset2, new Point(10, 0), new Size(10, 10)); } - /// - protected override object CreateLedCustomData(LedId ledId) => HeadsetIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; + protected override object GetLedCustomData(LedId ledId) => HeadsetIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; #endregion } diff --git a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs index d7e28c9..966fc77 100644 --- a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs @@ -34,28 +34,33 @@ namespace RGB.NET.Devices.Corsair /// protected override void InitializeLayout() { - _CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); + _CorsairLedPositions? nativeLedPositions = (_CorsairLedPositions?)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); + if (nativeLedPositions == null) return; int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition)); IntPtr ptr = nativeLedPositions.pLedPosition; - List<_CorsairLedPosition> positions = new List<_CorsairLedPosition>(); + List<_CorsairLedPosition> positions = new(); for (int i = 0; i < nativeLedPositions.numberOfLed; i++) { - _CorsairLedPosition ledPosition = (_CorsairLedPosition)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition)); + _CorsairLedPosition? ledPosition = (_CorsairLedPosition?)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition)); + if (ledPosition == null) continue; + ptr = new IntPtr(ptr.ToInt64() + structSize); positions.Add(ledPosition); } Dictionary mapping = HeadsetStandIdMapping.DEFAULT.SwapKeyValue(); foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.LedId)) - InitializeLed(mapping.TryGetValue(ledPosition.LedId, out LedId ledId) ? ledId : LedId.Invalid, ledPosition.ToRectangle()); - - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Corsair\HeadsetStands", $"{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + { + LedId ledId = mapping.TryGetValue(ledPosition.LedId, out LedId id) ? id : LedId.Invalid; + Rectangle rectangle = ledPosition.ToRectangle(); + AddLed(ledId, rectangle.Location, rectangle.Size); + } } /// - protected override object CreateLedCustomData(LedId ledId) => HeadsetStandIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; + protected override object GetLedCustomData(LedId ledId) => HeadsetStandIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; #endregion } diff --git a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs index c1bb52a..60febaa 100644 --- a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs @@ -33,7 +33,8 @@ namespace RGB.NET.Devices.Corsair /// protected override void InitializeLayout() { - _CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); + _CorsairLedPositions? nativeLedPositions = (_CorsairLedPositions?)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); + if (nativeLedPositions == null) return; int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition)); IntPtr ptr = nativeLedPositions.pLedPosition; @@ -41,19 +42,18 @@ namespace RGB.NET.Devices.Corsair Dictionary mapping = KeyboardIdMapping.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()); + _CorsairLedPosition? ledPosition = (_CorsairLedPosition?)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition)); + if (ledPosition == null) continue; + + LedId ledId = mapping.TryGetValue(ledPosition.LedId, out LedId id) ? id : LedId.Invalid; + Rectangle rectangle = ledPosition.ToRectangle(); + AddLed(ledId, rectangle.Location, rectangle.Size); ptr = new IntPtr(ptr.ToInt64() + structSize); } - - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\Corsair\Keyboards\{model}", $"{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), - DeviceInfo.LogicalLayout.ToString()); } - /// - protected override object CreateLedCustomData(LedId ledId) => KeyboardIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; + protected override object GetLedCustomData(LedId ledId) => KeyboardIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; #endregion } diff --git a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs index 836e055..f174b8c 100644 --- a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs @@ -33,7 +33,8 @@ namespace RGB.NET.Devices.Corsair /// protected override void InitializeLayout() { - _CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); + _CorsairLedPositions? nativeLedPositions = (_CorsairLedPositions?)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); + if (nativeLedPositions == null) return; int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition)); IntPtr ptr = nativeLedPositions.pLedPosition; @@ -41,18 +42,18 @@ namespace RGB.NET.Devices.Corsair Dictionary 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()); + _CorsairLedPosition? ledPosition = (_CorsairLedPosition?)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition)); + if (ledPosition == null) continue; + + LedId ledId = mapping.TryGetValue(ledPosition.LedId, out LedId id) ? id : LedId.Invalid; + Rectangle rectangle = ledPosition.ToRectangle(); + AddLed(ledId, rectangle.Location, rectangle.Size); ptr = new IntPtr(ptr.ToInt64() + structSize); } - - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Corsair\Memory", $"{model}.xml"), null); } - /// - protected override object CreateLedCustomData(LedId ledId) => MemoryIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; + protected override object GetLedCustomData(LedId ledId) => MemoryIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; #endregion } diff --git a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs index 292d7d8..ec5614b 100644 --- a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs @@ -33,32 +33,29 @@ namespace RGB.NET.Devices.Corsair switch (DeviceInfo.PhysicalLayout) { case CorsairPhysicalMouseLayout.Zones1: - InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10)); + AddLed(LedId.Mouse1, new Point(0, 0), new Size(10, 10)); break; case CorsairPhysicalMouseLayout.Zones2: - InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10)); - InitializeLed(LedId.Mouse2, new Rectangle(10, 0, 10, 10)); + AddLed(LedId.Mouse1, new Point(0, 0), new Size(10, 10)); + AddLed(LedId.Mouse2, new Point(10, 0), new Size(10, 10)); break; case CorsairPhysicalMouseLayout.Zones3: - InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10)); - InitializeLed(LedId.Mouse2, new Rectangle(10, 0, 10, 10)); - InitializeLed(LedId.Mouse3, new Rectangle(20, 0, 10, 10)); + AddLed(LedId.Mouse1, new Point(0, 0), new Size(10, 10)); + AddLed(LedId.Mouse2, new Point(10, 0), new Size(10, 10)); + AddLed(LedId.Mouse3, new Point(20, 0), new Size(10, 10)); break; case CorsairPhysicalMouseLayout.Zones4: - InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10)); - InitializeLed(LedId.Mouse2, new Rectangle(10, 0, 10, 10)); - InitializeLed(LedId.Mouse3, new Rectangle(20, 0, 10, 10)); - InitializeLed(LedId.Mouse4, new Rectangle(30, 0, 10, 10)); + AddLed(LedId.Mouse1, new Point(0, 0), new Size(10, 10)); + AddLed(LedId.Mouse2, new Point(10, 0), new Size(10, 10)); + AddLed(LedId.Mouse3, new Point(20, 0), new Size(10, 10)); + AddLed(LedId.Mouse4, new Point(30, 0), new Size(10, 10)); break; default: throw new RGBDeviceException($"Can't initialize mouse with layout '{DeviceInfo.PhysicalLayout}'"); } - - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Corsair\Mice", $"{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } - /// - protected override object CreateLedCustomData(LedId ledId) + protected override object? GetLedCustomData(LedId ledId) { if (string.Equals(DeviceInfo.Model, "GLAIVE RGB", StringComparison.OrdinalIgnoreCase)) return MouseIdMapping.GLAIVE.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; diff --git a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs index b245ca1..00b526d 100644 --- a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs @@ -34,28 +34,32 @@ namespace RGB.NET.Devices.Corsair /// protected override void InitializeLayout() { - _CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); + _CorsairLedPositions? nativeLedPositions = (_CorsairLedPositions?)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); + if (nativeLedPositions == null) return; int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition)); IntPtr ptr = nativeLedPositions.pLedPosition; - List<_CorsairLedPosition> positions = new List<_CorsairLedPosition>(); + List<_CorsairLedPosition> positions = new(); for (int i = 0; i < nativeLedPositions.numberOfLed; i++) { - _CorsairLedPosition ledPosition = (_CorsairLedPosition)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition)); + _CorsairLedPosition? ledPosition = (_CorsairLedPosition?)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition)); + if (ledPosition == null) continue; + ptr = new IntPtr(ptr.ToInt64() + structSize); positions.Add(ledPosition); } Dictionary mapping = MousepadIdMapping.DEFAULT.SwapKeyValue(); foreach (_CorsairLedPosition ledPosition in positions.OrderBy(p => p.LedId)) - InitializeLed(mapping.TryGetValue(ledPosition.LedId, out LedId ledId) ? ledId : LedId.Invalid, ledPosition.ToRectangle()); - - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Corsair\Mousepads", $"{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); + { + LedId ledId = mapping.TryGetValue(ledPosition.LedId, out LedId id) ? id : LedId.Invalid; + Rectangle rectangle = ledPosition.ToRectangle(); + AddLed(ledId, rectangle.Location, rectangle.Size); + } } - /// - protected override object CreateLedCustomData(LedId ledId) => MousepadIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; + protected override object GetLedCustomData(LedId ledId) => MousepadIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid; #endregion } diff --git a/RGB.NET.Devices.DMX/DMXDeviceProviderLoader.cs b/RGB.NET.Devices.DMX/DMXDeviceProviderLoader.cs deleted file mode 100644 index 193cc6b..0000000 --- a/RGB.NET.Devices.DMX/DMXDeviceProviderLoader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.DMX -{ - /// - /// Represents a device provider loaded used to dynamically load DMX devices into an application. - /// - public class DMXDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => true; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => DMXDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.DMX/E131/E131Device.cs b/RGB.NET.Devices.DMX/E131/E131Device.cs index a4a69d2..22dd25e 100644 --- a/RGB.NET.Devices.DMX/E131/E131Device.cs +++ b/RGB.NET.Devices.DMX/E131/E131Device.cs @@ -38,9 +38,7 @@ namespace RGB.NET.Devices.DMX.E131 { int count = 0; foreach (LedId id in _ledMappings.Keys) - InitializeLed(id, new Rectangle((count++) * 10, 0, 10, 10)); - - //TODO DarthAffe 18.02.2018: Allow to load a layout. + AddLed(id, new Point((count++) * 10, 0), new Size(10, 10)); if (Size == Size.Invalid) { @@ -54,7 +52,8 @@ namespace RGB.NET.Devices.DMX.E131 } /// - protected override object CreateLedCustomData(LedId ledId) => new LedChannelMapping(_ledMappings[ledId]); + protected override object? GetLedCustomData(LedId ledId) => new LedChannelMapping(_ledMappings[ledId]); + /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => _updateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0)); diff --git a/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs b/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs index eb486a4..667fba3 100644 --- a/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs +++ b/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs @@ -32,12 +32,8 @@ namespace RGB.NET.Devices.DMX.E131 /// public string Model { get; } - - /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; - /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } /// /// The hostname of the device. diff --git a/RGB.NET.Devices.Debug/DebugDeviceProvider.cs b/RGB.NET.Devices.Debug/DebugDeviceProvider.cs index 24a82fe..4efe3d6 100644 --- a/RGB.NET.Devices.Debug/DebugDeviceProvider.cs +++ b/RGB.NET.Devices.Debug/DebugDeviceProvider.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using RGB.NET.Core; +using RGB.NET.Layout; namespace RGB.NET.Devices.Debug { @@ -28,11 +29,8 @@ namespace RGB.NET.Devices.Debug /// public IEnumerable Devices { get; private set; } - /// - public bool HasExclusiveAccess { get; private set; } - - private List<(string layout, string imageLayout, Action> updateLedsAction)> _fakeDeviceDefinitions - = new List<(string layout, string imageLayout, Action> updateLedsAction)>(); + private List<(IDeviceLayout layout, string imageLayout, Action>? updateLedsAction)> _fakeDeviceDefinitions + = new List<(IDeviceLayout layout, string imageLayout, Action>? updateLedsAction)>(); #endregion @@ -58,7 +56,7 @@ namespace RGB.NET.Devices.Debug /// The path of the layout file to be used. /// The image-layout to load. /// A action emulating led-updates. - public void AddFakeDeviceDefinition(string layout, string imageLayout, Action> updateLedsAction = null) + public void AddFakeDeviceDefinition(IDeviceLayout layout, string imageLayout, Action>? updateLedsAction = null) => _fakeDeviceDefinitions.Add((layout, imageLayout, updateLedsAction)); /// @@ -67,18 +65,15 @@ namespace RGB.NET.Devices.Debug public void ClearFakeDeviceDefinitions() => _fakeDeviceDefinitions.Clear(); /// - public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.Unknown, bool exclusiveAccessIfPossible = false, bool throwExceptions = false) + public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.Unknown, bool throwExceptions = false) { IsInitialized = false; try { - HasExclusiveAccess = exclusiveAccessIfPossible; - List devices = new List(); - foreach ((string layout, string imageLayout, Action> updateLedsAction) in _fakeDeviceDefinitions) + foreach ((IDeviceLayout layout, string imageLayout, Action>? updateLedsAction) in _fakeDeviceDefinitions) { DebugRGBDevice device = new DebugRGBDevice(layout, updateLedsAction); - device.Initialize(layout, imageLayout); devices.Add(device); } diff --git a/RGB.NET.Devices.Debug/DebugDeviceProviderLoader.cs b/RGB.NET.Devices.Debug/DebugDeviceProviderLoader.cs deleted file mode 100644 index 819a084..0000000 --- a/RGB.NET.Devices.Debug/DebugDeviceProviderLoader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.Debug -{ - /// - /// Represents a device provider loaded used to dynamically load debug devices into an application. - /// - public class DebugDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => true; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => DebugDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.Debug/DebugRGBDevice.cs b/RGB.NET.Devices.Debug/DebugRGBDevice.cs index 7d787d7..b87c3d6 100644 --- a/RGB.NET.Devices.Debug/DebugRGBDevice.cs +++ b/RGB.NET.Devices.Debug/DebugRGBDevice.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using RGB.NET.Core; -using RGB.NET.Core.Layout; +using RGB.NET.Layout; namespace RGB.NET.Devices.Debug { @@ -16,12 +16,9 @@ namespace RGB.NET.Devices.Debug /// public override DebugRGBDeviceInfo DeviceInfo { get; } - /// - /// Gets the path of the layout used to mock this - /// - public string LayoutPath { get; } - - private Action> _updateLedsAction; + public IDeviceLayout Layout { get; } + + private Action>? _updateLedsAction; #endregion @@ -29,21 +26,20 @@ namespace RGB.NET.Devices.Debug /// /// Internal constructor of . /// - internal DebugRGBDevice(string layoutPath, Action> updateLedsAction = null) + internal DebugRGBDevice(IDeviceLayout layout, Action>? updateLedsAction = null) { - this.LayoutPath = layoutPath; + this.Layout = layout; this._updateLedsAction = updateLedsAction; - DeviceLayout layout = DeviceLayout.Load(layoutPath); - DeviceInfo = new DebugRGBDeviceInfo(layout.Type, layout.Vendor, layout.Model, layout.Lighting); + DeviceInfo = new DebugRGBDeviceInfo(layout.Type, layout.Vendor ?? "RGB.NET", layout.Model ?? "Debug", layout.CustomData); + + Layout.ApplyTo(this); } #endregion #region Methods - internal void Initialize(string layoutPath, string imageLayout) => ApplyLayoutFromFile(layoutPath, imageLayout, true); - /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => _updateLedsAction?.Invoke(ledsToUpdate); diff --git a/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs b/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs index d7f5a74..be65426 100644 --- a/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs @@ -23,11 +23,7 @@ namespace RGB.NET.Devices.Debug /// public string Model { get; } - /// - public RGBDeviceLighting Lighting { get; } - - /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } #endregion @@ -39,15 +35,14 @@ namespace RGB.NET.Devices.Debug /// The of the device. /// The manufacturer of the device. /// The model of the device. - /// The of the device. - internal DebugRGBDeviceInfo(RGBDeviceType deviceType, string manufacturer, string model, RGBDeviceLighting lighting, string deviceName = null) + internal DebugRGBDeviceInfo(RGBDeviceType deviceType, string manufacturer, string model, object? customData) { this.DeviceType = deviceType; this.Manufacturer = manufacturer; this.Model = model; - this.Lighting = lighting; + this.LayoutMetadata = customData; - DeviceName = deviceName ?? $"{Manufacturer} {Model}"; + DeviceName = $"{Manufacturer} {Model}"; } #endregion diff --git a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj index 68768fc..646da10 100644 --- a/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj +++ b/RGB.NET.Devices.Debug/RGB.NET.Devices.Debug.csproj @@ -52,5 +52,6 @@ + \ No newline at end of file diff --git a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs index 74104fa..d46c76f 100644 --- a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs +++ b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDevice.cs @@ -1,5 +1,4 @@ -using System.Linq; -using RGB.NET.Core; +using RGB.NET.Core; namespace RGB.NET.Devices.Logitech { @@ -45,31 +44,11 @@ namespace RGB.NET.Devices.Logitech /// /// Initializes the device. /// - public void Initialize(UpdateQueue updateQueue) + public virtual void Initialize(UpdateQueue updateQueue) { - InitializeLayout(); - - if (Size == Size.Invalid) - { - Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle)); - Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y); - } - UpdateQueue = updateQueue; } - /// - /// Initializes the and of the device. - /// - protected virtual void InitializeLayout() - { - if (!(DeviceInfo is LogitechRGBDeviceInfo info)) return; - - string layout = info.ImageLayout; - string layoutPath = info.LayoutPath; - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Logitech", $"{layoutPath}.xml"), layout, true); - } - /// public override void Dispose() { diff --git a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs index 1a9bce7..aefa7b5 100644 --- a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs @@ -1,5 +1,4 @@ -using System; -using RGB.NET.Core; +using RGB.NET.Core; namespace RGB.NET.Devices.Logitech { @@ -23,24 +22,8 @@ namespace RGB.NET.Devices.Logitech /// public string Model { get; } - /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } - /// - public RGBDeviceLighting Lighting - { - get - { - if (DeviceCaps.HasFlag(LogitechDeviceCaps.PerKeyRGB)) - return RGBDeviceLighting.Key; - - if (DeviceCaps.HasFlag(LogitechDeviceCaps.DeviceRGB)) - return RGBDeviceLighting.Device; - - return RGBDeviceLighting.None; - } - } - /// /// Gets a flag that describes device capabilities. () /// diff --git a/RGB.NET.Devices.Logitech/LogitechDeviceProviderLoader.cs b/RGB.NET.Devices.Logitech/LogitechDeviceProviderLoader.cs deleted file mode 100644 index e79691b..0000000 --- a/RGB.NET.Devices.Logitech/LogitechDeviceProviderLoader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.Logitech -{ - /// - /// Represents a device provider loaded used to dynamically load logitech devices into an application. - /// - public class LogitechDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => false; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => LogitechDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs index 42ff262..f2c1656 100644 --- a/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs +++ b/RGB.NET.Devices.Logitech/PerDevice/LogitechPerDeviceRGBDevice.cs @@ -26,16 +26,14 @@ namespace RGB.NET.Devices.Logitech #region Methods /// - protected override void InitializeLayout() + public override void Initialize(UpdateQueue updateQueue) { - base.InitializeLayout(); + base.Initialize(updateQueue); - if (LedMapping.Count == 0) - InitializeLed(LedId.Custom1, new Rectangle(0, 0, 10, 10)); + AddLed(LedId.Custom1, new Point(0, 0), new Size(10, 10)); } - /// - protected override object CreateLedCustomData(LedId ledId) => (ledId, LogitechLedId.DEVICE); + protected override object? GetLedCustomData(LedId ledId) => (ledId, LogitechLedId.DEVICE); /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0).Take(1)); diff --git a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs index e5e3f40..2328370 100644 --- a/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs +++ b/RGB.NET.Devices.Logitech/PerKey/LogitechPerKeyRGBDevice.cs @@ -26,7 +26,7 @@ namespace RGB.NET.Devices.Logitech #region Methods /// - protected override object CreateLedCustomData(LedId ledId) => (ledId, PerKeyIdMapping.DEFAULT.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : LogitechLedId.Invalid); + protected override object? GetLedCustomData(LedId ledId) => (ledId, PerKeyIdMapping.DEFAULT.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : LogitechLedId.Invalid); /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0)); diff --git a/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs b/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs index 419e796..d250d4d 100644 --- a/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs +++ b/RGB.NET.Devices.Logitech/Zone/LogitechZoneRGBDevice.cs @@ -47,16 +47,16 @@ namespace RGB.NET.Devices.Logitech #region Methods /// - protected override void InitializeLayout() + public override void Initialize(UpdateQueue updateQueue) { - for (int i = 0; i < DeviceInfo.Zones; i++) - InitializeLed(_baseLedId + i, new Rectangle(i * 10, 0, 10, 10)); + base.Initialize(updateQueue); - base.InitializeLayout(); + for (int i = 0; i < DeviceInfo.Zones; i++) + AddLed(_baseLedId + i, new Point(i * 10, 0), new Size(10, 10)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)(ledId - _baseLedId); + protected override object? GetLedCustomData(LedId ledId) => (int)(ledId - _baseLedId); /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0)); diff --git a/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs b/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs index 3790298..87d2c8c 100644 --- a/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs @@ -29,10 +29,7 @@ namespace RGB.NET.Devices.Msi public string Model { get; } /// - public Uri Image { get; set; } - - /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; + public object? LayoutMetadata { get; set; } #endregion diff --git a/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs index 3b295f4..8a41f90 100644 --- a/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs +++ b/RGB.NET.Devices.Msi/GraphicsCard/MsiGraphicsCardRGBDevice.cs @@ -37,16 +37,13 @@ namespace RGB.NET.Devices.Msi //Hex3l: Every led is a video card adapter. _MsiSDK.SetLedStyle(DeviceInfo.MsiDeviceType, i, LED_STYLE); - InitializeLed(LedId.GraphicsCard1 + i, new Rectangle(i * 10, 0, 10, 10)); + AddLed(LedId.GraphicsCard1 + i, new Point(i * 10, 0), new Size(10, 10)); } - - //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images? - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\MSI\GraphicsCard\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.GraphicsCard1; - + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.GraphicsCard1; + #endregion } } diff --git a/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs b/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs index 04e7787..5cf8b00 100644 --- a/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs +++ b/RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs @@ -35,16 +35,13 @@ namespace RGB.NET.Devices.Msi const string LED_STYLE = "Steady"; _MsiSDK.SetLedStyle(DeviceInfo.MsiDeviceType, i, LED_STYLE); - InitializeLed(LedId.Mainboard1 + i, new Rectangle(i * 40, 0, 40, 8)); + AddLed(LedId.Mainboard1 + i, new Point(i * 40, 0), new Size(40, 8)); } - - //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images? - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\MSI\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1; - + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1; + #endregion } } diff --git a/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs b/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs index 1438f3a..dd4b702 100644 --- a/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs +++ b/RGB.NET.Devices.Msi/Mouse/MsiMouseRGBDevice.cs @@ -35,16 +35,13 @@ namespace RGB.NET.Devices.Msi const string LED_STYLE = "Steady"; _MsiSDK.SetLedStyle(DeviceInfo.MsiDeviceType, i, LED_STYLE); - InitializeLed(LedId.Mouse1 + i, new Rectangle(i * 10, 0, 10, 10)); + AddLed(LedId.Mouse1 + i, new Point(i * 10, 0), new Size(10, 10)); } - - //TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images? - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\MSI\Mouses\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1; - + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1; + #endregion } } diff --git a/RGB.NET.Devices.Msi/MsiDeviceProviderLoader.cs b/RGB.NET.Devices.Msi/MsiDeviceProviderLoader.cs deleted file mode 100644 index b059f85..0000000 --- a/RGB.NET.Devices.Msi/MsiDeviceProviderLoader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.Msi -{ - /// - /// Represents a device provider loaded used to dynamically load MSI devices into an application. - /// - public class MsiDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => false; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => MsiDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj.DotSettings b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj.DotSettings index 5db6073..bec0f75 100644 --- a/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj.DotSettings +++ b/RGB.NET.Devices.Msi/RGB.NET.Devices.Msi.csproj.DotSettings @@ -2,4 +2,5 @@ True True True - True \ No newline at end of file + True + True \ No newline at end of file diff --git a/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs b/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs index 8e613bb..f750ecf 100644 --- a/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs @@ -24,11 +24,8 @@ namespace RGB.NET.Devices.Novation public string Model { get; } /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } - /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; - /// /// Gets the of the . /// diff --git a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs index e00f114..39271aa 100644 --- a/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs +++ b/RGB.NET.Devices.Novation/Launchpad/NovationLaunchpadRGBDevice.cs @@ -34,15 +34,12 @@ namespace RGB.NET.Devices.Novation foreach (LedId ledId in mapping.Keys) { (_, _, int x, int y) = mapping[ledId]; - InitializeLed(ledId, new Point(BUTTON_SIZE * x, BUTTON_SIZE * y), new Size(BUTTON_SIZE)); + AddLed(ledId, new Point(BUTTON_SIZE * x, BUTTON_SIZE * y), new Size(BUTTON_SIZE)); } - - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Novation\Launchpads", $"{model.ToUpper()}.xml"), "Default"); } /// - protected override object CreateLedCustomData(LedId ledId) => GetDeviceMapping().TryGetValue(ledId, out (byte mode, byte id, int _, int __) data) ? (data.mode, data.id) : ((byte)0x00, (byte)0x00); + protected override object GetLedCustomData(LedId ledId) => GetDeviceMapping().TryGetValue(ledId, out (byte mode, byte id, int _, int __) data) ? (data.mode, data.id) : ((byte)0x00, (byte)0x00); protected virtual Dictionary GetDeviceMapping() => DeviceInfo.LedIdMapping switch diff --git a/RGB.NET.Devices.Novation/NovationDeviceProviderLoader.cs b/RGB.NET.Devices.Novation/NovationDeviceProviderLoader.cs deleted file mode 100644 index f2fc28d..0000000 --- a/RGB.NET.Devices.Novation/NovationDeviceProviderLoader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.Novation -{ - /// - /// Represents a device provider loaded used to dynamically load novation devices into an application. - /// - public class NovationDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => false; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => NovationDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs index 853b222..79165d3 100644 --- a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs +++ b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs @@ -30,16 +30,12 @@ namespace RGB.NET.Devices.Razer /// protected override void InitializeLayout() { - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Razer\ChromaLink", $"{model}.xml"), null); - - if (LedMapping.Count == 0) - for (int i = 0; i < _Defines.CHROMALINK_MAX_LEDS; i++) - InitializeLed(LedId.Custom1 + i, new Rectangle(i * 11, 0, 10, 10)); + for (int i = 0; i < _Defines.CHROMALINK_MAX_LEDS; i++) + AddLed(LedId.Custom1 + i, new Point(i * 11, 0), new Size(10, 10)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Custom1; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Custom1; /// protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerChromaLinkUpdateQueue(updateTrigger, DeviceInfo.DeviceId); diff --git a/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs index 4336bfb..8281158 100644 --- a/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs @@ -29,10 +29,7 @@ namespace RGB.NET.Devices.Razer public string Model { get; } /// - public Uri Image { get; set; } - - /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; + public object? LayoutMetadata { get; set; } #endregion diff --git a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs index 25fbfd4..27ebbb0 100644 --- a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs @@ -30,16 +30,12 @@ namespace RGB.NET.Devices.Razer /// protected override void InitializeLayout() { - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Razer\Headset", $"{model}.xml"), null); - - if (LedMapping.Count == 0) - for (int i = 0; i < _Defines.HEADSET_MAX_LEDS; i++) - InitializeLed(LedId.Headset1 + i, new Rectangle(i * 11, 0, 10, 10)); + for (int i = 0; i < _Defines.HEADSET_MAX_LEDS; i++) + AddLed(LedId.Headset1 + i, new Point(i * 11, 0), new Size(10, 10)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Headset1; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Headset1; /// protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerHeadsetUpdateQueue(updateTrigger, DeviceInfo.DeviceId); diff --git a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs index 8c6aab6..2ca30a0 100644 --- a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs @@ -30,22 +30,13 @@ namespace RGB.NET.Devices.Razer /// protected override void InitializeLayout() { - //string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - //ApplyLayoutFromFile(PathHelper.GetAbsolutePath( - // $@"Layouts\Razer\Keyboards\{model}\{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), - // DeviceInfo.LogicalLayout.ToString(), PathHelper.GetAbsolutePath(@"Images\Razer\Keyboards")); - - //TODO DarthAffe 13.12.2017: Correctly select ids - if (LedMapping.Count == 0) - { - for (int i = 0; i < _Defines.KEYBOARD_MAX_ROW; i++) - for (int j = 0; j < _Defines.KEYBOARD_MAX_COLUMN; j++) - InitializeLed(LedId.Keyboard_Escape + ((i * _Defines.KEYBOARD_MAX_COLUMN) + j), new Rectangle(j * 20, i * 20, 19, 19)); - } + for (int i = 0; i < _Defines.KEYBOARD_MAX_ROW; i++) + for (int j = 0; j < _Defines.KEYBOARD_MAX_COLUMN; j++) + AddLed(LedId.Keyboard_Escape + ((i * _Defines.KEYBOARD_MAX_COLUMN) + j), new Point(j * 20, i * 20), new Size(19, 19)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape; /// protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerKeyboardUpdateQueue(updateTrigger, DeviceInfo.DeviceId); diff --git a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs index be86e2d..2fac949 100644 --- a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs @@ -30,19 +30,13 @@ namespace RGB.NET.Devices.Razer /// protected override void InitializeLayout() { - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Razer\Keypad", $"{model}.xml"), null); - - if (LedMapping.Count == 0) - { - for (int i = 0; i < _Defines.KEYPAD_MAX_ROW; i++) - for (int j = 0; j < _Defines.KEYPAD_MAX_COLUMN; j++) - InitializeLed(LedId.Keypad1 + ((i * _Defines.KEYPAD_MAX_COLUMN) + j), new Rectangle(j * 20, i * 20, 19, 19)); - } + for (int i = 0; i < _Defines.KEYPAD_MAX_ROW; i++) + for (int j = 0; j < _Defines.KEYPAD_MAX_COLUMN; j++) + AddLed(LedId.Keypad1 + ((i * _Defines.KEYPAD_MAX_COLUMN) + j), new Point(j * 20, i * 20), new Size(19, 19)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keypad1; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keypad1; /// protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerKeypadUpdateQueue(updateTrigger, DeviceInfo.DeviceId); diff --git a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs index 6562467..983d90f 100644 --- a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs @@ -30,19 +30,13 @@ namespace RGB.NET.Devices.Razer /// protected override void InitializeLayout() { - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Razer\Mice", $"{model}.xml"), null); - - if (LedMapping.Count == 0) - { - for (int i = 0; i < _Defines.MOUSE_MAX_ROW; i++) - for (int j = 0; j < _Defines.MOUSE_MAX_COLUMN; j++) - InitializeLed(LedId.Mouse1 + ((i * _Defines.MOUSE_MAX_COLUMN) + j), new Rectangle(j * 11, i * 11, 10, 10)); - } + for (int i = 0; i < _Defines.MOUSE_MAX_ROW; i++) + for (int j = 0; j < _Defines.MOUSE_MAX_COLUMN; j++) + AddLed(LedId.Mouse1 + ((i * _Defines.MOUSE_MAX_COLUMN) + j), new Point(j * 11, i * 11), new Size(10, 10)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1; /// protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerMouseUpdateQueue(updateTrigger, DeviceInfo.DeviceId); diff --git a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs index d9c4d81..285e211 100644 --- a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs @@ -30,16 +30,12 @@ namespace RGB.NET.Devices.Razer /// protected override void InitializeLayout() { - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\Razer\Mousepad", $"{model}.xml"), null); - - if (LedMapping.Count == 0) - for (int i = 0; i < _Defines.MOUSEPAD_MAX_LEDS; i++) - InitializeLed(LedId.Mousepad1 + i, new Rectangle(i * 11, 0, 10, 10)); + for (int i = 0; i < _Defines.MOUSEPAD_MAX_LEDS; i++) + AddLed(LedId.Mousepad1 + i, new Point(i * 11, 0), new Size(10, 10)); } /// - protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mousepad1; + protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mousepad1; /// protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerMousepadUpdateQueue(updateTrigger, DeviceInfo.DeviceId); diff --git a/RGB.NET.Devices.Razer/RazerDeviceProviderLoader.cs b/RGB.NET.Devices.Razer/RazerDeviceProviderLoader.cs deleted file mode 100644 index 2f3d306..0000000 --- a/RGB.NET.Devices.Razer/RazerDeviceProviderLoader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.Razer -{ - /// - /// Represents a device provider loaded used to dynamically load razer devices into an application. - /// - public class RazerDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => false; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => RazerDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs index ec59fd3..4d04d9e 100644 --- a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs +++ b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDevice.cs @@ -53,36 +53,23 @@ namespace RGB.NET.Devices.SteelSeries int counter = 0; foreach (KeyValuePair mapping in ledMapping) - InitializeLed(mapping.Key, new Rectangle((counter++) * 10, 0, 10, 10)); - - InitializeLayout(); + AddLed(mapping.Key, new Point((counter++) * 10, 0), new Size(10, 10)); if (Size == Size.Invalid) { - Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle)); + Rectangle ledRectangle = new(this.Select(x => x.LedRectangle)); Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y); } UpdateQueue = updateQueue; } - protected override object CreateLedCustomData(LedId ledId) => _ledMapping[ledId]; + /// + protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId]; /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0)); - /// - /// Initializes the and of the device. - /// - protected virtual void InitializeLayout() - { - if (!(DeviceInfo is SteelSeriesRGBDeviceInfo info)) return; - - string layout = info.ImageLayout; - string layoutPath = info.LayoutPath; - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, @"Layouts\SteelSeries", $"{layoutPath}.xml"), layout, true); - } - /// public override void Dispose() { diff --git a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDeviceInfo.cs b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDeviceInfo.cs index cb356c7..0c30675 100644 --- a/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDeviceInfo.cs +++ b/RGB.NET.Devices.SteelSeries/Generic/SteelSeriesRGBDeviceInfo.cs @@ -24,11 +24,8 @@ namespace RGB.NET.Devices.SteelSeries public string Model { get; } /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } - /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; - public SteelSeriesDeviceType SteelSeriesDeviceType { get; } /// diff --git a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProviderLoader.cs b/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProviderLoader.cs deleted file mode 100644 index ffe1938..0000000 --- a/RGB.NET.Devices.SteelSeries/SteelSeriesDeviceProviderLoader.cs +++ /dev/null @@ -1,25 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.SteelSeries -{ - /// - /// Represents a device provider loaded used to dynamically load steelseries devices into an application. - /// - // ReSharper disable once UnusedMember.Global - public class SteelSeriesDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => false; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => SteelSeriesDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs index c940db4..bce6c8f 100644 --- a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs +++ b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDevice.cs @@ -53,19 +53,17 @@ namespace RGB.NET.Devices.WS281X.Arduino internal void Initialize(int ledCount) { for (int i = 0; i < ledCount; i++) - InitializeLed(LedId.LedStripe1 + i, new Rectangle(i * 10, 0, 10, 10)); - - //TODO DarthAffe 23.12.2018: Allow to load a layout. + AddLed(LedId.LedStripe1 + i, new Point(i * 10, 0), new Size(10, 10)); if (Size == Size.Invalid) { - Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle)); + Rectangle ledRectangle = new(this.Select(x => x.LedRectangle)); Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y); } } /// - protected override object CreateLedCustomData(LedId ledId) => (Channel, (int)ledId - (int)LedId.LedStripe1); + protected override object GetLedCustomData(LedId ledId) => (Channel, (int)ledId - (int)LedId.LedStripe1); /// protected override IEnumerable GetLedsToUpdate(bool flushLeds) => (flushLeds || LedMapping.Values.Any(x => x.IsDirty)) ? LedMapping.Values : null; diff --git a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDeviceInfo.cs b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDeviceInfo.cs index 9fbb965..29abe19 100644 --- a/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDeviceInfo.cs +++ b/RGB.NET.Devices.WS281X/Arduino/ArduinoWS2812USBDeviceInfo.cs @@ -25,10 +25,7 @@ namespace RGB.NET.Devices.WS281X.Arduino public string Model => "WS2812 USB"; /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; - - /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } #endregion diff --git a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs index 51f6d56..a3a12e9 100644 --- a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs +++ b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDevice.cs @@ -50,9 +50,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard internal void Initialize(int ledCount) { for (int i = 0; i < ledCount; i++) - InitializeLed(LedId.LedStripe1 + i, new Rectangle(i * 10, 0, 10, 10)); - - //TODO DarthAffe 23.12.2018: Allow to load a layout. + AddLed(LedId.LedStripe1 + i, new Point(i * 10, 0), new Size(10, 10)); if (Size == Size.Invalid) { @@ -62,7 +60,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard } /// - protected override object CreateLedCustomData(LedId ledId) => _ledOffset + ((int)ledId - (int)LedId.LedStripe1); + protected override object GetLedCustomData(LedId ledId) => _ledOffset + ((int)ledId - (int)LedId.LedStripe1); /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0)); diff --git a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDeviceInfo.cs b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDeviceInfo.cs index 311b0d4..b1a7de8 100644 --- a/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDeviceInfo.cs +++ b/RGB.NET.Devices.WS281X/Bitwizard/BitwizardWS2812USBDeviceInfo.cs @@ -25,10 +25,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard public string Model => "WS2812 USB"; /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; - - /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } #endregion diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs index 4b03b81..907dbaf 100644 --- a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs +++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDevice.cs @@ -53,9 +53,7 @@ namespace RGB.NET.Devices.WS281X.NodeMCU internal void Initialize(int ledCount) { for (int i = 0; i < ledCount; i++) - InitializeLed(LedId.LedStripe1 + i, new Point(i * 10, 0), new Size(10, 10)); - - //TODO DarthAffe 23.12.2018: Allow to load a layout. + AddLed(LedId.LedStripe1 + i, new Point(i * 10, 0), new Size(10, 10)); if (Size == Size.Invalid) { @@ -65,7 +63,7 @@ namespace RGB.NET.Devices.WS281X.NodeMCU } /// - protected override object CreateLedCustomData(LedId ledId) => (Channel, (int)ledId - (int)LedId.LedStripe1); + protected override object GetLedCustomData(LedId ledId) => (Channel, (int)ledId - (int)LedId.LedStripe1); /// protected override IEnumerable GetLedsToUpdate(bool flushLeds) => (flushLeds || LedMapping.Values.Any(x => x.IsDirty)) ? LedMapping.Values : null; diff --git a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs index 935dcf9..e67d733 100644 --- a/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs +++ b/RGB.NET.Devices.WS281X/NodeMCU/NodeMCUWS2812USBDeviceInfo.cs @@ -25,10 +25,7 @@ namespace RGB.NET.Devices.WS281X.NodeMCU public string Model => "WS2812 WLAN"; /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; - - /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } #endregion diff --git a/RGB.NET.Devices.WS281X/WS281XDeviceProviderLoader.cs b/RGB.NET.Devices.WS281X/WS281XDeviceProviderLoader.cs deleted file mode 100644 index 10781a9..0000000 --- a/RGB.NET.Devices.WS281X/WS281XDeviceProviderLoader.cs +++ /dev/null @@ -1,27 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.WS281X -{ - /// - /// - /// Represents a device provider loaded used to dynamically load WS281X devices into an application. - /// - // ReSharper disable once UnusedMember.Global - // ReSharper disable once InconsistentNaming - public class WS281XDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => true; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => WS281XDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.Devices.Wooting/Generic/WootingRGBDeviceInfo.cs b/RGB.NET.Devices.Wooting/Generic/WootingRGBDeviceInfo.cs index 750daca..4925883 100644 --- a/RGB.NET.Devices.Wooting/Generic/WootingRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Wooting/Generic/WootingRGBDeviceInfo.cs @@ -26,11 +26,8 @@ namespace RGB.NET.Devices.Wooting.Generic public string Model { get; } /// - public Uri Image { get; set; } + public object? LayoutMetadata { get; set; } - /// - public RGBDeviceLighting Lighting => RGBDeviceLighting.Key; - /// /// Gets the of the . /// diff --git a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs index 3ccc35a..e390a28 100644 --- a/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Wooting/Keyboard/WootingKeyboardRGBDevice.cs @@ -29,25 +29,18 @@ namespace RGB.NET.Devices.Wooting.Keyboard /// protected override void InitializeLayout() { - Dictionary mapping = WootingKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout]; foreach (KeyValuePair led in mapping) - { - InitializeLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19,19)); - } - - string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); - ApplyLayoutFromFile(PathHelper.GetAbsolutePath(this, $@"Layouts\Wooting\Keyboards\{model}", $"{DeviceInfo.PhysicalLayout.ToString().ToUpper()}.xml"), - DeviceInfo.LogicalLayout.ToString()); + AddLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19, 19)); } + /// + protected override object GetLedCustomData(LedId ledId) => WootingKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout][ledId]; + /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(ledsToUpdate.Where(x => x.Color.A > 0)); - /// - protected override object CreateLedCustomData(LedId ledId) => WootingKeyboardLedMappings.Mapping[DeviceInfo.DeviceIndex][DeviceInfo.PhysicalLayout][ledId]; - #endregion } } diff --git a/RGB.NET.Devices.Wooting/WootingDeviceProviderLoader.cs b/RGB.NET.Devices.Wooting/WootingDeviceProviderLoader.cs deleted file mode 100644 index 5daf314..0000000 --- a/RGB.NET.Devices.Wooting/WootingDeviceProviderLoader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using RGB.NET.Core; - -namespace RGB.NET.Devices.Wooting -{ - /// - /// Represents a device provider loaded used to dynamically load Wooting devices into an application. - /// - public class WootingDeviceProviderLoader : IRGBDeviceProviderLoader - { - #region Properties & Fields - - /// - public bool RequiresInitialization => false; - - #endregion - - #region Methods - - /// - public IRGBDeviceProvider GetDeviceProvider() => WootingDeviceProvider.Instance; - - #endregion - } -} diff --git a/RGB.NET.sln b/RGB.NET.sln index 39745c5..7a1fb70 100644 --- a/RGB.NET.sln +++ b/RGB.NET.sln @@ -25,8 +25,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Novation", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Razer", "RGB.NET.Devices.Razer\RGB.NET.Devices.Razer.csproj", "{2E162CB7-2C6C-4069-8356-06162F7BE0AA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Roccat", "RGB.NET.Devices.Roccat\RGB.NET.Devices.Roccat.csproj", "{9DF256B9-1AB7-4D5B-B2E5-94AF6691DC9E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Brushes", "RGB.NET.Brushes\RGB.NET.Brushes.csproj", "{B159FB51-5939-490E-A1BA-FB55D4D7ADDF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Decorators", "RGB.NET.Decorators\RGB.NET.Decorators.csproj", "{8725C448-818C-41F7-B23F-F97E062BF233}" @@ -45,7 +43,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Asus", "RGB EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Wooting", "RGB.NET.Devices.Wooting\RGB.NET.Devices.Wooting.csproj", "{DD46DB2D-85BE-4962-86AE-E38C9053A548}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Layout", "RGB.NET.Layout\RGB.NET.Layout.csproj", "{8AAB3736-B443-402C-B8AC-63D1A6DAFCCB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Layout", "RGB.NET.Layout\RGB.NET.Layout.csproj", "{8AAB3736-B443-402C-B8AC-63D1A6DAFCCB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -89,10 +87,6 @@ Global {2E162CB7-2C6C-4069-8356-06162F7BE0AA}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E162CB7-2C6C-4069-8356-06162F7BE0AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E162CB7-2C6C-4069-8356-06162F7BE0AA}.Release|Any CPU.Build.0 = Release|Any CPU - {9DF256B9-1AB7-4D5B-B2E5-94AF6691DC9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9DF256B9-1AB7-4D5B-B2E5-94AF6691DC9E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9DF256B9-1AB7-4D5B-B2E5-94AF6691DC9E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9DF256B9-1AB7-4D5B-B2E5-94AF6691DC9E}.Release|Any CPU.Build.0 = Release|Any CPU {B159FB51-5939-490E-A1BA-FB55D4D7ADDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B159FB51-5939-490E-A1BA-FB55D4D7ADDF}.Debug|Any CPU.Build.0 = Debug|Any CPU {B159FB51-5939-490E-A1BA-FB55D4D7ADDF}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -142,7 +136,6 @@ Global {00BA7E8E-822A-42DA-9EB4-DDBBC7CB0E46} = {D13032C6-432E-4F43-8A32-071133C22B16} {19F701FD-5577-4873-9BE6-6775676FA185} = {D13032C6-432E-4F43-8A32-071133C22B16} {2E162CB7-2C6C-4069-8356-06162F7BE0AA} = {D13032C6-432E-4F43-8A32-071133C22B16} - {9DF256B9-1AB7-4D5B-B2E5-94AF6691DC9E} = {D13032C6-432E-4F43-8A32-071133C22B16} {B159FB51-5939-490E-A1BA-FB55D4D7ADDF} = {EBC33090-8494-4DF4-B4B6-64D0E531E93F} {8725C448-818C-41F7-B23F-F97E062BF233} = {EBC33090-8494-4DF4-B4B6-64D0E531E93F} {6FEBDC9E-909D-4EE2-B003-EDFBEF5FFF40} = {EBC33090-8494-4DF4-B4B6-64D0E531E93F}