mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Merge branch 'development' into prerequisites
This commit is contained in:
commit
f1874d9fe3
2 files changed
+19
-19
No files matched your search
@@ -148,8 +148,23 @@ namespace Artemis.Core.Services
|
||||
foreach (ArtemisDevice device in toRemove)
|
||||
RemoveDevice(device);
|
||||
|
||||
deviceProvider.Initialize(RGBDeviceType.All, true);
|
||||
List<Exception> providerExceptions = new();
|
||||
void DeviceProviderOnException(object? sender, ExceptionEventArgs e)
|
||||
{
|
||||
if (e.IsCritical)
|
||||
providerExceptions.Add(e.Exception);
|
||||
else
|
||||
_logger.Warning(e.Exception, "Device provider {deviceProvider} threw non-critical exception", deviceProvider.GetType().Name);
|
||||
}
|
||||
|
||||
deviceProvider.Exception += DeviceProviderOnException;
|
||||
deviceProvider.Initialize();
|
||||
Surface.Attach(deviceProvider.Devices);
|
||||
deviceProvider.Exception -= DeviceProviderOnException;
|
||||
if (providerExceptions.Count == 1)
|
||||
throw new ArtemisPluginException("RGB.NET threw exception: " + providerExceptions.First().Message, providerExceptions.First());
|
||||
if (providerExceptions.Count > 1)
|
||||
throw new ArtemisPluginException("RGB.NET threw multiple exceptions", new AggregateException(providerExceptions));
|
||||
|
||||
if (!deviceProvider.Devices.Any())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user