Hermod
A cross-platform, modular and fully GDPR-compliant email archival solution!
|
Handles the loading, unloading, and general management of plugins. More...
Package Functions | |
void | LoadPlugin (FileInfo pluginFile) |
Loads one or plugins from an Assembly on disk. | |
bool | IsAssembly (FileInfo pluginFile) |
Gets a value indicating whether or not a give file is a valid assembly or not. | |
bool | ContainsPlugins (Assembly assembly, out List< Type > pluginTypes) |
Gets a value indicating whether or not a given assembly contains members inheriting from IPlugin. | |
void | RegisterPlugin (ref Assembly assembly, Type type) |
Internally registers an IPlugin class and calls the IPlugin.OnLoad(Serilog.ILogger) method once loaded. | |
void | DeregisterPlugin (Assembly assembly, Type type) |
List< ICommand > | GetAllCommands () |
Gets a list containing all ICommand instances known to the application at the current time. | |
void | AddSubscription (IPlugin plugin, string topic) |
Adds a plugin to a topic subscription list. | |
void | RemoveSubscription (IPlugin plugin, string topic) |
Removes a plugin from a topic subscription list. | |
Properties | |
ILogger? | AppLogger = null [get, set] |
static PluginRegistry | Instance [get] |
Gets the current instance of this object. | |
List< IPlugin > | Plugins [get] |
Gets a list of all loaded IPlugin instances. | |
Dictionary< Assembly, Dictionary< Type, IPlugin > > | LoadedAssemblies = new Dictionary<Assembly, Dictionary<Type, IPlugin>>() [get] |
A Dictionary<Assembly, List<IPlugin>> containing all loaded assemblies and plugins contained within. | |
List< PluginDelegator > | PluginDelegators = new List<PluginDelegator>() [get] |
List< ICommand >? | BuiltInCommands = null [get, set] |
IPlugin? | LastRegisteredPlugin = null [get, set] |
Gets or sets the last IPlugin to be registered. | |
Dictionary< string, List< IPlugin > > | TopicSubscriptions = new Dictionary<string, List<IPlugin>>() [get] |
The topic subscription list. | |
Private Member Functions | |
PluginRegistry () | |
void | ConfigManager_ConfigLoaded (object? sender, ConfigLoadedEventArgs e) |
void | ConfigManager_ConfigChanged (object? sender, ConfigChangedEventArgs e) |
Assembly? | CurrentDomain_AssemblyResolve (object? sender, ResolveEventArgs args) |
Static Private Attributes | |
static ? PluginRegistry | _instance |
Handles the loading, unloading, and general management of plugins.
This class knows which plugins are loaded at any given time, can all any commands provided by the plugin and also fire events.
Definition at line 21 of file PluginRegistry.cs.
|
inlineprivate |
Definition at line 26 of file PluginRegistry.cs.
References Hermod.PluginFramework.PluginRegistry.ConfigManager_ConfigChanged(), Hermod.PluginFramework.PluginRegistry.ConfigManager_ConfigLoaded(), and Hermod.PluginFramework.PluginRegistry.CurrentDomain_AssemblyResolve().
|
inlinepackage |
Adds a plugin to a topic subscription list.
plugin | The plugin to add. |
topic | The topic to subscribe to. |
MalformedTopicException |
Definition at line 23 of file PluginRegistry.Delegation.cs.
References Hermod.PluginFramework.PluginRegistry.TopicSubscriptions.
Referenced by Hermod.PluginFramework.PluginDelegator.SubscribeTopics().
|
inlineprivate |
Definition at line 193 of file PluginRegistry.cs.
References Hermod.PluginFramework.PluginRegistry.Plugins.
Referenced by Hermod.PluginFramework.PluginRegistry.PluginRegistry().
|
inlineprivate |
Definition at line 187 of file PluginRegistry.cs.
References Hermod.PluginFramework.PluginRegistry.Plugins.
Referenced by Hermod.PluginFramework.PluginRegistry.PluginRegistry().
|
inlinepackage |
Gets a value indicating whether or not a given assembly contains members inheriting from IPlugin.
assembly | The Assembly to check in. |
pluginTypes | Out var; the list of Types inheriting from IPlugin contained within the assembly. |
Definition at line 116 of file PluginRegistry.cs.
Referenced by Hermod.PluginFramework.PluginRegistry.LoadPlugin().
|
inlineprivate |
Definition at line 199 of file PluginRegistry.cs.
References Hermod.PluginFramework.PluginRegistry.AppLogger.
Referenced by Hermod.PluginFramework.PluginRegistry.PluginRegistry().
|
inlinepackage |
Definition at line 171 of file PluginRegistry.cs.
References Hermod.PluginFramework.PluginRegistry.LoadedAssemblies, and Hermod.PluginFramework.PluginRegistry.PluginDelegators.
Referenced by Hermod.PluginFramework.PluginRegistry.RegisterPlugin().
|
inlinepackage |
Gets a list containing all ICommand instances known to the application at the current time.
Definition at line 232 of file PluginRegistry.cs.
References Hermod.PluginFramework.PluginRegistry.BuiltInCommands, and Hermod.PluginFramework.PluginRegistry.Plugins.
Referenced by Hermod.Hermod.GetAutocompletion(), and Hermod.Hermod.HandleDisplayCommandHelp().
|
inlinepackage |
Gets a value indicating whether or not a give file is a valid assembly or not.
pluginFile | The file to check for validity. |
Definition at line 98 of file PluginRegistry.cs.
Referenced by Hermod.PluginFramework.PluginRegistry.LoadPlugin().
|
inlinepackage |
Loads one or plugins from an Assembly on disk.
pluginFile | The file from which to load plugins. |
FileNotFoundException | If the file does not exist. |
NotAPluginException | If the given file is not a valid Assembly or does not contain instances off IPlugin or Plugin |
Definition at line 74 of file PluginRegistry.cs.
References Hermod.PluginFramework.PluginRegistry.AppLogger, Hermod.PluginFramework.PluginRegistry.ContainsPlugins(), Hermod.PluginFramework.PluginRegistry.IsAssembly(), and Hermod.PluginFramework.PluginRegistry.RegisterPlugin().
Referenced by Hermod.Hermod.HandleLoadPlugin(), and Hermod.Hermod.StartUp().
|
inlinepackage |
Internally registers an IPlugin class and calls the IPlugin.OnLoad(Serilog.ILogger) method once loaded.
assembly | The Assembly in which the plugin resides. |
type | The Type of the plugin. |
Definition at line 136 of file PluginRegistry.cs.
References Hermod.PluginFramework.PluginRegistry.AppLogger, Hermod.PluginFramework.PluginRegistry.DeregisterPlugin(), Hermod.PluginFramework.PluginRegistry.LastRegisteredPlugin, Hermod.PluginFramework.PluginRegistry.LoadedAssemblies, and Hermod.PluginFramework.PluginRegistry.PluginDelegators.
Referenced by Hermod.PluginFramework.PluginRegistry.LoadPlugin().
|
inlinepackage |
Removes a plugin from a topic subscription list.
plugin | The plugin to remove from the list. |
topic | The topic to unsubscribe the plugin from. |
MalformedTopicException | If the passed topic is invalid or malformed. |
Definition at line 44 of file PluginRegistry.Delegation.cs.
References Hermod.PluginFramework.PluginRegistry.TopicSubscriptions.
|
staticprivate |
Definition at line 32 of file PluginRegistry.cs.
|
getset |
Definition at line 23 of file PluginRegistry.cs.
Referenced by Hermod.PluginFramework.PluginRegistry.CurrentDomain_AssemblyResolve(), Hermod.PluginFramework.PluginRegistry.LoadPlugin(), and Hermod.PluginFramework.PluginRegistry.RegisterPlugin().
|
getsetpackage |
Definition at line 61 of file PluginRegistry.cs.
Referenced by Hermod.PluginFramework.PluginRegistry.GetAllCommands().
|
staticget |
Gets the current instance of this object.
Definition at line 37 of file PluginRegistry.cs.
Referenced by Hermod.Hermod.GetAutocompletion(), Hermod.Hermod.HandleDisplayCommandHelp(), Hermod.Hermod.HandleDisplayHelp(), Hermod.Hermod.HandleLoadPlugin(), Hermod.Hermod.StartUp(), Hermod.PluginFramework.PluginDelegator.SubscribeTopics(), and Hermod.Hermod.TryGetCommand().
|
getsetpackage |
Gets or sets the last IPlugin to be registered.
Definition at line 66 of file PluginRegistry.cs.
Referenced by Hermod.Hermod.HandleLoadPlugin(), and Hermod.PluginFramework.PluginRegistry.RegisterPlugin().
|
getpackage |
A Dictionary<Assembly, List<IPlugin>> containing all loaded assemblies and plugins contained within.
Definition at line 57 of file PluginRegistry.cs.
Referenced by Hermod.PluginFramework.PluginRegistry.DeregisterPlugin(), and Hermod.PluginFramework.PluginRegistry.RegisterPlugin().
|
getpackage |
Definition at line 59 of file PluginRegistry.cs.
Referenced by Hermod.PluginFramework.PluginRegistry.DeregisterPlugin(), and Hermod.PluginFramework.PluginRegistry.RegisterPlugin().
|
getpackage |
Gets a list of all loaded IPlugin instances.
Definition at line 43 of file PluginRegistry.cs.
Referenced by Hermod.PluginFramework.PluginRegistry.ConfigManager_ConfigChanged(), Hermod.PluginFramework.PluginRegistry.ConfigManager_ConfigLoaded(), Hermod.PluginFramework.PluginRegistry.GetAllCommands(), Hermod.Hermod.HandleDisplayHelp(), and Hermod.Hermod.TryGetCommand().
|
getpackage |
The topic subscription list.
Definition at line 15 of file PluginRegistry.Delegation.cs.
Referenced by Hermod.PluginFramework.PluginRegistry.AddSubscription(), and Hermod.PluginFramework.PluginRegistry.RemoveSubscription().