Plugins - Implemented features

Core - Removed Stylet dependency for #500
This commit is contained in:
SpoinkyNL committed 2020-11-11 23:53:52 +01:00
1 parent b56966c585
commit e812929215
139 files changed
+1635 -1106

No files matched your search

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Artemis.Core.DeviceProviders;
using RGB.NET.Core;
namespace Artemis.Core.Services
@@ -33,69 +34,77 @@ namespace Artemis.Core.Services
void UnloadPlugins();
/// <summary>
/// Loads the plugin defined in the provided <see cref="PluginInfo" />
/// Loads the plugin located in the provided <paramref name="directory" />
/// </summary>
/// <param name="pluginInfo">The plugin info defining the plugin to load</param>
void LoadPlugin(DirectoryInfo pluginInfo);
/// <param name="directory">The directory where the plugin is located</param>
Plugin LoadPlugin(DirectoryInfo directory);
/// <summary>
/// Unloads the plugin defined in the provided <see cref="PluginInfo" />
/// Enables the provided <paramref name="plugin" />
/// </summary>
/// <param name="pluginInfo">The plugin info defining the plugin to unload</param>
void UnloadPlugin(PluginInfo pluginInfo);
/// <param name="plugin">The plugin to enable</param>
void EnablePlugin(Plugin plugin, bool ignorePluginLock = false);
/// <summary>
/// Enables the provided plugin
/// Unloads the provided <paramref name="plugin" />
/// </summary>
/// <param name="pluginImplementation"></param>
/// <param name="plugin">The plugin to unload</param>
void UnloadPlugin(Plugin plugin);
/// <summary>
/// Disables the provided <paramref name="plugin" />
/// </summary>
/// <param name="plugin">The plugin to disable</param>
void DisablePlugin(Plugin plugin);
/// <summary>
/// Enables the provided plugin feature
/// </summary>
/// <param name="pluginFeature"></param>
/// <param name="isAutoEnable">If true, fails if there is a lock file present</param>
void EnablePluginImplementation(PluginImplementation pluginImplementation, bool isAutoEnable = false);
void EnablePluginFeature(PluginFeature pluginFeature, bool isAutoEnable = false);
/// <summary>
/// Disables the provided plugin
/// Disables the provided plugin feature
/// </summary>
/// <param name="pluginImplementation"></param>
void DisablePluginImplementation(PluginImplementation pluginImplementation);
/// <summary>
/// Finds the plugin info related to the plugin
/// </summary>
/// <param name="pluginImplementation">The plugin you want to find the plugin info for</param>
/// <returns>The plugins PluginInfo</returns>
PluginInfo GetPluginInfo(PluginImplementation pluginImplementation);
/// <param name="pluginFeature"></param>
void DisablePluginFeature(PluginFeature pluginFeature);
/// <summary>
/// Gets the plugin info of all loaded plugins
/// </summary>
/// <returns>A list containing all the plugin info</returns>
List<PluginInfo> GetAllPluginInfo();
List<Plugin> GetAllPlugins();
/// <summary>
/// Finds all enabled <see cref="PluginImplementation" /> instances of <typeparamref name="T" />
/// Finds all enabled <see cref="PluginFeature" /> instances of <typeparamref name="T" />
/// </summary>
/// <typeparam name="T">Either <see cref="PluginImplementation" /> or a plugin type implementing <see cref="PluginImplementation" /></typeparam>
/// <returns>Returns a list of plugin instances of <typeparamref name="T" /></returns>
List<T> GetPluginsOfType<T>() where T : PluginImplementation;
/// <typeparam name="T">
/// Either <see cref="PluginFeature" /> or a plugin type implementing
/// <see cref="PluginFeature" />
/// </typeparam>
/// <returns>Returns a list of feature instances of <typeparamref name="T" /></returns>
List<T> GetFeaturesOfType<T>() where T : PluginFeature;
/// <summary>
/// Gets the plugin that provided the specified assembly
/// </summary>
/// <param name="assembly"></param>
/// <returns></returns>
PluginImplementation GetPluginByAssembly(Assembly assembly);
Plugin GetPluginByAssembly(Assembly assembly);
/// <summary>
/// Returns the plugin info of the current call stack
/// </summary>
/// <returns>If the current call stack contains a plugin, the plugin. Otherwise null</returns>
Plugin? GetCallingPlugin();
/// <summary>
/// Gets the plugin that defined the specified device
/// </summary>
/// <param name="device"></param>
/// <returns></returns>
PluginImplementation GetPluginByDevice(IRGBDevice device);
/// <summary>
/// Returns the plugin info of the current call stack
/// </summary>
/// <returns>If the current call stack contains a plugin, the plugin. Otherwise null</returns>
PluginImplementation GetCallingPlugin();
DeviceProvider GetDeviceProviderByDevice(IRGBDevice device);
#region Events
@@ -134,6 +143,26 @@ namespace Artemis.Core.Services
/// </summary>
event EventHandler<PluginEventArgs> PluginDisabled;
/// <summary>
/// Occurs when a plugin feature is being enabled
/// </summary>
public event EventHandler<PluginFeatureEventArgs> PluginFeatureEnabling;
/// <summary>
/// Occurs when a plugin feature has been enabled
/// </summary>
public event EventHandler<PluginFeatureEventArgs> PluginFeatureEnabled;
/// <summary>
/// Occurs when a plugin feature could not be enabled
/// </summary>
public event EventHandler<PluginFeatureEventArgs> PluginFeatureEnableFailed;
/// <summary>
/// Occurs when a plugin feature has been disabled
/// </summary>
public event EventHandler<PluginFeatureEventArgs> PluginFeatureDisabled;
#endregion
}
}