Removed seperate plugins project since you're always referencing both..

Added more loading logic
This commit is contained in:
SpoinkyNL committed 2018-04-06 19:54:25 +02:00
1 parent 3db4aab8bc
commit c22a78cd30
57 files changed
+959 -650

No files matched your search

+21 -2
View File
@@ -2,12 +2,15 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.Plugins.Models;
using Artemis.Core.ProfileElements;
using Artemis.Core.Services.Interfaces;
using Artemis.Plugins.Interfaces;
using Artemis.Plugins.Models;
using Ninject;
namespace Artemis.Core.Services
@@ -64,6 +67,22 @@ namespace Artemis.Core.Services
return await Task.Run(() => pluginInfo.GetModuleViewModel(_kernel));
}
/// <inheritdoc />
public ILayerType GetLayerTypeByGuid(Guid layerTypeGuid)
{
var pluginInfo = _plugins.FirstOrDefault(p => p.Guid == layerTypeGuid);
if (pluginInfo == null)
return null;
// Layer types are instantiated per layer so lets compile and return a new instance
if (!(pluginInfo.Plugin is ILayerType))
{
throw new ArtemisPluginException(pluginInfo, "Plugin is expected to implement ILayerType");
}
return (ILayerType) pluginInfo.Plugin;
}
public void Dispose()
{
// Empty the list of plugins