IPluginConfigurationService
Interfacepublic interface IPluginConfigurationServiceProperties
Whether the base path exists in the file system.
bool BasePathExists { get; }Get the configuration root.
IConfigurationManager Manager { get; }Methods
Configure the internal configuration manager.
IPluginConfigurationService Configure(Action<IConfigurationBuilder> configure)- configureAction<IConfigurationBuilder>The action to configure the configuration manager.
Get the path to the configuration file.
string GetConfigPath(string name)- namestringThe name of the configuration file, including the extension.
Initialize the json configuration file with a class as template. When the file name ends with .jsonc , properties and fields marked with DescriptionAttribute are written with their description as // comment lines above the key, including members of nested objects, list items and dictionary values. A .json file is always written as plain JSON, since comments are not valid JSON.
IPluginConfigurationService InitializeJsonWithModel<T>(string name, string sectionName) where T : class, new()Initialize the json configuration file with a class as template. Behaves like String) when the file does not exist yet. When the file exists and addMissingKeys is true , keys present in the model but missing from the file are inserted with their default value, including keys of nested objects. In a .jsonc file each inserted key gets its DescriptionAttribute as // comment lines above it. The rest of the file, including existing values, comments and formatting, is left untouched. Dictionary entries and list items are never added. Keys are matched case-insensitively, the same way the configuration binder reads them. A file that is not valid JSON is not changed.
IPluginConfigurationService InitializeJsonWithModel<T>(string name, string sectionName, bool addMissingKeys) where T : class, new()Initialize the TOML configuration file with a class as template. Properties and fields marked with DescriptionAttribute are written with their description as # comment lines above the key or above the table header. Members of inline tables cannot carry comments.
IPluginConfigurationService InitializeTomlWithModel<T>(string name, string sectionName) where T : class, new()Initialize the TOML configuration file with a class as template. Behaves like String) when the file does not exist yet. When the file exists and addMissingKeys is true , keys present in the model but missing from an existing table are inserted after the table's last value, and tables missing from the file are appended at its end, each with its DescriptionAttribute as # comment lines. The rest of the file, including existing values, comments and formatting, is left untouched. Members of inline tables and entries of table arrays are never added. Keys are matched case-insensitively, the same way the configuration binder reads them. A file that is not valid TOML is not changed.
IPluginConfigurationService InitializeTomlWithModel<T>(string name, string sectionName, bool addMissingKeys) where T : class, new()Initialize the configuration file with a template. To use this, you must package a templates folder in the plugin, with the template file in it.
IPluginConfigurationService InitializeWithTemplate(string name, string templateName)