Plugins - Removed plugin info from constructor

This commit is contained in:
SpoinkyNL committed 2020-06-07 21:51:56 +02:00
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
{
+11 -10
View File
@@ -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;
}
}
}
+2 -2
View File
@@ -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));
}