DsSimpleSettings 3.0.2
dotnet add package DsSimpleSettings --version 3.0.2
NuGet\Install-Package DsSimpleSettings -Version 3.0.2
<PackageReference Include="DsSimpleSettings" Version="3.0.2" />
paket add DsSimpleSettings --version 3.0.2
#r "nuget: DsSimpleSettings, 3.0.2"
// Install DsSimpleSettings as a Cake Addin #addin nuget:?package=DsSimpleSettings&version=3.0.2 // Install DsSimpleSettings as a Cake Tool #tool nuget:?package=DsSimpleSettings&version=3.0.2
SimpleSettings
SimpleSettings is a small library that allows easy access to settings reading and writing, with user-defined class blueprints.
In this version
Backslashes were not processed in the previous versions, so that's a thing now.
Usage
Using this library is very straightforward. One simply needs to create a class with publicly exposed properties and call the library function to load settings into it.
MySettings.cs
using SimpleSettings;
namespace MyProject
{
class MySettings
{
public string MyFirstSetting { get; set; }
[Description("This is a very important integer value")]
[Default(2)]
public int MySecondSetting { get; set; }
[Description("This class has a public method called 'Parse'")]
public SomeClass MyThirdSetting { get; set; }
[Ignore]
public float MyIgnoredSetting { get; set; } // this setting gets ignored by the settings reader
[Group("My group!")]
public float MyFirstGroupSetting { get; set; }
[Group("My group!")]
public System.Version MySecondGroupSetting { get; set; }
}
}
To read settings from a file into an instance of this class, one simply has to call Settings.FromFile<MySettings>("path/to/file.txt")
.
To save the settings to a file, call Settings.ToFile(mySettingsInstance, "path/to/file.txt")
.
To create a template settings file from this class, call Settings.ToFile<MySettings>(null, "path/to/file.txt")
.
The output would look like this:
MySettings_template.txt
;===(My group!)===
MyFirstGroupSetting:0
MySecondGroupSetting:
;=================
MyFirstSetting:
; This is a very important integer value
MySecondSetting:2
; This class has a public method called 'Parse'
MyThirdSetting:
Alternatively, the class can inherit the Settings
class and can then call the ToFile methods from instances.
The library can only create instances of classes that have a parameterless constructor. If your class doesn't have a parameterless constructor, you will have to create an instance yourself and pass that instance to the library instead.
If you have found a bug, something doesn't work as you would expect or you think this package could be improved in any way, please submit a feature request or bug report on the GitHub page of this project: https://github.com/D-Inventor/SimpleSettings
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. 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. |
.NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 is compatible. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 is compatible. net471 was computed. net472 is compatible. 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. |
-
.NETCoreApp 2.0
- No dependencies.
-
.NETCoreApp 2.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETStandard 2.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.
- SimpleSettings now interprets backslashes. \t becomes tab, \n becomes newline and \\ becomes backslash.