An easy to use CFG/INI configuration library for .NET.
Comment
struct as obsolete, because it has been replaced by System.String
. The Comment
struct will be removed with the next release.Fixed a bug that caused pre-comments to only be split by Environment.NewLine
instead of \r\n
and \n
(issue #45).
This release focuses on a slightly simplified API, better documentation and a few bug fixes. Due to API changes, upgrading from a previous version may require code adjustment on your part. Loading existing configuration files however is still compatible and requires no changes.
Improved documentation, especially regarding what exceptions are thrown.
Removed the Comment
struct. Every occurrence of Comment
has been replaced by string
.
Config elements now only have a single pre-comment instead of a List<Comment>
.
# Comment Line 1
# Comment Line 2
[MySection]
When such a configuration is loaded, MySection's PreComment
property will return the value
"Comment Line 1\nComment Line 2"
. Such a value can also be set, respectively.
Configuration.Contains
overload that takes a section and setting name as parameters.
if (cfg.Contains("MySection") && cfg["MySection"].Contains("MySetting"))
if (cfg.Contains("MySection", "MySetting"))
Configuration.ValidCommentChars
. The only valid comment chars are #
and ;
.Configuration.PreferredCommentChar
property which dictates what char to use for comments when saving configurations. This may only be one of the valid comment chars.MySetting1 = { {1,2}, {3,4} } # Will be parsed as two elements {1,2} and {3,4}.
MySetting2 = { "1,2", "3,4" } # Will also be parsed as two elements "1,2" and "3,4".
MySetting3 = { "{1,2}", "{3,4}" } # Will also be parsed as two elements "{1,2}" and "{3,4}".
Configuration.Contains(Section)
now throws an ArgumentNullException if section
is null.Configuration.Contains(string)
now throws an ArgumentNullException if sectionName
is null.Section.Contains(Setting)
now throws an ArgumentNullException if setting
is null.Section.Contains(string)
now throws an ArgumentNullException if settingName
is null.This release features major bug fixes, stability and performance improvements. NOTE: this release removes all methods that were marked as obsolete in the previous version (1.5.6).
Fixed a bug that caused an ArgumentNullException to be thrown when loading empty configurations. (issue #29)