Class Config
A class to handle updating ConfigProviders automatically
Inherited Members
Namespace: IPA.Config
Assembly: IPA.Loader.dll
Syntax
public static class Config
Methods
| Improve this Doc View SourceGetProviderFor(String, String[])
Gets an IConfigProvider using the specified list of preferred config types.
Declaration
public static IConfigProvider GetProviderFor(string configName, params string[] extensions)
Parameters
Type | Name | Description |
---|---|---|
String | configName | the name of the mod for this config |
String[] | extensions | the preferred config types to try to get |
Returns
Type | Description |
---|---|
IConfigProvider | an IConfigProvider of the requested type, or of type JSON. |
MakeLink<T>(IConfigProvider, Action<IConfigProvider, Ref<T>>)
Creates a linked Ref<T> for the config provider. This Ref<T> will be automatically updated whenever the file on-disk changes.
Declaration
public static Ref<T> MakeLink<T>(this IConfigProvider config, Action<IConfigProvider, Ref<T>> onChange = null)
Parameters
Type | Name | Description |
---|---|---|
IConfigProvider | config | the IConfigProvider to create a link to |
Action<IConfigProvider, Ref<T>> | onChange | an action to perform on value change |
Returns
Type | Description |
---|---|
Ref<T> | a Ref<T> to an ever-changing value, mirroring whatever the file contains. |
Type Parameters
Name | Description |
---|---|
T | the type of the parsed value |
Register(Type)
Registers a IConfigProvider to use for configs.
Declaration
public static void Register(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | the type to register |
Register<T>()
Registers a IConfigProvider to use for configs.
Declaration
public static void Register<T>()
where T : IConfigProvider
Type Parameters
Name | Description |
---|---|
T | the type to register |
RemoveLinks(IConfigProvider)
Removes all linked Ref<T> such that they are no longer updated.
Declaration
public static void RemoveLinks(this IConfigProvider config)
Parameters
Type | Name | Description |
---|---|---|
IConfigProvider | config | the IConfigProvider to unlink |