using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Prise { public interface IPluginLoader : IDisposable { /// /// Looks for the first plugin of contract type inside of the pathToPlugins directory recursively. /// The comparison is done on the last part of the path of the plugins. /// eg: "plugins/mypluginA" => mypluginA /// /// Directory to start looking for plugins /// The plugin contract /// A that contains all the required information in order to load the plugin. Task FindPlugin(string pathToPlugins); /// /// Looks for the first plugin of contract type inside of the pathToPlugins directory recursively. /// The comparison is done on the last part of the path of the plugins. /// eg: "plugins/mypluginA" => mypluginA /// /// Directory to start looking for plugins /// The name of the plugin to find. eg: mypluginA /// The plugin contract /// A that contains all the required information in order to load the plugin. Task FindPlugin(string pathToPlugins, string plugin); /// /// Looks for all the plugins from a certain directory recursively /// /// Starting path to start searching plugins of contract type /// The plugin contract /// A List of that contains all the required information in order to load the plugins Task> FindPlugins(string pathToPlugins); /// /// Loads the first implementation of the plugin contract from the . /// Use this if you're certain that your plugin assemblies contain only 1 plugin. /// /// The from the FindPlugin, FindPlugins or FindPluginsAsAsyncEnumerable method. /// The framework from the host application, optional.--> /// A builder function that allows you to modify the PluginLoadContext before loading the plugin<, optional./param> /// The plugin contract /// A fully loaded and usable plugin of type Task LoadPlugin(AssemblyScanResult scanResult, string hostFramework = null, Action configure = null); /// /// Loads all the plugins from a specific . /// /// The from the FindPlugin, FindPlugins or FindPluginsAsAsyncEnumerable method. /// The framework from the host application, optional.--> /// A builder function that allows you to modify the PluginLoadContext before loading the plugin<, optional./param> /// The plugin contract /// A list of fully loaded and usable plugins of type Task> LoadPlugins(AssemblyScanResult scanResult, string hostFramework = null, Action configure = null); #if SUPPORTS_ASYNC_STREAMS /// /// See /// This method returns an IAsyncEnumerable for you to use inside of an async foreach /// /// The from the FindPlugin, FindPlugins or FindPluginsAsAsyncEnumerable method. /// The framework from the host application, optional.--> /// A builder function that allows you to modify the PluginLoadContext before loading the plugin<, optional./param> /// The plugin contract /// An IAsyncEnumerable of fully loaded and usable plugins of type IAsyncEnumerable LoadPluginsAsAsyncEnumerable(AssemblyScanResult scanResult, string hostFramework = null, Action configure = null); #endif /// /// This method unloads all previously loaded plugins from this IPluginLoader /// /// Void void UnloadAll(); } }