Added plugin unloading

This commit is contained in:
SpoinkyNL committed 2019-04-14 12:43:39 +02:00
1 parent dba48a2b6a
commit cdda228713
23 files changed
+309 -158

No files matched your search

@@ -1,5 +1,4 @@
using Artemis.Core.Plugins.Interfaces;
using Stylet;
namespace Artemis.Core.Plugins.Abstract
{
@@ -1,5 +1,4 @@
using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.Plugins.Models;
using Stylet;
namespace Artemis.Core.Plugins.Abstract
@@ -17,11 +17,6 @@ namespace Artemis.Core.Plugins.Abstract
/// <inheritdoc />
public abstract bool ExpandsMainDataModel { get; }
/// <inheritdoc />
public void EnablePlugin()
{
// Load and activate the last active profile
}
/// <inheritdoc />
public virtual void Update(double deltaTime)
@@ -47,9 +42,13 @@ namespace Artemis.Core.Plugins.Abstract
public abstract IScreen GetMainViewModel();
/// <inheritdoc />
public void Dispose()
{
}
public abstract void EnablePlugin();
/// <inheritdoc />
public abstract void DisablePlugin();
/// <inheritdoc />
public abstract void Dispose();
public void ChangeActiveProfile(Profile profile)
{
@@ -2,14 +2,21 @@
namespace Artemis.Core.Plugins.Interfaces
{
/// <inheritdoc />
/// <summary>
/// This is the base plugin type, use the other interfaces such as IModule to create plugins
/// </summary>
public interface IPlugin : IDisposable
{
/// <summary>
/// Called when the plugin is loaded
/// Called when the plugin is activated
/// </summary>
void EnablePlugin();
/// <summary>
/// Called when the plugin is deactivated
/// </summary>
void DisablePlugin();
}
}
@@ -1,4 +1,5 @@
using System;
using System.IO;
using AppDomainToolkit;
using Artemis.Core.Plugins.Interfaces;
using Newtonsoft.Json;
@@ -7,6 +8,10 @@ namespace Artemis.Core.Plugins.Models
{
public class PluginInfo
{
internal PluginInfo()
{
}
/// <summary>
/// The plugins GUID
/// </summary>
@@ -28,10 +33,10 @@ namespace Artemis.Core.Plugins.Models
public string Main { get; set; }
/// <summary>
/// Full path to the plugin's current folder
/// The plugins root directory
/// </summary>
[JsonIgnore]
public string Folder { get; set; }
public DirectoryInfo Directory { get; set; }
/// <summary>
/// A reference to the type implementing IPlugin, available after successful load
@@ -48,6 +53,7 @@ namespace Artemis.Core.Plugins.Models
/// <summary>
/// The AppDomain context of this plugin
/// </summary>
[JsonIgnore]
internal AppDomainContext<AssemblyTargetLoader, PathBasedAssemblyResolver> Context { get; set; }
public override string ToString()