![]() |
VOOZH | about |
dotnet add package ktsu.io.AppDataStorage --version 1.1.2
NuGet\Install-Package ktsu.io.AppDataStorage -Version 1.1.2
<PackageReference Include="ktsu.io.AppDataStorage" Version="1.1.2" />
<PackageVersion Include="ktsu.io.AppDataStorage" Version="1.1.2" />Directory.Packages.props
<PackageReference Include="ktsu.io.AppDataStorage" />Project file
paket add ktsu.io.AppDataStorage --version 1.1.2
#r "nuget: ktsu.io.AppDataStorage, 1.1.2"
#:package ktsu.io.AppDataStorage@1.1.2
#addin nuget:?package=ktsu.io.AppDataStorage&version=1.1.2Install as a Cake Addin
#tool nuget:?package=ktsu.io.AppDataStorage&version=1.1.2Install as a Cake Tool
ktsu.io.AppDataStorage is a .NET library designed to simplify the process of storing application data. This library enables you to save and load configuration or state data in the application data folder of the current user, using JSON serialization.
System.Text.Json with support for custom converters.System.IO.Abstractions for easy testing.Install the package via NuGet:
dotnet add package ktsu.io.AppDataStorage
Create a class that inherits from AppData<T> where T is your class type.
public class MyAppData : AppData<MyAppData>
{
public string Setting1 { get; set; } = "hello";
public int Setting2 { get; set; } = 12;
}
To load data, call the LoadOrCreate method. If the data file doesn't exist or is invalid, a new instance will be created and saved.
var data = MyAppData.LoadOrCreate();
Console.WriteLine(data.Setting1);
Console.WriteLine(data.Setting2);
// Output:
// hello
// 12
To save data, call Save on the instance of your app data class, after modifying its properties.
var data = MyAppData.LoadOrCreate();
data.Setting1 = "goodbye";
data.Setting2 = 42;
data.Save();
var data2 = MyAppData.LoadOrCreate();
Console.WriteLine(data2.Setting1);
Console.WriteLine(data2.Setting2);
// Output:
// goodbye
// 42
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.1.2 | 1,659 | 8/22/2024 | 1.1.2 is deprecated because it is no longer maintained. |
| 1.1.1 | 229 | 8/22/2024 | |
| 1.1.0 | 221 | 8/22/2024 | |
| 1.0.0 | 704 | 6/19/2024 | |
| 1.0.0-alpha.14 | 356 | 3/21/2024 | |
| 1.0.0-alpha.13 | 138 | 3/21/2024 | |
| 1.0.0-alpha.12 | 135 | 2/29/2024 | |
| 1.0.0-alpha.11 | 170 | 1/16/2024 | |
| 1.0.0-alpha.10 | 135 | 1/11/2024 | |
| 1.0.0-alpha.9 | 140 | 1/10/2024 | |
| 1.0.0-alpha.8 | 141 | 1/4/2024 | |
| 1.0.0-alpha.7 | 150 | 1/3/2024 | |
| 1.0.0-alpha.6 | 139 | 1/3/2024 | |
| 1.0.0-alpha.5 | 143 | 1/3/2024 | |
| 1.0.0-alpha.4 | 145 | 12/27/2023 | |
| 1.0.0-alpha.3 | 128 | 12/26/2023 | |
| 1.0.0-alpha.2 | 129 | 12/26/2023 | |
| 1.0.0-alpha.1 | 144 | 12/25/2023 |