MadMilkman.Ini is a .NET component which simplifies processing of INI files and requires only a minimum .NET Framework version 2.0. It is 100% managed code (C#), compatible with Mono framework, which provides an easy to use programming interface.
- Enables reading and writing of various INI file formats.
- Enables easy manipulation of INI file's content.
- Enables copying and merging multiple INI file's contents.
- Enables encrypting and decrypting INI files.
- Enables compressing and decompressing INI files.
- Enables serializing and deserializing custom types into an INI content.
You can use this component in any way that suits you:
- As private assembly by adding MadMilkman.Ini.dll inside your project.
- As shared assembly by installing MadMilkman.Ini.Setup.msi.
- As package via NuGet:
PM> Install-Package MadMilkman.Ini
- Create new .NET project.
- Add new reference to MadMilkman.Ini.dll.
- Add MadMilkman.Ini namespace.
- C# -
- VB.NET -
- C++/CLI -
using namespace MadMilkman::Ini;
- Write some INI files processing code.
- Use code samples located in MadMilkman.Ini.Samples, written in C#, VB.NET and C++/CLI as starting point.
- Read MadMilkman.Ini.Documentation.chm to learn more about the component and its API references.
Feedback & Support:
Please feel free to contact me with any questions, suggestions or issues regarding the MadMilkman.Ini component, I will be more than happy to provide a help. Also if you found the component useful or useless I would be interested in hearing about it.
MadMilkman.Ini provides a simple and intuitive programming interface which makes it very easy to create new or process existing INI files. Because INI file format is loosely defined and has no real standard, different files can have different format. By default MadMilkman.Ini processes the following format (however it is possible to define a custom formatting via IniOptions class):
;Section trailing comment [Section name] Key name = Key value ;Key leading comment
// Create new file with a default formatting. IniFile file = new IniFile(); // Add new section. IniSection section = file.Sections.Add("Section name"); // Add trailing comment. section.TrailingComment.Text = "Section trailing comment"; // Add new key and its value. IniKey key = section.Keys.Add("Key name", "Key value "); // Add leading comment. key.LeadingComment.Text = "Key leading comment"; // Save file. file.Save("Sample.ini");
' Create new file with a default formatting. Dim file As New IniFile() ' Add new section. Dim section As IniSection = file.Sections.Add("Section name") ' Add trailing comment. section.TrailingComment.Text = "Section trailing comment" ' Add new key and its value. Dim key As IniKey = section.Keys.Add("Key name", "Key value ") ' Add leading comment. key.LeadingComment.Text = "Key leading comment" ' Save file. file.Save("Sample.ini")
// Create new file with a default formatting. IniFile^ file = gcnew IniFile(); // Add new section. IniSection^ section = file->Sections->Add("Section name"); // Add trailing comment. section->TrailingComment->Text = "Section trailing comment"; // Add new key and its value. IniKey^ key = section->Keys->Add("Key name", "Key value "); // Add leading comment. key->LeadingComment->Text = "Key leading comment"; // Save file. file->Save("Sample.ini");
Compression feature enables you to reduce INI file's size.
Encryption feature enables you to protect INI file by providing an encryption password.
Parsing feature enables you to retrieve the key's value as an instance of a specific type via key's TryParseValue method, all currently supported types are listed in key's IsSupportedValueType method remarks.
Binding feature enables you to define placeholders inside a key's value which can be binded (replaced) with an internal or external data source via Bind() method.
Serialization feature enables you to serialize an object into section's keys.
More details can be found in MadMilkman.Ini.Documentation.chm.