Class PluginConfiguration
- Namespace
- SharpConsoleUI.Configuration
- Assembly
- SharpConsoleUI.dll
Configuration options for the plugin system in ConsoleWindowSystem.
public record PluginConfiguration : IEquatable<PluginConfiguration>
- Inheritance
-
PluginConfiguration
- Implements
- Inherited Members
Constructors
PluginConfiguration(bool, string?, bool, bool, string?)
Configuration options for the plugin system in ConsoleWindowSystem.
public PluginConfiguration(bool AutoLoad = false, string? PluginsDirectory = null, bool SearchSubdirectories = true, bool FailOnLoadError = false, string? LoadOnlyPluginPattern = null)
Parameters
AutoLoadboolWhether to automatically load plugins from the plugins directory on startup. Defaults to false for security and performance reasons.
PluginsDirectorystringPath to the directory containing plugin DLLs. Can be absolute or relative to the application's base directory. If null, uses the default "plugins" directory.
SearchSubdirectoriesboolWhether to search subdirectories when auto-loading plugins. Defaults to true to support organized plugin structures.
FailOnLoadErrorboolWhether to throw an exception if a plugin fails to load during auto-load. If false, failed plugins are logged and skipped. Defaults to false for resilience.
LoadOnlyPluginPatternstringOptional file pattern to filter which DLLs are loaded (e.g., "*.Plugin.dll"). If null, all DLLs in the plugins directory are scanned. Defaults to null.
Properties
AutoLoad
Whether to automatically load plugins from the plugins directory on startup. Defaults to false for security and performance reasons.
public bool AutoLoad { get; init; }
Property Value
AutoLoadDefault
Configuration with auto-loading enabled from the default "plugins" directory.
public static PluginConfiguration AutoLoadDefault { get; }
Property Value
AutoLoadStrict
Configuration for auto-loading with strict error handling (throws on load failure).
public static PluginConfiguration AutoLoadStrict { get; }
Property Value
Default
Default configuration with auto-loading disabled (safest option).
public static PluginConfiguration Default { get; }
Property Value
FailOnLoadError
Whether to throw an exception if a plugin fails to load during auto-load. If false, failed plugins are logged and skipped. Defaults to false for resilience.
public bool FailOnLoadError { get; init; }
Property Value
LoadOnlyPluginPattern
Optional file pattern to filter which DLLs are loaded (e.g., "*.Plugin.dll"). If null, all DLLs in the plugins directory are scanned. Defaults to null.
public string? LoadOnlyPluginPattern { get; init; }
Property Value
PluginsDirectory
Path to the directory containing plugin DLLs. Can be absolute or relative to the application's base directory. If null, uses the default "plugins" directory.
public string? PluginsDirectory { get; init; }
Property Value
SearchSubdirectories
Whether to search subdirectories when auto-loading plugins. Defaults to true to support organized plugin structures.
public bool SearchSubdirectories { get; init; }
Property Value
Methods
AutoLoadFrom(string)
Configuration for auto-loading from a custom directory.
public static PluginConfiguration AutoLoadFrom(string pluginsDirectory)
Parameters
pluginsDirectorystringCustom plugins directory path
Returns
- PluginConfiguration
Configuration with auto-loading enabled
GetEffectivePluginsDirectory()
Gets the effective plugins directory path, resolving relative paths and using the default "plugins" directory if not specified.
public string GetEffectivePluginsDirectory()
Returns
- string
Absolute path to the plugins directory