ConfigurationFileIO 1.0.5

dotnet add package ConfigurationFileIO --version 1.0.5
NuGet\Install-Package ConfigurationFileIO -Version 1.0.5
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="ConfigurationFileIO" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ConfigurationFileIO --version 1.0.5
#r "nuget: ConfigurationFileIO, 1.0.5"
#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.
// Install ConfigurationFileIO as a Cake Addin
#addin nuget:?package=ConfigurationFileIO&version=1.0.5

// Install ConfigurationFileIO as a Cake Tool
#tool nuget:?package=ConfigurationFileIO&version=1.0.5

ConfigurationFileIO

Store settings of an application to a configuration file. Settings can have a category, a name and a value. Retrieve settings by specifying the category and name. Custom delimiter supported in case the default one (=) is required in the settings names.

Supported value types: string, int, double, boolean.

Usage/Examples

Create configuration file

// Create a configuration file.
ConfigurationFile configurationFile = new ConfigurationFile("settings.cfg");

// Create a setting with name AutoLogin in category LogIn.
configurationFile.AddNewSetting("LogIn", "AutoLogin", true);

// Save the configuration file with the changes.
configurationFile.WriteSettings();

Read configuration file and change settings

// Read settings from a configuration file.
ConfigurationFile configurationFile = new ConfigurationFile("settings.cfg");
configurationFile.ReadSettings();

// Get the value for a setting with name AutoLogin in category LogIn and toggle the value.
bool autoLogin = configurationFile.GetSettingValue("LogIn", "AutoLogin").AsBoolean();
configurationFile.SetSettingValue("LogIn", "AutoLogin", !autoLogin);

// Add a new setting AutoLoginUsername.
configurationFile.AddNewSetting("LogIn", "AutoLoginUsername", "User");

// Get the value of a non-existent setting and specify a default value.
int maxFalseAttempts = configurationFile.GetSettingValue("LogIn", "MaxFalseAttempts").AsInteger(3);
// maxFalseAttempts = 3.

// Save the configuration file with the changes.
configurationFile.WriteSettings();
Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

    • 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
1.0.5 131 9/7/2023
1.0.4 122 9/6/2023
1.0.3 118 9/6/2023
1.0.2 126 8/26/2023
1.0.1 118 8/21/2023
1.0.0 129 8/9/2023

Added a more descriptive exception when read setting values are converted to a specific format.