Files
personal-toolbox/PersonalToolBox/Models/ToolItem.cs
home-PC 752f09a7e4 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
2026-05-09 20:34:36 +08:00

51 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Text.Json.Serialization;
namespace PersonalToolBox.Models;
/// <summary>
/// 工具项模型,表示用户添加的一个可执行工具
/// </summary>
public class ToolItem
{
/// <summary>
/// 工具唯一标识 (UUID)
/// </summary>
public string Id { get; set; } = Guid.NewGuid().ToString();
/// <summary>
/// 工具显示名称
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// 内置图标库的字符编码
/// </summary>
public string IconCode { get; set; } = string.Empty;
/// <summary>
/// 可执行文件路径或 URL
/// </summary>
public string ExecutablePath { get; set; } = string.Empty;
/// <summary>
/// 运行参数(选填)
/// </summary>
public string Arguments { get; set; } = string.Empty;
/// <summary>
/// 所属分类 ID
/// </summary>
public string CategoryId { get; set; } = string.Empty;
/// <summary>
/// 全局快捷键(如 Ctrl+Alt+T选填
/// </summary>
public string HotKey { get; set; } = string.Empty;
/// <summary>
/// 路径是否有效(仅运行时计算,不存入 JSON
/// </summary>
[JsonIgnore]
public bool IsValid { get; set; } = true;
}