NeoIni 3.2.2
See the version list below for details.
dotnet add package NeoIni --version 3.2.2
NuGet\Install-Package NeoIni -Version 3.2.2
<PackageReference Include="NeoIni" Version="3.2.2" />
<PackageVersion Include="NeoIni" Version="3.2.2" />
<PackageReference Include="NeoIni" />
paket add NeoIni --version 3.2.2
#r "nuget: NeoIni, 3.2.2"
#:package NeoIni@3.2.2
#addin nuget:?package=NeoIni&version=3.2.2
#tool nuget:?package=NeoIni&version=3.2.2
π Documentation & Wiki β detailed guides, API reference, and examples
NeoIni
Secure, thread-safe INI configuration library for .NET with built-in integrity checking, AES-256 encryption, and a pluggable provider architecture.
dotnet add package NeoIni
- Package: nuget.org/packages/NeoIni
- Version: 3.2.2 | .NET 6+ | .NET Standard 2.0
- Developer: Lonewolf239
Features
| Feature | Details | |
|---|---|---|
| π | AES-256 encryption | Transparent file-level encryption (CBC, IV + per-file salt). Key derived from user environment or a custom password. |
| π‘οΈ | SHA-256 checksum | Integrity validation on every load/save. On mismatch β ChecksumMismatch event + automatic .backup fallback. |
| π | Thread-safe | AsyncReaderWriterLock protects all read/write operations under concurrent access with full async/await support. |
| π¦ | Typed Get/Set | Read and write bool, int, double, DateTime, enum, string and more with automatic parsing and defaults. |
| β‘ | AutoSave & AutoBackup | Automatic saving after N operations. Atomic writes via .tmp + .backup fallback on errors. |
| π | Hot-reload | File watcher with polling and checksum comparison β live config updates without restart. |
| π§© | Pluggable providers | INeoIniProvider interface β store configs in a database, remote service, memory, or any custom backend. |
| πΊοΈ | Object mapping | Source-generated Get<T>() / Set<T>() for POCO classes via NeoIniKeyAttribute. |
| βοΈ | Human-editable mode | Preserve comments and formatting for hand-edited INI files (no checksum, no encryption). |
| π‘ | Full async API | Async versions for all major operations β CreateAsync, GetValueAsync, SaveFileAsync, etc. |
| π | Search & TryGet | Case-insensitive search across keys/values. TryGetValue<T> reads without modifying the file. |
| π’ | Rich event system | 14 events: save, load, key/section CRUD, autosave, checksum mismatch, errors, search completion. |
| π | Easy migration | Transfer encrypted configs between machines via GetEncryptionPassword(). |
| π¦ | Black-box design | Single entrypoint β NeoIniDocument owns and manages everything behind a clean public API. |
Quick Start
Creating an instance
using NeoIni;
// Plain
NeoIniDocument document = new("config.ini");
// Auto-encryption (machine-bound)
NeoIniDocument encrypted = new("config.ini", EncryptionType.Auto);
// Custom password (portable between machines)
NeoIniDocument portable = new("config.ini", "MySecretPass123");
// Async
NeoIniDocument document = await NeoIniDocument.CreateAsync("config.ini", cancellationToken: ct);
Reading & writing values
// Write
document.SetValue("Database", "Host", "localhost");
document.SetValue("Database", "Port", 5432);
// Read with typed defaults
string host = document.GetValue("Database", "Host", "127.0.0.1");
int port = document.GetValue("Database", "Port", 3306);
// Read without side effects (no AutoAdd, no file modification)
int level = document.TryGetValue("Game", "Level", 1);
// Async
await document.SetValueAsync("Database", "Host", "localhost");
string host = await document.GetValueAsync("Database", "Host", "127.0.0.1", ct);
- Missing sections/keys return
defaultValue; withUseAutoAddenabled the key is created automatically. - Supports
enum,DateTime, and anyIConvertibletype via invariant-culture parsing.
Section & key management
document.AddSection("Cache");
document.RemoveKey("Cache", "OldKey");
document.RenameSection("Cache", "AppCache");
string[] sections = document.GetAllSections();
string[] keys = document.GetAllKeys("AppCache");
bool exists = document.SectionExists("AppCache");
Search
var results = document.Search("token");
foreach (var r in results)
Console.WriteLine($"[{r.Section}] {r.Key} = {r.Value}");
File operations
document.SaveFile();
document.Reload();
document.DeleteFile();
document.DeleteFileWithData();
Options & presets
document.UseAutoSave = true;
document.AutoSaveInterval = 3; // save every 3 writes
document.UseAutoBackup = true;
document.UseAutoAdd = true;
document.UseChecksum = true;
document.SaveOnDispose = true;
document.AllowEmptyValues = true;
Or use built-in presets: NeoIniOptions.Default, Safe, Performance, ReadOnly, BufferedAutoSave(n).
Events
document.Saved += (_, _) => Console.WriteLine("Saved");
document.Loaded += (_, _) => Console.WriteLine("Loaded");
document.KeyChanged += (_, e) => Console.WriteLine($"[{e.Section}] {e.Key} β {e.Value}");
document.KeyAdded += (_, e) => Console.WriteLine($"[{e.Section}] +{e.Key}");
document.ChecksumMismatch += (_, _) => Console.WriteLine("Checksum mismatch!");
document.Error += (_, e) => Console.WriteLine($"Error: {e.Exception.Message}");
Encryption & migration
// Auto-encryption β key is derived from user/machine/domain + per-file salt
NeoIniDocument document = new("secure.ini", EncryptionType.Auto);
// Retrieve password to migrate to another machine
string password = document.GetEncryptionPassword();
// On the new machine
NeoIniDocument migrated = new("secure.ini", password);
Disposal
using NeoIniDocument document = new("config.ini");
// SaveFile() is called automatically if SaveOnDispose is true
// After disposal β ObjectDisposedException on any access
Advanced Features
- Attribute-based mapping & source generator (1.7+) β detailed guide
- Hot-reload (1.7.1+) β usage & caveats
- Human-editable INI mode (1.7.2+) β experimental mode
- Pluggable provider abstraction (1.7.3+) β custom providers
- Pluggable encryption (2.0+) β custom encryption providers
API Reference
Full method, options, and event reference β API.md
Philosophy
Black Box Design β all internal logic is hidden behind the simple public API of NeoIniDocument. You work only with methods and events, without thinking about implementation details. NeoIni config files are owned and managed by the library; human comments are intentionally not preserved in standard mode (the in-file warning header signals this). For hand-edited configs, use Human-editable mode.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.