mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Removed the rest of CS Script and removed old plugin projects
This commit is contained in:
1 parent
aa32c8aae4
commit
90cd27b0c6
47 files changed
+550
-846
No files matched your search
@@ -1,21 +1,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Plugins.Exceptions;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.Plugins.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Core.Plugins.Models
|
||||
{
|
||||
public class PluginInfo
|
||||
{
|
||||
private static AppDomain _appDomain;
|
||||
|
||||
/// <summary>
|
||||
/// The plugin's GUID
|
||||
/// The plugins GUID
|
||||
/// </summary>
|
||||
public Guid Guid { get; set; }
|
||||
|
||||
@@ -28,42 +21,23 @@ namespace Artemis.Core.Plugins.Models
|
||||
/// The version of the plugin
|
||||
/// </summary>
|
||||
public string Version { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The instantiated plugin, available after successful load
|
||||
/// The main entry DLL, should contain a class implementing IPlugin
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public IPlugin Plugin { get; set; }
|
||||
public string Main { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Full path to the plugin's current folder
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string Folder { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view model of the module accompanying the provided plugin info
|
||||
/// A references to the types implementing IPlugin, available after successful load
|
||||
/// </summary>
|
||||
/// <param name="kernel">The Ninject kernel to use for DI</param>
|
||||
/// <returns></returns>
|
||||
public IModuleViewModel GetModuleViewModel(IKernel kernel)
|
||||
{
|
||||
// Don't attempt to locate VMs for something other than a module
|
||||
if (Plugin == null)
|
||||
throw new ArtemisPluginException(this, "Cannot locate a view model for this plugin because it's not compiled.");
|
||||
if (!(Plugin is IModule module))
|
||||
throw new ArtemisPluginException(this, "Cannot locate a view model for this plugin as it's not a module.");
|
||||
|
||||
// Get the type from the module
|
||||
var vmType = module.ViewModelType;
|
||||
if (!typeof(IModuleViewModel).IsAssignableFrom(vmType))
|
||||
throw new ArtemisPluginException(this, "ViewModel must implement IModuleViewModel.");
|
||||
|
||||
// Instantiate the ViewModel with Ninject
|
||||
var vm = (IModuleViewModel) kernel.Get(vmType);
|
||||
vm.PluginInfo = this;
|
||||
return vm;
|
||||
}
|
||||
[JsonIgnore]
|
||||
public List<IPlugin> Instances { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user