mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Plugins - Simplified and streamlined the way plugins provide VMs
Plugins - Added dependency injection to all plugin VMs Plugin settings - Allow injecting plugin settings into any class defined in the plugin assembly
This commit is contained in:
1 parent
a06ad8f011
commit
625fcbafdd
29 files changed
+349
-165
No files matched your search
@@ -13,21 +13,38 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
/// </summary>
|
||||
public abstract class DeviceProvider : Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="DeviceProvider" /> class
|
||||
/// </summary>
|
||||
/// <param name="rgbDeviceProvider"></param>
|
||||
protected DeviceProvider(IRGBDeviceProvider rgbDeviceProvider)
|
||||
{
|
||||
RgbDeviceProvider = rgbDeviceProvider ?? throw new ArgumentNullException(nameof(rgbDeviceProvider));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The RGB.NET device provider backing this Artemis device provider
|
||||
/// </summary>
|
||||
public IRGBDeviceProvider RgbDeviceProvider { get; }
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Make internal while still injecting.
|
||||
/// A logger used by the device provider internally, ignore this
|
||||
/// </summary>
|
||||
[Inject]
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
// Does not happen with device providers, they require Artemis to restart
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ResolveAbsolutePath(Type type, object sender, ResolvePathEventArgs e)
|
||||
{
|
||||
if (sender.GetType() == type || sender.GetType().IsGenericType(type))
|
||||
|
||||
@@ -7,14 +7,16 @@ using Artemis.Core.Plugins.LayerBrush.Abstract;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to create one or more <see cref="LayerBrush" />s usable by profile layers.
|
||||
/// Allows you to create one or more <see cref="LayerBrush{T}" />s usable by profile layers.
|
||||
/// </summary>
|
||||
public abstract class LayerBrushProvider : Plugin
|
||||
{
|
||||
private readonly List<LayerBrushDescriptor> _layerBrushDescriptors;
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to register one or more <see cref="LayerBrush{T}" />s usable by profile layers.
|
||||
/// </summary>
|
||||
protected LayerBrushProvider()
|
||||
{
|
||||
_layerBrushDescriptors = new List<LayerBrushDescriptor>();
|
||||
|
||||
@@ -7,14 +7,16 @@ using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to create one or more <see cref="LayerEffect" />s usable by profile layers.
|
||||
/// Allows you to register one or more <see cref="LayerEffect{T}" />s usable by profile layers.
|
||||
/// </summary>
|
||||
public abstract class LayerEffectProvider : Plugin
|
||||
{
|
||||
private readonly List<LayerEffectDescriptor> _layerEffectDescriptors;
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to register one or more <see cref="LayerEffect{T}" />s usable by profile layers.
|
||||
/// </summary>
|
||||
protected LayerEffectProvider()
|
||||
{
|
||||
_layerEffectDescriptors = new List<LayerEffectDescriptor>();
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
using Artemis.Core.Plugins.Modules;
|
||||
using Artemis.Storage.Entities.Module;
|
||||
using SkiaSharp;
|
||||
@@ -104,20 +103,25 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
public ModulePriorityCategory DefaultPriorityCategory { get; set; } = ModulePriorityCategory.Normal;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current priority category of this module
|
||||
/// Gets the current priority category of this module
|
||||
/// </summary>
|
||||
public ModulePriorityCategory PriorityCategory { get; set; }
|
||||
public ModulePriorityCategory PriorityCategory { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current priority of this module within its priority category
|
||||
/// Gets the current priority of this module within its priority category
|
||||
/// </summary>
|
||||
public int Priority { get; set; }
|
||||
public int Priority { get; internal set; }
|
||||
|
||||
internal DataModel InternalDataModel { get; set; }
|
||||
|
||||
internal bool InternalExpandsMainDataModel { get; set; }
|
||||
internal ModuleSettingsEntity Entity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of custom module tabs that show in the UI
|
||||
/// </summary>
|
||||
public IEnumerable<ModuleTab> ModuleTabs { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Called each frame when the module must update
|
||||
/// </summary>
|
||||
@@ -133,12 +137,6 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
/// <param name="canvasInfo"></param>
|
||||
public abstract void Render(double deltaTime, ArtemisSurface surface, SKCanvas canvas, SKImageInfo canvasInfo);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the module's view model is being show, return a list of module tabs here if you want them to show up in the UI
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract IEnumerable<ModuleTab> GetModuleTabs();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the <see cref="ActivationRequirements" /> are met
|
||||
/// </summary>
|
||||
@@ -194,6 +192,9 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes in what way the activation requirements of a module must be met
|
||||
/// </summary>
|
||||
public enum ActivationRequirementType
|
||||
{
|
||||
/// <summary>
|
||||
@@ -207,6 +208,9 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
All
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes the priority category of a module
|
||||
/// </summary>
|
||||
public enum ModulePriorityCategory
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
using Artemis.Core.Plugins.Exceptions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Castle.Core.Internal;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
@@ -12,19 +11,22 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
/// </summary>
|
||||
public abstract class Plugin : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the plugin info related to this plugin
|
||||
/// </summary>
|
||||
public PluginInfo PluginInfo { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the plugin is enabled
|
||||
/// </summary>
|
||||
public bool Enabled { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether this plugin has a configuration view model.
|
||||
/// If set to true, <see cref="GetConfigurationViewModel" /> will be called when the plugin is configured from the UI.
|
||||
/// Gets or sets a configuration dialog for this plugin that is accessible in the UI under Settings > Plugins
|
||||
/// </summary>
|
||||
public bool HasConfigurationViewModel { get; protected set; }
|
||||
public PluginConfigurationDialog ConfigurationDialog { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
DisablePlugin();
|
||||
@@ -40,16 +42,6 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
/// </summary>
|
||||
public abstract void DisablePlugin();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the plugins configuration window is opened from the UI. The UI will only attempt to open if
|
||||
/// <see cref="HasConfigurationViewModel" /> is set to True.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual PluginConfigurationViewModel GetConfigurationViewModel()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void SetEnabled(bool enable, bool isAutoEnable = false)
|
||||
{
|
||||
if (enable && !Enabled)
|
||||
@@ -116,14 +108,27 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the plugin is enabled
|
||||
/// </summary>
|
||||
public event EventHandler PluginEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the plugin is disabled
|
||||
/// </summary>
|
||||
public event EventHandler PluginDisabled;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the PluginEnabled event
|
||||
/// </summary>
|
||||
protected virtual void OnPluginEnabled()
|
||||
{
|
||||
PluginEnabled?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the PluginDisabled event
|
||||
/// </summary>
|
||||
protected virtual void OnPluginDisabled()
|
||||
{
|
||||
PluginDisabled?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class PluginConfigurationDialog<T> : PluginConfigurationDialog where T : PluginConfigurationViewModel
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override Type Type => typeof(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a configuration dialog for a specific plugin
|
||||
/// </summary>
|
||||
public abstract class PluginConfigurationDialog
|
||||
{
|
||||
/// <summary>
|
||||
/// The layer brush this dialog belongs to
|
||||
/// </summary>
|
||||
internal Plugin Plugin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of view model the tab contains
|
||||
/// </summary>
|
||||
public abstract Type Type { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
using Artemis.Core.Plugins.Exceptions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
@@ -15,6 +14,7 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
||||
public abstract class BaseLayerBrush : PropertyChangedBase, IDisposable
|
||||
{
|
||||
private LayerBrushType _brushType;
|
||||
private LayerBrushConfigurationDialog _configurationDialog;
|
||||
private LayerBrushDescriptor _descriptor;
|
||||
private Layer _layer;
|
||||
private bool _supportsTransformation = true;
|
||||
@@ -37,6 +37,15 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
||||
internal set => SetAndNotify(ref _descriptor, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a configuration dialog complementing the regular properties
|
||||
/// </summary>
|
||||
public LayerBrushConfigurationDialog ConfigurationDialog
|
||||
{
|
||||
get => _configurationDialog;
|
||||
protected set => SetAndNotify(ref _configurationDialog, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of layer brush
|
||||
/// </summary>
|
||||
@@ -71,17 +80,12 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether this plugin has a configuration view model.
|
||||
/// If set to true, <see cref="GetConfigurationViewModel" /> will be called when the plugin is configured from the UI.
|
||||
/// </summary>
|
||||
public bool HasConfigurationViewModel { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
DisableLayerBrush();
|
||||
BaseProperties.Dispose();
|
||||
|
||||
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
@@ -102,16 +106,6 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
||||
/// <param name="deltaTime">Seconds passed since last update</param>
|
||||
public abstract void Update(double deltaTime);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the brush configuration window is opened from the UI. The UI will only attempt to open if
|
||||
/// <see cref="HasConfigurationViewModel" /> is set to True.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual BrushConfigurationViewModel GetConfigurationViewModel()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Not only is this needed to initialize properties on the layer brushes, it also prevents implementing anything
|
||||
// but LayerBrush<T> and RgbNetLayerBrush<T> outside the core
|
||||
internal abstract void Initialize(IRenderElementService renderElementService);
|
||||
@@ -123,9 +117,19 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes the type of a layer brush
|
||||
/// </summary>
|
||||
public enum LayerBrushType
|
||||
{
|
||||
/// <summary>
|
||||
/// A regular brush that users Artemis' SkiaSharp-based rendering engine
|
||||
/// </summary>
|
||||
Regular,
|
||||
|
||||
/// <summary>
|
||||
/// An RGB.NET brush that uses RGB.NET's per-LED rendering engine.
|
||||
/// </summary>
|
||||
RgbNet
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,16 @@ using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
||||
{
|
||||
/// <summary>
|
||||
/// An RGB.NET brush that uses RGB.NET's per-LED rendering engine.
|
||||
/// <para>Note: This brush type always renders on top of regular brushes</para>
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public abstract class RgbNetLayerBrush<T> : PropertiesLayerBrush<T> where T : LayerPropertyGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="RgbNetLayerBrush{T}" /> class
|
||||
/// </summary>
|
||||
protected RgbNetLayerBrush()
|
||||
{
|
||||
BrushType = LayerBrushType.RgbNet;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class LayerBrushConfigurationDialog<T> : LayerBrushConfigurationDialog where T : BrushConfigurationViewModel
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override Type Type => typeof(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a UI tab for a layer brush
|
||||
/// </summary>
|
||||
public abstract class LayerBrushConfigurationDialog
|
||||
{
|
||||
/// <summary>
|
||||
/// The layer brush this dialog belongs to
|
||||
/// </summary>
|
||||
internal BaseLayerBrush LayerBrush { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of view model the tab contains
|
||||
/// </summary>
|
||||
public abstract Type Type { get; }
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ using Artemis.Core.Plugins.Abstract;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that describes a layer brush
|
||||
/// </summary>
|
||||
public class LayerBrushDescriptor
|
||||
{
|
||||
internal LayerBrushDescriptor(string displayName, string description, string icon, Type layerBrushType, LayerBrushProvider layerBrushProvider)
|
||||
@@ -14,10 +17,30 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
LayerBrushProvider = layerBrushProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name that is displayed in the UI
|
||||
/// </summary>
|
||||
public string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The description that is displayed in the UI
|
||||
/// </summary>
|
||||
public string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Material icon to display in the UI, a full reference can be found
|
||||
/// <see href="https://materialdesignicons.com">here</see>
|
||||
/// </summary>
|
||||
public string Icon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the layer brush
|
||||
/// </summary>
|
||||
public Type LayerBrushType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The plugin that provided this <see cref="LayerBrushDescriptor" />
|
||||
/// </summary>
|
||||
public LayerBrushProvider LayerBrushProvider { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using SkiaSharp;
|
||||
@@ -13,13 +12,14 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
/// </summary>
|
||||
public abstract class BaseLayerEffect : PropertyChangedBase, IDisposable
|
||||
{
|
||||
private Guid _entityId;
|
||||
private RenderProfileElement _profileElement;
|
||||
private string _name;
|
||||
private bool _enabled;
|
||||
private bool _hasBeenRenamed;
|
||||
private int _order;
|
||||
private LayerEffectDescriptor _descriptor;
|
||||
private bool _enabled;
|
||||
private Guid _entityId;
|
||||
private bool _hasBeenRenamed;
|
||||
private string _name;
|
||||
private int _order;
|
||||
private RenderProfileElement _profileElement;
|
||||
private LayerEffectConfigurationDialog _configurationDialog;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique ID of this effect
|
||||
@@ -77,7 +77,7 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the descriptor of this effect
|
||||
/// Gets the <see cref="LayerEffectDescriptor"/> that registered this effect
|
||||
/// </summary>
|
||||
public LayerEffectDescriptor Descriptor
|
||||
{
|
||||
@@ -85,6 +85,15 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
internal set => SetAndNotify(ref _descriptor, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a configuration dialog complementing the regular properties
|
||||
/// </summary>
|
||||
public LayerEffectConfigurationDialog ConfigurationDialog
|
||||
{
|
||||
get => _configurationDialog;
|
||||
protected set => SetAndNotify(ref _configurationDialog, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin info that defined this effect
|
||||
/// </summary>
|
||||
@@ -97,12 +106,7 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
|
||||
internal string PropertyRootPath => $"LayerEffect.{EntityId}.{GetType().Name}.";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether this plugin has a configuration view model.
|
||||
/// If set to true, <see cref="GetConfigurationViewModel" /> will be called when the plugin is configured from the UI.
|
||||
/// </summary>
|
||||
public bool HasConfigurationViewModel { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
DisableLayerEffect();
|
||||
@@ -146,16 +150,5 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
// Not only is this needed to initialize properties on the layer effects, it also prevents implementing anything
|
||||
// but LayerEffect<T> outside the core
|
||||
internal abstract void Initialize(IRenderElementService renderElementService);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called when the effect configuration window is opened from the UI. The UI will only attempt to open if
|
||||
/// <see cref="HasConfigurationViewModel" /> is set to True.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual EffectConfigurationViewModel GetConfigurationViewModel()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerEffect
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class LayerEffectConfigurationDialog<T> : LayerEffectConfigurationDialog where T : EffectConfigurationViewModel
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override Type Type => typeof(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a UI tab for a specific layer effect
|
||||
/// </summary>
|
||||
public abstract class LayerEffectConfigurationDialog
|
||||
{
|
||||
/// <summary>
|
||||
/// The layer effect this dialog belongs to
|
||||
/// </summary>
|
||||
internal BaseLayerEffect LayerEffect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of view model the tab contains
|
||||
/// </summary>
|
||||
public abstract Type Type { get; }
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ using Artemis.Core.Plugins.Abstract;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that describes a layer effect
|
||||
/// </summary>
|
||||
public class LayerEffectDescriptor
|
||||
{
|
||||
internal LayerEffectDescriptor(string displayName, string description, string icon, Type layerEffectType, LayerEffectProvider layerEffectProvider)
|
||||
@@ -14,10 +17,30 @@ namespace Artemis.Core.Plugins.LayerEffect
|
||||
LayerEffectProvider = layerEffectProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name that is displayed in the UI
|
||||
/// </summary>
|
||||
public string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The description that is displayed in the UI
|
||||
/// </summary>
|
||||
public string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Material icon to display in the UI, a full reference can be found
|
||||
/// <see href="https://materialdesignicons.com">here</see>
|
||||
/// </summary>
|
||||
public string Icon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the layer effect
|
||||
/// </summary>
|
||||
public Type LayerEffectType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The plugin that provided this <see cref="LayerEffectDescriptor" />
|
||||
/// </summary>
|
||||
public LayerEffectProvider LayerEffectProvider { get; }
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,12 @@ namespace Artemis.Core.Plugins.Models
|
||||
}
|
||||
|
||||
var pluginSetting = new PluginSetting<T>(_pluginInfo, _pluginRepository, settingEntity);
|
||||
|
||||
// This overrides null with the default value, I'm not sure if that's desirable because you
|
||||
// might expect something to go null and you might not
|
||||
// if (pluginSetting.Value == null && defaultValue != null)
|
||||
// pluginSetting.Value = defaultValue;
|
||||
|
||||
_settingEntities.Add(name, pluginSetting);
|
||||
return pluginSetting;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user