EasyConfig is a simple configuration file parsing library.
EasyConfig supports files that follow the following format:
{GroupName}
name = value
Configuration files consist of one or more groups designated by using the [] brackets with a name inside. Each group consists of one or more settings. A setting is set up as a name and a value separated by an equals sign (=).
Setting values can be integers, floating point numbers, booleans, or strings. Strings are designated with quotes like the following:
aStringSetting = "SomeString"
Booleans can be set using any of the following: on, off, true, false, yes, no. Booleans are also not case sensitive so the following works:
aBoolSetting = yEs
Settings can also be arrays which are defined simply by using a comma-separated list of values of the same type. You could make an array of booleans like so:
aBoolArray = no, yes, false, true, on, off, off
EasyConfig parses these files and converts all the groups and settings into easy to navigate classes for easy access to these properties in your application without you having to manually parse the files. The following is a sample of how to parse a window size for an XNA game:
(The configuration file:)
{Video}
Width = 1280
Height = 720
(The code:)
{graphics.PreferredBackBufferWidth = config.SettingGroups"Video".Settings"Width".GetValueAsInt();}
{graphics.PreferredBackBufferHeight = config.SettingGroups"Video".Settings"Height".GetValueAsInt();}
graphics.ApplyChanges();
EasyConfig is open source and licensed under the MIT License. Feel free to use EasyConfig however you would like so long as you credit me (Nick Gravelyn) with creating EasyConfig.
EasyConfig supports files that follow the following format:
{GroupName}
name = value
Configuration files consist of one or more groups designated by using the [] brackets with a name inside. Each group consists of one or more settings. A setting is set up as a name and a value separated by an equals sign (=).
Setting values can be integers, floating point numbers, booleans, or strings. Strings are designated with quotes like the following:
aStringSetting = "SomeString"
Booleans can be set using any of the following: on, off, true, false, yes, no. Booleans are also not case sensitive so the following works:
aBoolSetting = yEs
Settings can also be arrays which are defined simply by using a comma-separated list of values of the same type. You could make an array of booleans like so:
aBoolArray = no, yes, false, true, on, off, off
EasyConfig parses these files and converts all the groups and settings into easy to navigate classes for easy access to these properties in your application without you having to manually parse the files. The following is a sample of how to parse a window size for an XNA game:
(The configuration file:)
{Video}
Width = 1280
Height = 720
(The code:)
{graphics.PreferredBackBufferWidth = config.SettingGroups"Video".Settings"Width".GetValueAsInt();}
{graphics.PreferredBackBufferHeight = config.SettingGroups"Video".Settings"Height".GetValueAsInt();}
graphics.ApplyChanges();
EasyConfig is open source and licensed under the MIT License. Feel free to use EasyConfig however you would like so long as you credit me (Nick Gravelyn) with creating EasyConfig.