Hermod
A cross-platform, modular and fully GDPR-compliant email archival solution!
|
The main application class. More...
Public Member Functions | |
Hermod (ConfigManager configManager, ILogger logger) | |
Main constructor; initialises the object. | |
Package Functions | |
void | StartUp () |
async Task< int > | Execute () |
Executes the main business logic of the application. | |
void | ShutDown () |
Shuts Hermod down. | |
void | SetTerminalTitle () |
Sets the terminal's title. | |
Package Attributes | |
volatile bool | m_keepAlive |
The application's logger instance. | |
Properties | |
List< ICommand > | Commands [get] |
bool | InteractiveMode [get, set] |
Private Member Functions | |
bool | TryGetCommand (string cmdName, out ICommand? outCommand) |
ICommandResult | HandleDisplayHelp (params string[] args) |
ICommandResult | HandleDisplayCommandHelp (string arg) |
ICommandResult | HandleLoadPlugin (params string[] args) |
ICommandResult | HandleUnloadPlugin (params string[] args) |
ICommandResult | HandleGetPlugins (params string[] args) |
string? | ShowPrompt () |
Displays the input prompt. | |
string? | GetAutocompletion (string input, int maxDistance=2) |
Attempts to get an auto completed string for the user's input. | |
int | LevenshteinDistance (string haystack, string needle) |
void | Console_CancelKeyPress (object? sender, ConsoleCancelEventArgs e) |
Handles SIGINT (CTRL+C) | |
void | ConsoleWrite (string message) |
void | ConsoleErrorWrite (string message) |
Private Attributes | |
Stack< string > | m_previousCommands = new Stack<string>() |
ConfigManager | m_configManager |
ILogger | m_appLogger |
The ConfigManager instance for the application and first-party plugins. | |
CancellationTokenSource | m_inputCancellationToken |
A volatile bool indicating whether or not to keep the application alive. | |
List< ICommand >? | m_commands = null |
CancellationTokenSource for reading input from the console in interactive mode. | |
readonly object | m_consoleLock |
A list of built-in commands. | |
The main application class.
This class handles all the main logic within the application, such as timing operations, executing commands, handling user input, etc.
Definition at line 11 of file Hermod.Commands.cs.
|
inline |
Main constructor; initialises the object.
configManager | The application-wide config instance. |
logger | The application logger. |
Definition at line 30 of file Hermod.cs.
|
inlineprivate |
Handles SIGINT (CTRL+C)
sender | |
e |
Definition at line 239 of file Hermod.cs.
|
inlineprivate |
Definition at line 260 of file Hermod.cs.
|
inlineprivate |
|
inlinepackage |
Executes the main business logic of the application.
Definition at line 67 of file Hermod.cs.
|
inlineprivate |
Attempts to get an auto completed string for the user's input.
input | The current input in the interactive prompt. |
maxDistance | The max levenshtein distance for the string to match. |
Definition at line 176 of file Hermod.cs.
References Hermod.PluginFramework.PluginRegistry.GetAllCommands(), and Hermod.PluginFramework.PluginRegistry.Instance.
|
inlineprivate |
Definition at line 100 of file Hermod.Commands.cs.
References Hermod.PluginFramework.PluginRegistry.GetAllCommands(), and Hermod.PluginFramework.PluginRegistry.Instance.
|
inlineprivate |
Definition at line 72 of file Hermod.Commands.cs.
References Hermod.PluginFramework.PluginRegistry.Instance, and Hermod.PluginFramework.PluginRegistry.Plugins.
|
inlineprivate |
Definition at line 138 of file Hermod.Commands.cs.
|
inlineprivate |
Definition at line 111 of file Hermod.Commands.cs.
References Hermod.PluginFramework.PluginRegistry.Instance, Hermod.PluginFramework.PluginRegistry.LastRegisteredPlugin, Hermod.PluginFramework.PluginRegistry.LoadPlugin(), and Hermod.PluginFramework.IPlugin.OnStart().
|
inlineprivate |
Definition at line 134 of file Hermod.Commands.cs.
|
inlineprivate |
Definition at line 186 of file Hermod.cs.
|
inlinepackage |
Sets the terminal's title.
Definition at line 225 of file Hermod.cs.
|
inlineprivate |
Displays the input prompt.
Definition at line 111 of file Hermod.cs.
|
inlinepackage |
|
inlinepackage |
Definition at line 39 of file Hermod.cs.
References Hermod.PluginFramework.PluginRegistry.Instance, and Hermod.PluginFramework.PluginRegistry.LoadPlugin().
|
inlineprivate |
Definition at line 13 of file Hermod.Commands.cs.
References Hermod.PluginFramework.PluginRegistry.Instance, Hermod.Core.Commands.ICommand< T >.Name, and Hermod.PluginFramework.PluginRegistry.Plugins.
|
private |
The ConfigManager instance for the application and first-party plugins.
Definition at line 15 of file Hermod.Members.cs.
|
private |
CancellationTokenSource for reading input from the console in interactive mode.
Definition at line 21 of file Hermod.Members.cs.
|
private |
Definition at line 14 of file Hermod.Members.cs.
|
private |
A list of built-in commands.
Definition at line 23 of file Hermod.Members.cs.
|
private |
A volatile bool indicating whether or not to keep the application alive.
Definition at line 19 of file Hermod.Members.cs.
|
package |
The application's logger instance.
Definition at line 17 of file Hermod.Members.cs.
|
private |
|
getprivate |
Definition at line 32 of file Hermod.Commands.cs.
|
getset |