Releases: JeevanJames/IniFile
v1.6.0
Change log
- [#10] Added support for the C# 6 null conditional operator by changing the
Ini
indexer to returnnull
if the section is not found, instead of throwing theKeyNotFoundException
.
// Earlier code
string value = ini.TryGetValue("section", out var section) ? section["property"] : null;
if (value == null)
// Section does not exist
// With C# 6 null conditional operator
string value = ini["section"]?["property"];
if (value == null)
// Section does not exist
// Alternate non-C# 6 approach
var section = ini["section"];
string value = section != null ? section["property"] : null;
if (value == null)
// Section does not exist
v1.5.1
Bug fixes
- Fix null reference exceptions when loading files from the
Ini
constructors.
v1.5.0
Change log
-
Added support for reading and writing property values as date/times.
- Added configuration to control the formatting of date/time values.
-
The
AsEnum
method now accepts an optional booleancaseSensitive
parameter to indicate whether the property value should be case sensitive when reading as an enum. The default isfalse
. -
Added support for reading multiline property values when loading INI content. This compliments the existing support for writing multiline property values.
v1.4.0
Change log
- Added support for writing UNIX-style multi-line property values. However, there is currently no support for reading multi-line values.
Property = <<EOT
This is a multi line property.
Here is another line.
EOT
-
Added support for typed property values, with read/write support for booleans, integral numbers, floating-point numbers and strings, and read-only support for enums.
-
Added
netstandard2.0
target. -
Updated exception messages to be more detailed.
Low impact breaking changes
Due to the addition of typed property values, string property values will be returned as type PropertyValue
instead of string
, if the variable is implicitly declared using var
.
// In previous versions, str will be a string
var str = section["Some String"];
// In this new version, str will be a PropertyValue
var str = section["Some String"];
// Explicitly specify variable type to avoid this issue
string str = section["Some String"];
v1.3.0
Change log
-
New global configuration option added using the
Ini.Config
property.- Configs to allow the hash symbol (
#
) to be used to prefix a comment. - Configs to globally set the padding defaults for sections, properties and comments.
- Configs to allow the hash symbol (
-
Added support for .NET 3.5, .NET 4.0 and .NET 4.5 targets.
-
Reduced the netstandard level from
netstandard20
tonetstandard1.3
to support a wider range of platforms. -
Section and property names now allow more characters such as
:
,#
,.
,~
and$
.
v1.2.0
Change log
- [Bug fix] - The
Property
constructor was not assigning theValue
property. This has been fixed.
Low impact breaking changes
- The
Section
andProperty
constructors have been changed from accepting a list ofMinorIniItem
objects (Comment
andBlankLine
) to a list ofstring
s. Empty or whitespace strings andnull
values are mapped toBlankLine
objects and all remaining strings are mapped toComment
objects.
v1.1.0
Change log
- Property and Section constructors now optionally accept an initial set of comments and blank lines.
- Changes to INI formatting (
Ini.Format
)- Formatting removes any trailing blank lines.
- Added new
IniFormatOptions
class to specify optional formatting rules for theIni.Format
method. - Formatting options to insert blank lines between sections and properties.
- Formatting option to remove successive blank lines.
Low impact breaking change
- Removed Left property from
Padding
class as it is not used by theBlankLine
class. Instead, theLeft
property has been added to the specific padding classes -SectionPadding
,PropertyPadding
andCommentPadding
.