Skip to content

Manage data from a an INI file format the easy way!

License

Notifications You must be signed in to change notification settings

garrafote/ini-parser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INI File Parser

A Mono-compatible .NET library for reading/writing INI data from IO streams, file streams, and strings.

Build Status

Installation

The library is published to NuGet and can be installed on the command-line from the directory containing your solution.

> nuget install ini-parser

Or, from the Package Manager Console in Visual Studio

PM> Install-Package ini-parser

Or from the NuGet Package Manager extension built available for most flavors of Visual Studio!

Getting Started

INI data is stored in nested dictionaries, so accessing the value associated to a key in a section is straightforward. Load the data using one of the provided methods.

var data = parser.ReadFile("Configuration.ini");

Retrieve the value for a key inside of a named section. Values are always retrieved as strings.

var useFullScreen = data["UI"]["fullscreen"];

Modify the value in the dictionary, not the value retrieved, and save to a new file or overwrite.

data["UI"]["fullscreen"] = "true";
parser.WriteFile("Configuration.ini", data);

See the wiki for more usage examples.

## Contributing

Do you have an idea to improve this library, or did you happen to run into a bug. Please share your idea or the bug you found in the issues page, or even better: feel free to fork and contribute to this project!

Version 2.0!

Since the INI format isn't really a "standard", this version introduces a simpler way to customize INI parsing:

  • Pass a configuration object to an IniParser, specifying the behaviour of the parser. A default implementation is used if none is provided.

  • Derive from IniDataParser and override the fine-grained parsing methods.

About

Manage data from a an INI file format the easy way!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 98.7%
  • Other 1.3%