mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +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
@@ -3,6 +3,7 @@ using System.Drawing;
|
||||
using Artemis.Core.Plugins.Interfaces;
|
||||
using Artemis.Core.ProfileElements;
|
||||
using RGB.NET.Core;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
@@ -10,9 +11,6 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
public Profile ActiveProfile { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract Type ViewModelType { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract bool ExpandsMainDataModel { get; }
|
||||
|
||||
@@ -22,20 +20,6 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
// Load and activate the last active profile
|
||||
}
|
||||
|
||||
public void ChangeActiveProfile(Profile profile)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (profile == null)
|
||||
throw new ArgumentNullException(nameof(profile));
|
||||
|
||||
ActiveProfile?.Deactivate();
|
||||
|
||||
ActiveProfile = profile;
|
||||
ActiveProfile.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void Update(double deltaTime)
|
||||
{
|
||||
@@ -56,9 +40,26 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract IScreen GetMainViewModel();
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public void ChangeActiveProfile(Profile profile)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (profile == null)
|
||||
throw new ArgumentNullException(nameof(profile));
|
||||
|
||||
ActiveProfile?.Deactivate();
|
||||
|
||||
ActiveProfile = profile;
|
||||
ActiveProfile.Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,14 @@ namespace Artemis.Core.Plugins.Exceptions
|
||||
PluginInfo = pluginInfo;
|
||||
}
|
||||
|
||||
public ArtemisPluginException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ArtemisPluginException(string message, Exception inner) : base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
public PluginInfo PluginInfo { get; }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,5 @@
|
||||
{
|
||||
public interface ILayerTypeConfiguration
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing;
|
||||
using RGB.NET.Core;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.Interfaces
|
||||
{
|
||||
@@ -10,11 +10,6 @@ namespace Artemis.Core.Plugins.Interfaces
|
||||
/// </summary>
|
||||
public interface IModule : IPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of this module's view model
|
||||
/// </summary>
|
||||
Type ViewModelType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Wether or not this module expands upon the main data model. If set to true any data in main data model can be
|
||||
/// accessed by profiles in this module
|
||||
@@ -34,5 +29,11 @@ namespace Artemis.Core.Plugins.Interfaces
|
||||
/// <param name="surface">The RGB Surface to render to</param>
|
||||
/// <param name="graphics"></param>
|
||||
void Render(double deltaTime, RGBSurface surface, Graphics graphics);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the module's main view is being shown
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IScreen GetMainViewModel();
|
||||
}
|
||||
}
|
||||
@@ -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