Interface IConfigProvider
An interface for configuration providers.
Namespace: IPA.Config
Assembly: IPA.Loader.dll
Syntax
public interface IConfigProvider
Remarks
Implementers must provide a default constructor. Do not assume that System.IO.File will ever be set for a given object.
Implementers are expected to preserve the typing of values passed to Store(Value, FileInfo) when returned from Load(FileInfo). The only exceptions to this are the numeric types, Integer and FloatingPoint, since they can be coerced to each other with AsFloat() and AsInteger() respectively. The provider should however store and recover Integer with as much precision as is possible. For example, a JSON provider may decide to decode all numbers that have an integral value, even if they were originally FloatingPoint, as Integer. This is reasonable, as Integer is more precise, particularly with larger values, than FloatingPoint.
Properties
| Improve this Doc View SourceExtension
Gets the extension without a dot to use for files handled by this provider.
Declaration
string Extension { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This must work immediately, and is used to generate the System.IO.FileInfo used to set System.IO.File.
Methods
| Improve this Doc View SourceLoad(FileInfo)
Loads a Value from disk in whatever format this provider provides and returns it.
Declaration
Value Load(FileInfo file)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileInfo | file | the file to read from |
Returns
Type | Description |
---|---|
Value | the Value loaded |
Store(Value, FileInfo)
Stores the Value given to disk in the format specified.
Declaration
void Store(Value value, FileInfo file)
Parameters
Type | Name | Description |
---|---|---|
Value | value | the Value to store |
System.IO.FileInfo | file | the file to write to |