Update service - Removed option to install updates without asking

Modules - Decrease CPU usage for activation requirements check by using a centralized service
Devices - Reload provider when unloading a layout
This commit is contained in:
Robert committed 2021-06-10 17:41:54 +02:00
1 parent 38c04913e2
commit fe933f60e8
17 files changed
+195 -135

No files matched your search

+2 -2
View File
@@ -22,7 +22,7 @@ namespace Artemis.Core.Services
/// </summary>
internal class CoreService : ICoreService
{
internal static IKernel Kernel = null!;
internal static IKernel? Kernel;
private readonly Stopwatch _frameStopWatch;
private readonly ILogger _logger;
@@ -201,7 +201,7 @@ namespace Artemis.Core.Services
Version? hidSharpVersion = Assembly.GetAssembly(typeof(HidDevice))!.GetName().Version;
_logger.Debug("Forcing plugins to use HidSharp {hidSharpVersion}", hidSharpVersion);
DeserializationLogger.Initialize(Kernel);
DeserializationLogger.Initialize(Kernel!);
// Initialize the services
_pluginManagementService.CopyBuiltInPlugins();
+20 -3
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading;
using Artemis.Core.DeviceProviders;
using Artemis.Core.Services.Models;
using Artemis.Core.SkiaSharp;
@@ -345,6 +346,13 @@ namespace Artemis.Core.Services
return layout;
}
if (device.DisableDefaultLayout)
{
layout = null;
ApplyDeviceLayout(device, layout);
return null;
}
// Look for a layout provided by the plugin
layout = device.DeviceProvider.LoadLayout(device);
if (layout.IsValid)
@@ -354,8 +362,7 @@ namespace Artemis.Core.Services
}
// Finally fall back to a default layout
if (!device.DisableDefaultLayout)
layout = ArtemisLayout.GetDefaultLayout(device);
layout = ArtemisLayout.GetDefaultLayout(device);
ApplyDeviceLayout(device, layout);
return layout;
}
@@ -365,7 +372,7 @@ namespace Artemis.Core.Services
if (layout == null)
{
if (device.Layout != null)
device.ClearLayout();
ReloadDevice(device);
return;
}
@@ -377,6 +384,16 @@ namespace Artemis.Core.Services
UpdateLedGroup();
}
private void ReloadDevice(ArtemisDevice device)
{
DeviceProvider deviceProvider = device.DeviceProvider;
// Feels bad but need to in order to get the initial LEDs back
_pluginManagementService.DisablePluginFeature(deviceProvider, false);
Thread.Sleep(500);
_pluginManagementService.EnablePluginFeature(deviceProvider, false);
}
public ArtemisDevice? GetDevice(IRGBDevice rgbDevice)
{
return _devices.FirstOrDefault(d => d.RgbDevice == rgbDevice);