mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Changed plugins to abstract classes
This commit is contained in:
1 parent
083119dae2
commit
bfc320c0ac
36 files changed
+657
-300
No files matched your search
@@ -0,0 +1,17 @@
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to expand the application-wide datamodel
|
||||
/// </summary>
|
||||
public abstract class DataModelExpansion : Plugin
|
||||
{
|
||||
protected DataModelExpansion(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract void Update(double deltaTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to implement your own RGB device
|
||||
/// </summary>
|
||||
public abstract class Device : Plugin
|
||||
{
|
||||
protected Device(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-4
@@ -1,24 +1,29 @@
|
||||
using System.Drawing;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.ProfileElements;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.Core.Plugins.Interfaces
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to create your own layer type
|
||||
/// </summary>
|
||||
public interface ILayerType : IPlugin
|
||||
public abstract class LayerType : Plugin
|
||||
{
|
||||
protected LayerType(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the layer type
|
||||
/// </summary>
|
||||
/// <param name="layer"></param>
|
||||
void Update(Layer layer);
|
||||
public abstract void Update(Layer layer);
|
||||
|
||||
/// <summary>
|
||||
/// Renders the layer type
|
||||
/// </summary>
|
||||
void Render(Layer device, RGBSurface surface, Graphics graphics);
|
||||
public abstract void Render(Layer device, RGBSurface surface, Graphics graphics);
|
||||
}
|
||||
}
|
||||
+12
-7
@@ -1,31 +1,36 @@
|
||||
using System.Drawing;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using RGB.NET.Core;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.Interfaces
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to add support for new games/applications
|
||||
/// </summary>
|
||||
public interface IModule : IPlugin
|
||||
public abstract class Module : Plugin
|
||||
{
|
||||
protected Module(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The modules display name that's shown in the menu
|
||||
/// </summary>
|
||||
string DisplayName { get; }
|
||||
public string DisplayName { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether 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
|
||||
/// </summary>
|
||||
bool ExpandsMainDataModel { get; }
|
||||
public bool ExpandsMainDataModel { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Called each frame when the module must update
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">Time since the last update</param>
|
||||
void Update(double deltaTime);
|
||||
public abstract void Update(double deltaTime);
|
||||
|
||||
/// <summary>
|
||||
/// Called each frame when the module must render
|
||||
@@ -33,12 +38,12 @@ namespace Artemis.Core.Plugins.Interfaces
|
||||
/// <param name="deltaTime">Time since the last render</param>
|
||||
/// <param name="surface">The RGB Surface to render to</param>
|
||||
/// <param name="graphics"></param>
|
||||
void Render(double deltaTime, RGBSurface surface, Graphics graphics);
|
||||
public abstract void Render(double deltaTime, RGBSurface surface, Graphics graphics);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the module's main view is being shown
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IScreen GetMainViewModel();
|
||||
public abstract IScreen GetMainViewModel();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
using Artemis.Core.Plugins.Interfaces;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
public abstract class ModuleDataModel
|
||||
{
|
||||
protected ModuleDataModel(IModule module)
|
||||
protected ModuleDataModel(Module module)
|
||||
{
|
||||
Module = module;
|
||||
}
|
||||
|
||||
public IModule Module { get; }
|
||||
public Module Module { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
using Artemis.Core.Plugins.Interfaces;
|
||||
using Stylet;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
public abstract class ModuleViewModel : Screen
|
||||
{
|
||||
protected ModuleViewModel(IModule module)
|
||||
protected ModuleViewModel(Module module)
|
||||
{
|
||||
Module = module;
|
||||
}
|
||||
|
||||
public IModule Module { get; }
|
||||
public Module Module { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// This is the base plugin type, use the other interfaces such as Module to create plugins
|
||||
/// </summary>
|
||||
public abstract class Plugin : IDisposable
|
||||
{
|
||||
internal Plugin(PluginInfo pluginInfo)
|
||||
{
|
||||
PluginInfo = pluginInfo;
|
||||
}
|
||||
|
||||
public PluginInfo PluginInfo { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Called when the plugin is activated
|
||||
/// </summary>
|
||||
public abstract void EnablePlugin();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the plugin is deactivated
|
||||
/// </summary>
|
||||
public abstract void DisablePlugin();
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Called when the plugin is unloaded, clean up any unmanaged resources here
|
||||
/// </summary>
|
||||
public abstract void Dispose();
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,21 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Artemis.Core.Plugins.Interfaces;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.ProfileElements;
|
||||
using RGB.NET.Core;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
public abstract class ProfileModule : IModule
|
||||
public abstract class ProfileModule : Module
|
||||
{
|
||||
protected ProfileModule(PluginInfo pluginInfo) : base(pluginInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public Profile ActiveProfile { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract string DisplayName { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract bool ExpandsMainDataModel { get; }
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void Update(double deltaTime)
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
@@ -29,7 +25,7 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void Render(double deltaTime, RGBSurface surface, Graphics graphics)
|
||||
public override void Render(double deltaTime, RGBSurface surface, Graphics graphics)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
@@ -38,18 +34,6 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract IScreen GetMainViewModel();
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void EnablePlugin();
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void DisablePlugin();
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void Dispose();
|
||||
|
||||
public void ChangeActiveProfile(Profile profile)
|
||||
{
|
||||
lock (this)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Artemis.Core.Plugins.Interfaces
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to expand the application-wide datamodel
|
||||
/// </summary>
|
||||
public interface IDataModelExpansion : IPlugin
|
||||
{
|
||||
void Update(double deltaTime);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Artemis.Core.Plugins.Interfaces
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Allows you to implement your own RGB device
|
||||
/// </summary>
|
||||
public interface IDevice : IPlugin
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
|
||||
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 activated
|
||||
/// </summary>
|
||||
void EnablePlugin();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called when the plugin is deactivated
|
||||
/// </summary>
|
||||
void DisablePlugin();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using AppDomainToolkit;
|
||||
using Artemis.Core.Plugins.Interfaces;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Core.Plugins.Models
|
||||
@@ -15,40 +15,40 @@ namespace Artemis.Core.Plugins.Models
|
||||
/// <summary>
|
||||
/// The plugins GUID
|
||||
/// </summary>
|
||||
public Guid Guid { get; set; }
|
||||
public Guid Guid { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the plugin
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
public string Name { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The version of the plugin
|
||||
/// </summary>
|
||||
public string Version { get; set; }
|
||||
public string Version { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The main entry DLL, should contain a class implementing IPlugin
|
||||
/// The main entry DLL, should contain a class implementing Plugin
|
||||
/// </summary>
|
||||
public string Main { get; set; }
|
||||
public string Main { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The plugins root directory
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public DirectoryInfo Directory { get; set; }
|
||||
public DirectoryInfo Directory { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// A reference to the type implementing IPlugin, available after successful load
|
||||
/// A reference to the type implementing Plugin, available after successful load
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public IPlugin Instance { get; set; }
|
||||
public Plugin Instance { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the user enabled the plugin or not
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public bool Enabled { get; set; }
|
||||
public bool Enabled { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The AppDomain context of this plugin
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using Artemis.Storage.Repositories;
|
||||
|
||||
namespace Artemis.Core.Plugins.Models
|
||||
{
|
||||
public class PluginSettings
|
||||
{
|
||||
private readonly PluginInfo _pluginInfo;
|
||||
private readonly SettingRepository _settingRepository;
|
||||
|
||||
internal PluginSettings(PluginInfo pluginInfo, SettingRepository settingRepository)
|
||||
{
|
||||
_pluginInfo = pluginInfo;
|
||||
_settingRepository = settingRepository;
|
||||
}
|
||||
|
||||
public bool HasSettingChanged(string settingName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasAnySettingChanged()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user