Phase 1: data models and local storage service

- Add Models: Category, ToolItem (IsValid runtime-only, not stored), AppConfig

- Add Services: IDataService + JsonDataService (JSON load/save)

- Path validation on Load(): File.Exists check, logs warning for missing paths

- Startup: auto-calls dataService.Load() to load config
This commit is contained in:
2026-05-09 20:34:36 +08:00
parent 875e331116
commit 752f09a7e4
6 changed files with 222 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
namespace PersonalToolBox.Models;
/// <summary>
/// 应用全局配置,对应 config.json 的顶层结构
/// </summary>
public class AppConfig
{
/// <summary>
/// 主题模式 (Dark / Light)
/// </summary>
public string Theme { get; set; } = "Dark";
/// <summary>
/// 是否开机自启动
/// </summary>
public bool AutoStart { get; set; } = false;
/// <summary>
/// 工具分类列表
/// </summary>
public List<Category> Categories { get; set; } = new();
/// <summary>
/// 工具项列表
/// </summary>
public List<ToolItem> Tools { get; set; } = new();
}