using System;
using System.Collections.Generic;
using System.Reflection;
using RGB.NET.Core;
namespace Artemis.Core.Services
{
///
/// A service providing plugin management
///
public interface IPluginService : IArtemisService, IDisposable
{
///
/// Indicates whether or not plugins are currently being loaded
///
bool LoadingPlugins { get; }
///
/// Copy built-in plugins from the executable directory to the plugins directory if the version is higher
/// (higher or equal if compiled as debug)
///
void CopyBuiltInPlugins();
///
/// Loads all installed plugins. If plugins already loaded this will reload them all
///
void LoadPlugins(bool ignorePluginLock);
///
/// Unloads all installed plugins.
///
void UnloadPlugins();
///
/// Loads the plugin defined in the provided
///
/// The plugin info defining the plugin to load
void LoadPlugin(PluginInfo pluginInfo);
///
/// Unloads the plugin defined in the provided
///
/// The plugin info defining the plugin to unload
void UnloadPlugin(PluginInfo pluginInfo);
///
/// Enables the provided plugin
///
///
/// If true, fails if there is a lock file present
void EnablePlugin(Plugin plugin, bool isAutoEnable = false);
///
/// Disables the provided plugin
///
///
void DisablePlugin(Plugin plugin);
///
/// Finds the plugin info related to the plugin
///
/// The plugin you want to find the plugin info for
/// The plugins PluginInfo
PluginInfo GetPluginInfo(Plugin plugin);
///
/// Gets the plugin info of all loaded plugins
///
/// A list containing all the plugin info
List GetAllPluginInfo();
///
/// Finds all enabled instances of
///
/// Either or a plugin type implementing
/// Returns a list of plugin instances of
List GetPluginsOfType() where T : Plugin;
///
/// Gets the plugin that provided the specified assembly
///
///
///
Plugin GetPluginByAssembly(Assembly assembly);
///
/// Gets the plugin that defined the specified device
///
///
///
Plugin GetPluginByDevice(IRGBDevice device);
///
/// Returns the plugin info of the current call stack
///
/// If the current call stack contains a plugin, the plugin. Otherwise null
Plugin GetCallingPlugin();
#region Events
///
/// Occurs when built-in plugins are being loaded
///
event EventHandler CopyingBuildInPlugins;
///
/// Occurs when a plugin has started loading
///
event EventHandler PluginLoading;
///
/// Occurs when a plugin has loaded
///
event EventHandler PluginLoaded;
///
/// Occurs when a plugin has been unloaded
///
event EventHandler PluginUnloaded;
///
/// Occurs when a plugin is being enabled
///
event EventHandler PluginEnabling;
///
/// Occurs when a plugin has been enabled
///
event EventHandler PluginEnabled;
///
/// Occurs when a plugin has been disabled
///
event EventHandler PluginDisabled;
#endregion
}
}