mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Plugins - Removed plugin info from constructor
This commit is contained in:
1 parent
33bb3ffa6c
commit
1d35a02d5b
49 files changed
+305
-390
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
||||
|
||||
namespace Artemis.Core.Services.Interfaces
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Ninject;
|
||||
using Ninject.Parameters;
|
||||
@@ -42,7 +43,7 @@ namespace Artemis.Core.Services
|
||||
public BaseLayerBrush InstantiateLayerBrush(Layer layer)
|
||||
{
|
||||
layer.DeactivateLayerBrush();
|
||||
|
||||
|
||||
var descriptorReference = layer.General.BrushReference?.CurrentValue;
|
||||
if (descriptorReference == null)
|
||||
return null;
|
||||
@@ -56,16 +57,16 @@ namespace Artemis.Core.Services
|
||||
if (descriptor == null)
|
||||
return null;
|
||||
|
||||
var arguments = new IParameter[]
|
||||
{
|
||||
new ConstructorArgument("layer", layer),
|
||||
new ConstructorArgument("descriptor", descriptor)
|
||||
};
|
||||
layer.LayerBrush = (BaseLayerBrush) _kernel.Get(descriptor.LayerBrushType, arguments);
|
||||
layer.LayerBrush.Initialize(this);
|
||||
layer.LayerBrush.Update(0);
|
||||
var brush = (BaseLayerBrush) _kernel.Get(descriptor.LayerBrushType);
|
||||
brush.Layer = layer;
|
||||
brush.Descriptor = descriptor;
|
||||
layer.LayerBrush = brush;
|
||||
|
||||
brush.Initialize(this);
|
||||
brush.Update(0);
|
||||
layer.OnLayerBrushUpdated();
|
||||
return layer.LayerBrush;
|
||||
|
||||
return brush;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,10 +267,10 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
var parameters = new IParameter[]
|
||||
{
|
||||
new ConstructorArgument("pluginInfo", pluginInfo),
|
||||
new Parameter("PluginInfo", pluginInfo, false)
|
||||
};
|
||||
pluginInfo.Instance = (Plugin) _childKernel.Get(pluginType, constraint: null, parameters: parameters);
|
||||
pluginInfo.Instance.PluginInfo = pluginInfo;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -353,7 +353,7 @@ namespace Artemis.Core.Services
|
||||
}
|
||||
|
||||
plugin.SetEnabled(false);
|
||||
|
||||
|
||||
OnPluginDisabled(new PluginEventArgs(plugin.PluginInfo));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user