LrndefLib 2.0.0
dotnet add package LrndefLib --version 2.0.0
NuGet\Install-Package LrndefLib -Version 2.0.0
<PackageReference Include="LrndefLib" Version="2.0.0" />
paket add LrndefLib --version 2.0.0
#r "nuget: LrndefLib, 2.0.0"
// Install LrndefLib as a Cake Addin
#addin nuget:?package=LrndefLib&version=2.0.0
// Install LrndefLib as a Cake Tool
#tool nuget:?package=LrndefLib&version=2.0.0
LrndefLib
LrndefLib provides a version-based config file
Goals
Version Ambiguity
The config file implementation provided by TShock can't differentiate between config versions without iterating the whole file. LrndefLib provides an alternative implementation that instead compares a single property "metadata:version". However, the schema isn't strictly enforced
Migrations
LrndefLib allows for config migrations during parsing. However, you need to provide your own migration implementation. LrndefLib can't migrate by default, it binds the config 1:1 as if it were any other version
Migrations can be implemented by modifying VersionedConfigFile.BindDelegate
. The delegate is called in the middle of parsing to bind a JObject
to a config object
Installation
With Visual Studio/NuGet
- Open NuGet
- Search for "LrndefLib"
- Install
With Paket(HTTP) (Old Way)
- Add
http https://github.com/Arthri/LrndefLib/releases/download/[VERSION]/LrndefLib.[VERSION].nupkg packages/LrndefLib/[VERSION]/LrndefLib.[VERSION].nupkg
to yourpaket.dependencies
- Replace
[VERSION]
with your desired version. DO NOT uselatest
.
- Replace
- Add
source paket-files/github.com/packages
, also topaket.dependencies
- Reference in projects via
paket.references
- Run
dotnet paket install
Usage
- Create a new instance of
VersionedConfigFile
like so:var configFile = new VersionedConfigFile<TSettings>(CurrentVersion);
- replace
TSettings
with the settings class - replace
CurrentVersion
with the current version of the config
- replace
- Read the config file:
configFile.Read(configPath, out bool _)
;
Unofficial Conventions
CurrentVersion
A config's "CurrentVersion
" is its latest iteration. Ideally, it should follow SemVer. Since configs change rarely, ideally, CurrentVersion
should NOT be derived from the assembly version
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
This package has 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 |
---|
Removed VersionedSettings and constraint. More info at https://github.com/Arthri/LrndefLib/releases/tag/2.0.0