-
Notifications
You must be signed in to change notification settings - Fork 0
How does library work?
For given configuration class:
public struct TestConfiguration
{
public string TestString { get; set; }
public List<int> TestIntList { get; set; }
}
IniWrapper will call IIniParser with following ini parameters Section : TestConfiguration, Key : TestString, Value : value in TestString property.
Overall rules:
- Section is evaluated from class / struct name
- Key is evaluated from property / field name
- Value is taken from property / field value
Exception is for IDictionary type:
- Section is evaluated from property / field name
- Key is taken from Key (from IDictionary)
- Value is taken from Value (from IDictionary)
For complex types for example:
public class ComplexTestConfiguration
{
public TestConfiguration TestConfiguration { get; set; }
}
public struct TestConfiguration
{
public string TestString { get; set; }
public List<int> TestIntList { get; set; }
}
IniWrapper will call IIniParser with following ini parameters Section : TestConfiguration, Key : TestString, Value : value in TestString. It will be the same as writing / reading directly TestConfiguration class.
Library will add _index postfix to section (e.g TestConfiguration_0, TestConfiguration_1). While reading library calls IniParser.Read(Section, null) method with null key to check if section exists if not library stops reading. If you are using custom parser make sure that this calls return not null and not empty value for existing sections.