bash / broccolini

A non-destructive parser for INI files compatible with `GetPrivateProfileString`
https://broccolini.tau.garden/
MIT License
2 stars 2 forks source link
csharp dotnet-standard getprivateprofilestring ini ini-parser

Broccolini 🥦

Build NuGet package

Broccolini is a non-destructive parser for INI files. The main goal is compatibility with the INI format used in Windows OS (GetPrivateProfileString and friends).

Usage

INI file used in examples ```ini [database] server = 192.0.2.62 port = 1234 ```

Reading

var document = IniParser.ParseToSemanticModel(File.ReadAllText("config.ini"));
string databaseServer = document["database"]["server"];
string databasePort = document["database"]["port"];

Editing

var document = IniParser.Parse(File.ReadAllText("config.ini"));
var updated = document
    .WithSection("owner", section => section.WithKeyValue("name", "John Doe"))
    .UpdateSection("database", section => section.RemoveKeyValue("port"));
File.WriteAllText("config.ini", updated.ToString(), Encoding.Unicode);

Stability

This library is feature-complete and stable. Contributions are welcome, please create an issue first for discussion.

Known Differences

While Broccolini tries to replicate most of the behaviour found in the Windows APIs, there are still some intentional differences:

Goals

Non-Goals

License

Licensed under the MIT license (license-mit.txt or http://opensource.org/licenses/MIT).

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.