Class ConfigManagerFactory
- Namespace
- AetherUtils.Core.Configuration
- Assembly
- AetherUtils.Core.dll
Factory for creating and initializing configuration managers that optionally apply default values using a
custom DTO configuration class and/or a
custom ConfigManager<T> config manager class.
public static class ConfigManagerFactory
- Inheritance
-
ConfigManagerFactory
- Inherited Members
Methods
CreateAndLoadAsync<TConfig>(string, bool)
Asynchronously creates and loads a config manager using the built-in ConfigManager<T> implementation, optionally applying default values.
[UsedImplicitly]
public static Task<ConfigManager<TConfig>> CreateAndLoadAsync<TConfig>(string path, bool applyAndSaveDefaults = false) where TConfig : class, new()
Parameters
pathstring- The configuration file path.
applyAndSaveDefaultsbool- If true, will save the config back to disk after loading and applying defaults.
Returns
- Task<ConfigManager<TConfig>>
- An initialized config manager with defaults applied, or null if loading failed.
Type Parameters
TConfig- The config DTO type.
CreateAndLoadAsync<TConfig, TManager>(string, bool)
Asynchronously creates and loads a config manager of the specified type, optionally applying defaults.
[UsedImplicitly]
public static Task<TManager> CreateAndLoadAsync<TConfig, TManager>(string path, bool applyAndSaveDefaults = false) where TConfig : class, new() where TManager : ConfigManager<TConfig>, new()
Parameters
pathstring- The configuration file path.
applyAndSaveDefaultsbool- If true, will save the config back to disk after loading and applying defaults.
Returns
- Task<TManager>
- A task that returns an initialized config manager with defaults applied, or null if loading failed.
Type Parameters
TConfig- The config DTO type.
TManager- The concrete ConfigManager<T> implementation type.
CreateAndLoad<TConfig>(string, bool)
Creates and loads a config manager using the built-in ConfigManager<T> implementation, optionally applying default values.
[UsedImplicitly]
public static ConfigManager<TConfig> CreateAndLoad<TConfig>(string path, bool applyAndSaveDefaults = false) where TConfig : class, new()
Parameters
pathstring- The configuration file path.
applyAndSaveDefaultsbool- If true, will save the config back to disk after loading and applying defaults.
Returns
- ConfigManager<TConfig>
- An initialized config manager with defaults applied, or null if loading failed.
Type Parameters
TConfig- The config DTO type.
CreateAndLoad<TConfig, TManager>(string, bool)
Creates and loads a config manager of the specified type, optionally applying default values.
[UsedImplicitly]
public static TManager CreateAndLoad<TConfig, TManager>(string path, bool applyAndSaveDefaults = false) where TConfig : class, new() where TManager : ConfigManager<TConfig>, new()
Parameters
pathstring- The configuration file path.
applyAndSaveDefaultsbool- If true, will save the config back to disk after loading and applying defaults.
Returns
- TManager
- An initialized config manager with defaults applied, or null if loading failed.
Type Parameters
TConfig- The config DTO type.
TManager- The concrete ConfigManager<T> implementation type.