using System.IO; using System.Collections.ObjectModel; using CommunityToolkit.Mvvm.ComponentModel; namespace BetterGenshinImpact.ViewModel.Windows.GearTask; /// /// 地图追踪任务信息 /// public partial class PathingTaskInfo : ObservableObject { /// /// 任务名称 /// [ObservableProperty] private string _name = string.Empty; /// /// 文件夹名称 /// [ObservableProperty] private string _folderName = string.Empty; /// /// 完整路径 /// [ObservableProperty] private string _fullPath = string.Empty; /// /// 是否为文件夹 /// [ObservableProperty] private bool _isDirectory; /// /// JSON内容(如果是JSON文件) /// [ObservableProperty] private string _jsonContent = string.Empty; /// /// README内容(如果是文件夹且包含README.md) /// [ObservableProperty] private string _readmeContent = string.Empty; /// /// 图标URL /// [ObservableProperty] private string _iconUrl = string.Empty; /// /// 是否使用系统图标 /// [ObservableProperty] private bool _useSystemIcon; /// /// 父级路径 /// [ObservableProperty] private string _parentPath = string.Empty; /// /// 相对路径(相对于pathing文件夹) /// [ObservableProperty] private string _relativePath = string.Empty; /// /// 子项集合(用于TreeView层级结构) /// [ObservableProperty] private ObservableCollection _children = new(); public PathingTaskInfo() { } public PathingTaskInfo(string fullPath, string pathingRootPath) { FullPath = fullPath; Name = Path.GetFileName(fullPath); FolderName = Path.GetFileNameWithoutExtension(fullPath); IsDirectory = Directory.Exists(fullPath); ParentPath = Path.GetDirectoryName(fullPath) ?? string.Empty; RelativePath = Path.GetRelativePath(pathingRootPath, fullPath); } }