LightConfig 0.2.0
dotnet add package LightConfig --version 0.2.0
NuGet\Install-Package LightConfig -Version 0.2.0
<PackageReference Include="LightConfig" Version="0.2.0" />
paket add LightConfig --version 0.2.0
#r "nuget: LightConfig, 0.2.0"
// Install LightConfig as a Cake Addin #addin nuget:?package=LightConfig&version=0.2.0 // Install LightConfig as a Cake Tool #tool nuget:?package=LightConfig&version=0.2.0
LightConfig
https://www.nuget.org/packages/LightConfig/
LightConfig is lightweight and simple config parser C# library.
Usage
Creating a new configuration file instance
// Path
string configPath = "C:\config.cfg"; \\ Absolute
string configPath = "configuration\main.ini"; \\ Relative
// Default content
var defaultConfigContent = new Dictionary<string, string> {
{"key1", "value1"},
{"key2", "value2"},
};
var exampleConfigObject = new ConfigObject(configPath, defaultConfigContent)
// You can also change the separator, which will separate keys and values in file (default: " = ").
var exampleConfigObject = new ConfigObject(configPath, defaultConfigContent, ": ")
Reading all content from file
Dictionary<string, string> content = exampleConfigObject.ReadAll();
Reading value of specified key
string key = "key1";
string content = exampleConfigObject.ReadKey(key);
Changing value of specified key
string key = "key1";
string value = "value1";
string content = exampleConfigObject.Write(key, value);
Deleting file
exampleConfigObject.DeleteFile();
Reseting file
exampleConfigObject.ResetFile();
\\ This deletes file and creates it with the default content
Issues & Support
LightConfig is free and open source. I developing it in my free time for no money. You can contribute to the development of the application by reporting issues and your ideas HERE. I'd be very grateful.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
-
net5.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.
- Code cleanup
- Values can now contain a separator