mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
UI - Added device layout path to device debugger, this closes #494
This commit is contained in:
1 parent
286f475c7b
commit
c5e3750172
6 files changed
+263
-191
No files matched your search
@@ -23,16 +23,17 @@ namespace Artemis.Core
|
||||
RgbDevice = rgbDevice;
|
||||
DeviceProvider = deviceProvider;
|
||||
Surface = surface;
|
||||
DeviceEntity = new DeviceEntity();
|
||||
|
||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
||||
|
||||
_leds = rgbDevice.Select(l => new ArtemisLed(l, this)).ToList().AsReadOnly();
|
||||
|
||||
Rotation = 0;
|
||||
Scale = 1;
|
||||
ZIndex = 1;
|
||||
DeviceEntity = new DeviceEntity();
|
||||
|
||||
deviceProvider.DeviceLayoutPaths.TryGetValue(rgbDevice, out string? layoutPath);
|
||||
LayoutPath = layoutPath;
|
||||
|
||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
||||
|
||||
_leds = rgbDevice.Select(l => new ArtemisLed(l, this)).ToList().AsReadOnly();
|
||||
ApplyToEntity();
|
||||
CalculateRenderProperties();
|
||||
}
|
||||
@@ -44,6 +45,9 @@ namespace Artemis.Core
|
||||
Surface = surface;
|
||||
DeviceEntity = deviceEntity;
|
||||
|
||||
deviceProvider.DeviceLayoutPaths.TryGetValue(rgbDevice, out string? layoutPath);
|
||||
LayoutPath = layoutPath;
|
||||
|
||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
||||
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers)
|
||||
InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(identifierEntity.InputProvider, identifierEntity.Identifier));
|
||||
@@ -94,7 +98,7 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of input identifiers associated with this device
|
||||
/// Gets a list of input identifiers associated with this device
|
||||
/// </summary>
|
||||
public List<ArtemisDeviceInputIdentifier> InputIdentifiers { get; }
|
||||
|
||||
@@ -163,6 +167,11 @@ namespace Artemis.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to where the layout of the device was (attempted to be) loaded from
|
||||
/// </summary>
|
||||
public string? LayoutPath { get; internal set; }
|
||||
|
||||
internal DeviceEntity DeviceEntity { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -191,13 +200,11 @@ namespace Artemis.Core
|
||||
|
||||
DeviceEntity.InputIdentifiers.Clear();
|
||||
foreach (ArtemisDeviceInputIdentifier identifier in InputIdentifiers)
|
||||
{
|
||||
DeviceEntity.InputIdentifiers.Add(new DeviceInputIdentifierEntity
|
||||
{
|
||||
InputProvider = identifier.InputProvider,
|
||||
Identifier = identifier.Identifier
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
internal void ApplyToRgbDevice()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Ninject;
|
||||
using RGB.NET.Core;
|
||||
@@ -33,6 +34,8 @@ namespace Artemis.Core.DeviceProviders
|
||||
[Inject]
|
||||
public ILogger? Logger { get; set; }
|
||||
|
||||
internal Dictionary<IRGBDevice, string> DeviceLayoutPaths { get; set; } = new Dictionary<IRGBDevice, string>();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Disable()
|
||||
{
|
||||
@@ -54,12 +57,16 @@ namespace Artemis.Core.DeviceProviders
|
||||
else if (e.RelativePath != null)
|
||||
e.FinalPath = Path.Combine(Plugin.Directory.FullName, e.RelativePath);
|
||||
|
||||
IRGBDeviceInfo deviceInfo = ((IRGBDevice) sender).DeviceInfo;
|
||||
IRGBDevice device = (IRGBDevice) sender;
|
||||
IRGBDeviceInfo deviceInfo = device.DeviceInfo;
|
||||
if (e.FileName != null && !File.Exists(e.FinalPath))
|
||||
{
|
||||
Logger?.Information("Couldn't find a layout for device {deviceName}, model {deviceModel} at {filePath}",
|
||||
deviceInfo.DeviceName, deviceInfo.Model, e.FinalPath);
|
||||
}
|
||||
|
||||
if (e.FileName != null)
|
||||
DeviceLayoutPaths[device] = e.FinalPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,8 @@ namespace Artemis.Core.Services
|
||||
throw new ArtemisPluginException(
|
||||
plugin,
|
||||
"Failed to initialize the plugin assembly",
|
||||
new AggregateException(e.LoaderExceptions.Where(le => le != null).ToArray())
|
||||
// ReSharper disable once RedundantEnumerableCastCall - Casting from nullable to non-nullable here
|
||||
new AggregateException(e.LoaderExceptions.Where(le => le != null).Cast<Exception>().ToArray())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user