VOOZH about

URL: https://www.nuget.org/packages/ktsu.io.AppDataStorage/

⇱ NuGet Gallery | ktsu.io.AppDataStorage 1.1.2




ktsu.io.AppDataStorage 1.1.2

Prefix Reserved
Suggested Alternatives

ktsu.AppDataStorage

dotnet add package ktsu.io.AppDataStorage --version 1.1.2
 
 
NuGet\Install-Package ktsu.io.AppDataStorage -Version 1.1.2
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ktsu.io.AppDataStorage" Version="1.1.2" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ktsu.io.AppDataStorage" Version="1.1.2" />
 
Directory.Packages.props
<PackageReference Include="ktsu.io.AppDataStorage" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ktsu.io.AppDataStorage --version 1.1.2
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ktsu.io.AppDataStorage, 1.1.2"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ktsu.io.AppDataStorage@1.1.2
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ktsu.io.AppDataStorage&version=1.1.2
 
Install as a Cake Addin
#tool nuget:?package=ktsu.io.AppDataStorage&version=1.1.2
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ktsu.io.AppDataStorage

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.

Features

  • Easy-to-use: Simple interface for saving and loading application data.
  • Automatic Backup: Ensures that the original data is backed up before saving.
  • Customizable Serialization: Uses System.Text.Json with support for custom converters.
  • File System Abstraction: Uses System.IO.Abstractions for easy testing.

Installation

Install the package via NuGet:

dotnet add package ktsu.io.AppDataStorage

Usage

Define Your App Data Class

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;
}

Load Data

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

Save Data

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

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
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