WritableJsonConfiguration
Source of configurations in JSON format with the ability to edit values directly from the running application. Based on Microsoft.Extensions.Configuration.
Install / Use
/learn @Kibnet/WritableJsonConfigurationREADME
WritableJsonConfiguration
<img src="https://github.com/Kibnet/WritableJsonConfiguration/raw/master/resources/JSON_logo.png" alt="JSON" width="180"/>
What is it?
If you want to add a settings to your app and you like json, then this is what you need. This uses the standard interface for working with settings, which is provided by Microsoft.Extensions.Configuration. To do this, we added methods for changing values in settings via the standard interface, which will edit the json file themselves.
How to use?
Add Nuget Package in your project:
Install-Package WritableJsonConfiguration
Create configuration:
IConfigurationRoot configuration = WritableJsonConfigurationFabric.Create("Settings.json");
Use this configuration in the app as you need, usually people register it with the IoC, example(Splat):
Locator.CurrentMutable.RegisterConstant(configuration, typeof(IConfiguration));
Get value:
Themes theme = configuration.GetSection("Appearance:Theme").Get<Themes>();
or
Themes theme = configuration.Get<Themes>("Appearance:Theme");
Set value:
configuration.GetSection("Appearance:Theme").Set(theme);
or
configuration.Set("Appearance:Theme", theme);
Communication
Any suggestions and comments are welcome. If you want to contact me, use Telegram
