mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Plugins - Remove related device settings when clearing plugin settings
This commit is contained in:
parent
26d8322b15
commit
daac4e44ee
@ -457,6 +457,7 @@ namespace Artemis.Core
|
||||
{
|
||||
// Other properties are computed
|
||||
DeviceEntity.Id = Identifier;
|
||||
DeviceEntity.DeviceProvider = DeviceProvider.Plugin.Guid.ToString();
|
||||
|
||||
DeviceEntity.InputIdentifiers.Clear();
|
||||
foreach (ArtemisDeviceInputIdentifier identifier in InputIdentifiers)
|
||||
|
||||
@ -10,6 +10,7 @@ using Artemis.Core.DeviceProviders;
|
||||
using Artemis.Core.Ninject;
|
||||
using Artemis.Storage.Entities.General;
|
||||
using Artemis.Storage.Entities.Plugins;
|
||||
using Artemis.Storage.Entities.Surface;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using McMaster.NETCore.Plugins;
|
||||
using Ninject;
|
||||
@ -28,15 +29,17 @@ namespace Artemis.Core.Services
|
||||
private readonly IKernel _kernel;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPluginRepository _pluginRepository;
|
||||
private readonly IDeviceRepository _deviceRepository;
|
||||
private readonly IQueuedActionRepository _queuedActionRepository;
|
||||
private readonly List<Plugin> _plugins;
|
||||
private bool _isElevated;
|
||||
|
||||
public PluginManagementService(IKernel kernel, ILogger logger, IPluginRepository pluginRepository, IQueuedActionRepository queuedActionRepository)
|
||||
public PluginManagementService(IKernel kernel, ILogger logger, IPluginRepository pluginRepository, IDeviceRepository deviceRepository, IQueuedActionRepository queuedActionRepository)
|
||||
{
|
||||
_kernel = kernel;
|
||||
_logger = logger;
|
||||
_pluginRepository = pluginRepository;
|
||||
_deviceRepository = deviceRepository;
|
||||
_queuedActionRepository = queuedActionRepository;
|
||||
_plugins = new List<Plugin>();
|
||||
|
||||
@ -572,7 +575,11 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
if (plugin.IsEnabled)
|
||||
throw new ArtemisCoreException("Cannot remove the settings of an enabled plugin");
|
||||
|
||||
_pluginRepository.RemoveSettings(plugin.Guid);
|
||||
foreach (DeviceEntity deviceEntity in _deviceRepository.GetAll().Where(e => e.DeviceProvider == plugin.Guid.ToString()))
|
||||
_deviceRepository.Remove(deviceEntity);
|
||||
|
||||
plugin.Settings?.ClearSettings();
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ namespace Artemis.Storage.Entities.Surface
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string DeviceProvider { get; set; }
|
||||
public float X { get; set; }
|
||||
public float Y { get; set; }
|
||||
public float Rotation { get; set; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user