NeoIniLib 1.5.4.1

Suggested Alternatives

NeoIni

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package NeoIniLib --version 1.5.4.1
                    
NuGet\Install-Package NeoIniLib -Version 1.5.4.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NeoIniLib" Version="1.5.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NeoIniLib" Version="1.5.4.1" />
                    
Directory.Packages.props
<PackageReference Include="NeoIniLib" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NeoIniLib --version 1.5.4.1
                    
#r "nuget: NeoIniLib, 1.5.4.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NeoIniLib@1.5.4.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NeoIniLib&version=1.5.4.1
                    
Install as a Cake Addin
#tool nuget:?package=NeoIniLib&version=1.5.4.1
                    
Install as a Cake Tool

NeoIni

NeoIni is a C# class for working with INI files. It provides secure, thread-safe methods for creating, reading, and modifying INI files with built-in checksum validation and optional AES encryption.

Installation

dotnet add package NeoIni

Package: nuget.org/packages/NeoIni
Version: 1.5.4 | .NET 8+

Features

  • Read and parse typed values (bool, int, float, double, string, etc.) from INI files
  • Automatic type detection and parsing with fallback to default values
  • Thread-safe operations using locks
  • Automatic file saving and section/key creation (configurable via AutoSave and AutoAdd)
  • Built-in checksum validation (SHA256) for data integrity
  • Optional AES-256 encryption with user-specific password generation
  • Support for standard INI format with sections and key-value pairs
  • Full async method support for all operations
  • Automatic directory creation and file initialization

Target Framework

.NET 8+

Usage

Creating a NeoIni Instance

NeoIni reader = new("config.ini");                   // Standard usage
NeoIni encryptedReader = new("config.ini", true);    // With auto-encryption

Reading Values

string text = reader.GetValue<string>("Section1", "Key1", "default");
int number = reader.GetValue<int>("Section1", "Number", 0);
bool flag = reader.GetValue<bool>("Section1", "Enabled", false);
double value = reader.GetValue<double>("Section1", "Value", 0.0);

Writing Values

reader.SetKey("Section1", "Key1", "Value1");
reader.SetKey("Section1", "Number", 42);
reader.SetKey("Section1", "Enabled", true);

Configuration Options

  • AutoSave = true: Automatically saves changes to disk after modifications
  • AutoAdd = true: Creates missing sections/keys with default values on read

Example

NeoIni reader = new("config.ini");

reader.SetKey("Database", "Host", "localhost");
reader.SetKey("Database", "Port", 5432);
reader.SetKey("Settings", "AutoSave", true);

string host = reader.GetValue<string>("Database", "Host", "127.0.0.1");
int port = reader.GetValue<int>("Database", "Port", 3306);

Console.WriteLine($"DB: {host}:{port}");

Security Features

  • Checksum: SHA256 validation detects tampering or corruption
  • AES-256: User-environment derived encryption key with IV
  • Thread-safe: All operations protected by lock
  • Password generated from Environment.UserName, MachineName, UserDomainName

Section/Key Management

bool exists = reader.SectionExists("Section1");
bool keyExists = reader.KeyExists("Section1", "Key1");

reader.AddSection("NewSection");
reader.RemoveKey("Section1", "Key1");
reader.RemoveSection("Section1");

string[] sections = reader.GetAllSections();
string[] keys = reader.GetAllKeys("Section1");

File Operations

reader.SaveFile();                    // Manual save
await reader.SaveFileAsync();         // Async save

reader.ReloadFromFile();              // Reload from disk
await reader.ReloadFromFileAsync();   // Async reload from disk

reader.DeleteFile();                  // Delete file only
reader.DeleteFileWithData();          // Delete file + clear data

API Reference

Method Description Async Version
GetValue<T> Read typed value with default fallback GetValueAsync<T>
SetKey<T> Set/create key-value SetKeyAsync<T>
AddSection Create section if missing AddSectionAsync
AddKeyInSection<T> Add unique key-value AddKeyInSectionAsync<T>
RemoveKey Delete specific key RemoveKeyAsync
RemoveSection Delete entire section RemoveSectionAsync
GetAllSections List all sections GetAllSectionsAsync
GetAllKeys List section keys GetAllKeysAsync

Philosophy

Black Box Design: Interact only through public API - internals abstracted

Developer

Lonewolf239

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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.

Version Downloads Last Updated