From ebfb82e323085db209bf66d8e96e06d99ffac654 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 26 Apr 2021 17:12:23 +0200 Subject: [PATCH 1/3] RGB Service - Catch & throw exceptions in a more controlled manner --- src/Artemis.Core/Services/RgbService.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Artemis.Core/Services/RgbService.cs b/src/Artemis.Core/Services/RgbService.cs index 26c66ed54..50f2d05b8 100644 --- a/src/Artemis.Core/Services/RgbService.cs +++ b/src/Artemis.Core/Services/RgbService.cs @@ -148,8 +148,17 @@ namespace Artemis.Core.Services foreach (ArtemisDevice device in toRemove) RemoveDevice(device); - deviceProvider.Initialize(RGBDeviceType.All, true); + List providerExceptions = new(); + void DeviceProviderOnException(object? sender, Exception e) => providerExceptions.Add(e); + + 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()) { From 575cfa9a37867a85e8c175ac3d5aee364c7d5ed3 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 26 Apr 2021 17:13:19 +0200 Subject: [PATCH 2/3] Update README.md Update README.md Update README.md [skip ci] --- README.md | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index c66d69d0c..9a8868c6e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ - - # Artemis [![Build Status](https://dev.azure.com/artemis-rgb/Artemis/_apis/build/status/Artemis%20Development%20build?repoName=Artemis-RGB%2FArtemis&branchName=master)](https://dev.azure.com/artemis-rgb/Artemis/_build/latest?definitionId=1&repoName=Artemis-RGB%2FArtemis&branchName=master) [![GitHub release](https://img.shields.io/github/release/spoinkynl/Artemis.svg)](https://github.com/SpoinkyNL/Artemis/releases) @@ -29,7 +27,7 @@ A full list of supported devices can be found on the wiki [here](https://wiki.ar 8. Restore Nuget packages ##### Alternatively in PowerShell -```powershell +``` git clone https://github.com/DarthAffe/RGB.NET -b Development RGB.NET git clone https://github.com/Artemis-RGB/Artemis Artemis git clone https://github.com/Artemis-RGB/Artemis.Plugins Artemis.Plugins @@ -58,26 +56,13 @@ A few people have already started working on plugins! If you want your plugins t ## Work in progress screenshots **Note:** Video tutorials and written guides on many of the features displayed below are planned for when Artemis 2 nears feature-completion. -![Plugins](https://i.imgur.com/x8LGJxp.png) -_Artemis 2 has been build from the ground up with modularity in mind. This means almost everything can be extended using plugins. New devices, effects, games and almost everything else can be added through plugins._ - -![Surface editor](https://i.imgur.com/uA8JLL5.png) +![Surface editor](https://wiki.artemis-rgb.com/screenshots/surface-editor.png) _The surface editor allows you to recreate your desktop in 2D space, this provides Artemis with spatial awareness and ensures effects scale properly over your different devices. Right clicking a device lets you change its properties such as rotation and scale._ -![Profile editor](https://i.imgur.com/PydFspu.png) -_Here is an overview of the profile editor. While it may be overwhelming at first it is very simple to get some basic effects set up. When you're ready, the profile editor will allow you to create almost anything you can think of._ - -![LED selection](https://i.imgur.com/7DM0c1x.png) -_Layers are created by making a selection of LEDs, this allows you to precisely dictate where a layer may render._ - -![Shapes](https://i.imgur.com/NRzc5B1.png) -_Inside the layer you can freely manipulate the shape that is being rendered. By default it always fills the entire layer as seen in the previous screenshot, but it can shrink and even be a circle, revealing the rainbow background behind._ - ![Keyframes](http://artemis-rgb.com/github/sSEvdAXeTQ.gif) _With the keyframe engine you can animate almost any property of the layer. In the example above the position and scale of the shape have been animated using keyframes._ -![Conditions](https://i.imgur.com/ERHRFQj.png) -_Using visual programming you can create conditions to dictate when a layer may show. The data available to these conditions is provided by plugins, allowing easy expansion._ +For more screenshots check out the wiki: https://wiki.artemis-rgb.com/en/screenshots ### Special thanks Over the years several companies have supported Artemis by providing both hardware and software, thank you! From 52d0efb90e8ef3690a25b57e53a22ad0cba1d649 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 26 Apr 2021 23:13:11 +0200 Subject: [PATCH 3/3] RGB Service - Update for RGB.NET exception changes --- src/Artemis.Core/Services/RgbService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Artemis.Core/Services/RgbService.cs b/src/Artemis.Core/Services/RgbService.cs index 50f2d05b8..b794930af 100644 --- a/src/Artemis.Core/Services/RgbService.cs +++ b/src/Artemis.Core/Services/RgbService.cs @@ -149,7 +149,13 @@ namespace Artemis.Core.Services RemoveDevice(device); List providerExceptions = new(); - void DeviceProviderOnException(object? sender, Exception e) => providerExceptions.Add(e); + 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();