新增地图追踪任务选择窗口及相关功能,支持任务选择和显示详细信息

This commit is contained in:
辉鸭蛋
2025-09-07 12:27:54 +08:00
parent baa5cad656
commit b370d76f8d
8 changed files with 1512 additions and 2 deletions

View File

@@ -35,6 +35,7 @@
<Resource Include="Resources\Images\*.png" />
<Resource Include="Resources\Images\*.ico" />
<Resource Include="Resources\Fonts\*.ttf" />
<Resource Include="Resources\Json\*.json" />
</ItemGroup>
<ItemGroup>
@@ -80,6 +81,7 @@
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageReference Include="System.Drawing.Common" Version="9.0.5" />
<PackageReference Include="System.IO.Hashing" Version="9.0.4" />
<PackageReference Include="TorchSharp" Version="0.105.0" />
@@ -194,7 +196,6 @@
<ItemGroup>
<Folder Include="GameTask\OneDragon\" />
<Folder Include="GameTask\UseRedeemCode\Assets\1920x1080\" />
<Folder Include="Resources\" />
<Folder Include="Service\Notification\Builder\" />
<Folder Include="User\AutoPathing\" />
</ItemGroup>

View File

@@ -38,7 +38,7 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
// 仓储临时目录 用于下载与解压
public static readonly string ReposTempPath = Path.Combine(ReposPath, "Temp");
// // 中央仓库信息地址
// public static readonly List<string> CenterRepoInfoUrls =
// [

View File

@@ -0,0 +1,590 @@
[
{
"name": "初露之源",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01qHkmzA1lhoOgN3maO_!!2042484851.webp"
},
{
"name": "子探测单元",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01jpBX2S1lhoOemn6ay_!!2042484851.webp"
},
{
"name": "幽光星星",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01xEddcr1lhoOesM2gJ_!!2042484851.webp"
},
{
"name": "柔灯铃",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01dTS7ro1lhoOfSzpIi_!!2042484851.webp"
},
{
"name": "海露花",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01FrxYEO1lhoOgVEegc_!!2042484851.webp"
},
{
"name": "湖光铃兰",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01BLu5zc1lhoOg0yB0G_!!2042484851.webp"
},
{
"name": "苍晶螺",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01BtspjS1lhoOh68XfI_!!2042484851.webp"
},
{
"name": "虹彩蔷薇",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01ApdTRc1lhoOfT0A6U_!!2042484851.webp"
},
{
"name": "夜泊石",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN011Ynj951lhoOgYx1gh_!!2042484851.webp"
},
{
"name": "星螺",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01Uyfgum1lhoOg0xm4C_!!2042484851.webp"
},
{
"name": "清心",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01MlR45V1lhoOgRsg5I_!!2042484851.webp"
},
{
"name": "清水玉",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01e0RMp21lhoOh6A5LN_!!2042484851.webp"
},
{
"name": "琉璃百合",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01LzVX0j1lhoOeN8PtL_!!2042484851.webp"
},
{
"name": "琉璃袋",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01a4lOuC1lhoOemoz1W_!!2042484851.webp"
},
{
"name": "石珀",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN010eyc9l1lhoOfT2J7f_!!2042484851.webp"
},
{
"name": "绝云椒椒",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01TAzs9t1lhoOfSztUu_!!2042484851.webp"
},
{
"name": "霓裳花",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN013dB2Iy1lhoOeN78uu_!!2042484851.webp"
},
{
"name": "天云草实",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01V1ab5e1lhoOfjvOr5_!!2042484851.webp"
},
{
"name": "幽灯蕈",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01UExEyv1lhoOfo0tJj_!!2042484851.webp"
},
{
"name": "晶化骨髓",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01QKl1ye1lhoOgVEJx7_!!2042484851.webp"
},
{
"name": "海灵芝",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01Oo6kSS1lhoOfT1R9C_!!2042484851.webp"
},
{
"name": "珊瑚真珠",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01KEwb9c1lhoOgRsg8X_!!2042484851.webp"
},
{
"name": "绯樱绣球",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01MOui341lhoOgYxpfD_!!2042484851.webp"
},
{
"name": "血斛",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01NthMzM1lhoOh6CyAD_!!2042484851.webp"
},
{
"name": "鬼兜虫",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01ppJpjk1lhoOgrqy4B_!!2042484851.webp"
},
{
"name": "鸣草",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01QCm2Ix1lhoOfjwbk2_!!2042484851.webp"
},
{
"name": "云岩裂叶",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01O4pAeg1lhoOfjvs0h_!!2042484851.webp"
},
{
"name": "微光角菌",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01Em2NKU1lhoOfT3aCG_!!2042484851.webp"
},
{
"name": "枯叶紫英",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN013ROX0Q1lhoOfo3NE9_!!2042484851.webp"
},
{
"name": "浪沫羽鳃",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01JJcfvG1lhoOgRtgWY_!!2042484851.webp"
},
{
"name": "灼灼彩菊",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01FLtZpr1lhoOgYxlXY_!!2042484851.webp"
},
{
"name": "琉鳞石",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01fsSJxh1lhoOh6D6WH_!!2042484851.webp"
},
{
"name": "肉龙掌",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN017kZaPI1lhoOgYxA7c_!!2042484851.webp"
},
{
"name": "青蜜莓",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01KZG4Se1lhoOgrr2Ft_!!2042484851.webp"
},
{
"name": "嘟嘟莲",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01Rymjep1lhoOesJMLB_!!2042484851.webp"
},
{
"name": "塞西莉亚花",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01YWIykr1lhoOh68Gx7_!!2042484851.webp"
},
{
"name": "小灯草",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01ATXGxF1lhoOfW2OjZ_!!2042484851.webp"
},
{
"name": "慕风蘑菇",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01cZRaxX1lhoOh67wA1_!!2042484851.webp"
},
{
"name": "落落莓",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01HfZ7GO1lhoOgN5nKQ_!!2042484851.webp"
},
{
"name": "蒲公英籽",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01Qf6D9X1lhoOg0v1T6_!!2042484851.webp"
},
{
"name": "钩钩果",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01ScaK5q1lhoOfxmOHf_!!2042484851.webp"
},
{
"name": "风车菊",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01g0vNPe1lhoOgRqrhu_!!2042484851.webp"
},
{
"name": "万相石",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01b0z5Ki1lhoOfnyXfD_!!2042484851.webp"
},
{
"name": "劫波莲",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01bqAIbq1lhoOfW23y2_!!2042484851.webp"
},
{
"name": "圣金虫",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01tBo9Bp1lhoOg0tkUk_!!2042484851.webp"
},
{
"name": "帕蒂沙兰",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01FqGN2w1lhoOfxlFdD_!!2042484851.webp"
},
{
"name": "悼灵花",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01AgNSG81lhoOfT1MsD_!!2042484851.webp"
},
{
"name": "月莲",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01LPhuvL1lhoOfW3fk2_!!2042484851.webp"
},
{
"name": "树王圣体菇",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01RjKqYA1lhoOfxmBqE_!!2042484851.webp"
},
{
"name": "沙脂蛹",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01yG4z0q1lhoOh69HN1_!!2042484851.webp"
},
{
"name": "赤念果",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01GfHDR21lhoOg0v9po_!!2042484851.webp"
},
{
"name": "丘丘人射手",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN019Ptfgt1lhoOvsaQM0_!!2042484851.webp"
},
{
"name": "丘丘游侠",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN017o81Tg1lhoOwrwLFv_!!2042484851.webp"
},
{
"name": "丘丘王",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01EFtcpD1lhoOvxm7WQ_!!2042484851.webp"
},
{
"name": "丘丘萨满",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01C1ReHV1lhoOwmVNyN_!!2042484851.webp"
},
{
"name": "债务处理人",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01mWkKYp1lhoOvH8xTV_!!2042484851.webp"
},
{
"name": "元能构装体",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01e4QnPP1lhoOvxk2c5_!!2042484851.webp"
},
{
"name": "兽境之狼",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01UpUjNt1lhoOx1ErEO_!!2042484851.webp"
},
{
"name": "冬国仕女",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01s50jFT1lhoOwmXGKO_!!2042484851.webp"
},
{
"name": "原海异种",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01Hc3Xy31lhoOwG1CSN_!!2042484851.webp"
},
{
"name": "发条机关",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01JoVgM41lhoOwmX0Vb_!!2042484851.webp"
},
{
"name": "史莱姆",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01Xq4v8B1lhoOwmTdhT_!!2042484851.webp"
},
{
"name": "圣骸兽",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01ljYTk61lhoOvsVenr_!!2042484851.webp"
},
{
"name": "大灵显化身",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01NnM0TU1lhoOvxpLRv_!!2042484851.webp"
},
{
"name": "大驮兽",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01D2YXl21lhoOvHAlu2_!!2042484851.webp"
},
{
"name": "奇怪的丘丘人",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01dkDc591lhoOxS2wxG_!!2042484851.webp"
},
{
"name": "小型深海龙蜥",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01f6zhYM1lhoOws1mKL_!!2042484851.webp"
},
{
"name": "小驮兽(面具驮)",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN019sYgp81lhoOwmbcuB_!!2042484851.webp"
},
{
"name": "愚人众",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01JWw2fN1lhoOvH9lNN_!!2042484851.webp"
},
{
"name": "愚人众风役人",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01VlwXwl1lhoOurK00Z_!!2042484851.webp"
},
{
"name": "浊水幻灵",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01udmTrY1lhoOvsaUTE_!!2042484851.webp"
},
{
"name": "深渊法师",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01yFj1Rj1lhoOwG7uSl_!!2042484851.webp"
},
{
"name": "深邃拟覆叶",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01FleTa51lhoOwG39AQ_!!2042484851.webp"
},
{
"name": "炉壳山鼬",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01JQaQad1lhoOwLcACu_!!2042484851.webp"
},
{
"name": "熔岩游像",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01O4cCht1lhoOwLbtbZ_!!2042484851.webp"
},
{
"name": "玄文兽",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01jzAPPT1lhoOxSAfRL_!!2042484851.webp"
},
{
"name": "盗宝团",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01ri03dA1lhoOvKa2sZ_!!2042484851.webp"
},
{
"name": "秘源机兵",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN019cUbng1lhoOvxpLWd_!!2042484851.webp"
},
{
"name": "纳塔龙众",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01oReCMq1lhoOqWNldq_!!2042484851.webp"
},
{
"name": "纳塔龙众和部族龙形武士",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01R3aHAE1lhoOvsXTGG_!!2042484851.webp"
},
{
"name": "萤术士",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01o45M1v1lhoOwG1nsg_!!2042484851.webp"
},
{
"name": "蕈兽",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01c0CBtD1lhoOvHBJ6k_!!2042484851.webp"
},
{
"name": "遗迹守卫",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01JkAT0y1lhoOvKbn4C_!!2042484851.webp"
},
{
"name": "遗迹机兵",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01v3SDjT1lhoOwQZB84_!!2042484851.webp"
},
{
"name": "遗迹龙兽",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01TWJM4n1lhoOvHESh6_!!2042484851.webp"
},
{
"name": "部族龙形武士",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01qO3fuI1lhoOurLsdw_!!2042484851.webp"
},
{
"name": "野伏众",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01JFkUhg1lhoOvxspp0_!!2042484851.webp"
},
{
"name": "镀金旅团",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01tfQryj1lhoOqWUc3h_!!2042484851.webp"
},
{
"name": "隙境原体",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01lbeNKL1lhoOwLV7LP_!!2042484851.webp"
},
{
"name": "风役人",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01VlwXwl1lhoOurK00Z_!!2042484851.webp"
},
{
"name": "飘浮灵",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN012diLBa1lhoOwAWpxm_!!2042484851.webp"
},
{
"name": "飞萤",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01Iywy791lhoOwLdEw2_!!2042484851.webp"
},
{
"name": "骗骗花",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01mv4sOb1lhoOvKWQHI_!!2042484851.webp"
},
{
"name": "魔像禁卫",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN013h0VYw1lhoOqWVU7Q_!!2042484851.webp"
},
{
"name": "黑蛇众",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01iQL3bh1lhoOxSAwFc_!!2042484851.webp"
},
{
"name": "龙蜥",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01zrIHtN1lhoOvxnvyF_!!2042484851.webp"
},
{
"name": "星银矿石",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN0125LDwI1lhoOvH6oAA_!!2042484851.webp"
},
{
"name": "水晶块",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01pRGWOa1lhoOwLZgF7_!!2042484851.webp"
},
{
"name": "白铁块",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01kvjAgT1lhoOwFzNy4_!!2042484851.webp"
},
{
"name": "紫晶块",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01R7q5071lhoOwmQxyT_!!2042484851.webp"
},
{
"name": "萃凝晶",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN012BsetE1lhoOx1FSYJ_!!2042484851.webp"
},
{
"name": "久雨莲",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01XCmBnU1lhoOemuUSE_!!2042484851.webp"
},
{
"name": "冰雾花花朵",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01TAyh3a1lhoOgVN79Q_!!2042484851.webp"
},
{
"name": "冷鲜肉",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01cr3cDk1lhoOa1FEzf_!!2042484851.webp"
},
{
"name": "堇瓜",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01qqLUFs1lhoOgVFjQ8_!!2042484851.webp"
},
{
"name": "墩墩桃",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01G7TWSD1lhoOeN8p0k_!!2042484851.webp"
},
{
"name": "奇异的「牙齿」",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN014DDnfV1lhoOh6JY96_!!2042484851.webp"
},
{
"name": "日落果",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01eIyjec1lhoOvtuKI1_!!2042484851.webp"
},
{
"name": "晶蝶",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN019Dpn031lhoOfWD0MN_!!2042484851.webp"
},
{
"name": "松果",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01ZldGQ51lhoOgVI0qL_!!2042484851.webp"
},
{
"name": "松茸",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01R35Sd21lhoOgrryWo_!!2042484851.webp"
},
{
"name": "枣椰",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01W3gJNG1lhoOgVG8O9_!!2042484851.webp"
},
{
"name": "树莓",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01o6v8iK1lhoOfjxHS9_!!2042484851.webp"
},
{
"name": "汐藻",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN018COxKO1lhoOgN6nzj_!!2042484851.webp"
},
{
"name": "沉玉仙茗",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01ub9P1M1lhoOfxnT6S_!!2042484851.webp"
},
{
"name": "泡泡桔",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01ikK6491lhoOx1Q8XU_!!2042484851.webp"
},
{
"name": "海草",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01cOpuie1lhoOa1IByd_!!2042484851.webp"
},
{
"name": "澄晶实",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01F3hZrT1lhoOemr8Hh_!!2042484851.webp"
},
{
"name": "烈焰花花蕊",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN016u3QcC1lhoOg176dR_!!2042484851.webp"
},
{
"name": "烛伞蘑菇",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01JrlmBZ1lhoOx1QfhE_!!2042484851.webp"
},
{
"name": "烬芯花",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01p5ersv1lhoOgZ8N2i_!!2042484851.webp"
},
{
"name": "甜甜花",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01p2FKMt1lhoOfW7AEx_!!2042484851.webp"
},
{
"name": "电气水晶",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01qw4cat1lhoOfo9U8Q_!!2042484851.webp"
},
{
"name": "白萝卜",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01n1teCU1lhoOgRwAXS_!!2042484851.webp"
},
{
"name": "禽肉",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01v11I451lhoOa1IayJ_!!2042484851.webp"
},
{
"name": "竹笋",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01pG6dlK1lhoOgVIkfF_!!2042484851.webp"
},
{
"name": "红果果菇",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01qfeHQB1lhoOfo63l3_!!2042484851.webp"
},
{
"name": "胡萝卜",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01c8bc601lhoOgVKUnF_!!2042484851.webp"
},
{
"name": "苦种",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01v12ru41lhoOesUdXA_!!2042484851.webp"
},
{
"name": "苹果",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01KyqfE61lhoOwmfnjr_!!2042484851.webp"
},
{
"name": "茉洁草",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01PIPcLN1lhoOgZ2Wxo_!!2042484851.webp"
},
{
"name": "莲蓬",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01KCCTfr1lhoOgZ1ziD_!!2042484851.webp"
},
{
"name": "薄荷",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN010bUl6I1lhoOgVKd7f_!!2042484851.webp"
},
{
"name": "蘑菇",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01SPavTp1lhoOgRyeS1_!!2042484851.webp"
},
{
"name": "蜥蜴尾巴",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01Mi4S881lhoOemyz6x_!!2042484851.webp"
},
{
"name": "螃蟹",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01h7aFSD1lhoOgRwqBv_!!2042484851.webp"
},
{
"name": "金鱼草",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01lzTh8m1lhoOfW8Ajz_!!2042484851.webp"
},
{
"name": "青蛙",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01JNQ0sE1lhoOfWEgNz_!!2042484851.webp"
},
{
"name": "须弥蔷薇",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01xw0bRz1lhoOeNDqyu_!!2042484851.webp"
},
{
"name": "颗粒果",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01cBLGp11lhoOfo8PMG_!!2042484851.webp"
},
{
"name": "香辛果",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01xOwrxK1lhoOgNA1jA_!!2042484851.webp"
},
{
"name": "马尾",
"link": "https://img.alicdn.com/imgextra/i3/2042484851/O1CN01xSNFhS1lhoOfT9Uge_!!2042484851.webp"
},
{
"name": "鱼肉",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01bs5Qrv1lhoOh6G7rZ_!!2042484851.webp"
},
{
"name": "鳅鳅宝玉",
"link": "https://img.alicdn.com/imgextra/i4/2042484851/O1CN01OM0i851lhoOesUlrm_!!2042484851.webp"
},
{
"name": "鳗肉",
"link": "https://img.alicdn.com/imgextra/i2/2042484851/O1CN01ReeMlt1lhoOemuxOW_!!2042484851.webp"
},
{
"name": "鸟蛋",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN011bc4nt1lhoOeNCFFn_!!2042484851.webp"
},
{
"name": "铁块",
"link": "https://img.alicdn.com/imgextra/i1/2042484851/O1CN01aKcV4t1lhoOx1EeeP_!!2042484851.webp"
}
]

View File

@@ -0,0 +1,201 @@
<ui:FluentWindow x:Class="BetterGenshinImpact.View.Windows.GearTask.PathingTaskSelectionWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:local="clr-namespace:BetterGenshinImpact.View.Windows.GearTask"
xmlns:vm="clr-namespace:BetterGenshinImpact.ViewModel.Windows.GearTask"
mc:Ignorable="d"
Title="选择地图追踪任务"
Height="800"
Width="1100"
MinHeight="500"
MinWidth="700"
WindowStartupLocation="CenterOwner"
Background="{DynamicResource ApplicationBackgroundBrush}"
ExtendsContentIntoTitleBar="True"
WindowBackdropType="Mica"
d:DataContext="{d:DesignInstance Type=vm:PathingTaskSelectionViewModel}">
<ui:FluentWindow.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<Style x:Key="IconImageStyle" TargetType="Image">
<Setter Property="Width" Value="16" />
<Setter Property="Height" Value="16" />
<Setter Property="Margin" Value="0,0,8,0" />
</Style>
</ui:FluentWindow.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 标题栏 -->
<ui:TitleBar Grid.Row="0"
Title="选择地图追踪任务"
Icon="{ui:SymbolIcon Navigation24}" />
<!-- 主内容区域 -->
<Grid Grid.Row="1" Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- 工具栏 -->
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,12">
<ui:Button Content="刷新"
Icon="{ui:SymbolIcon ArrowSync24}"
Command="{Binding RefreshTasksCommand}"
Margin="0,0,8,0" />
<ToggleButton Content="显示文件"
IsChecked="{Binding ShowFilesMode}"
Command="{Binding ToggleShowModeCommand}"
Margin="0,0,8,0" />
</StackPanel>
<!-- 主内容区域 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="4*" />
</Grid.ColumnDefinitions>
<!-- 左侧任务列表 -->
<ui:Border Grid.Column="0"
Background="{DynamicResource CardBackground}"
BorderBrush="{DynamicResource CardBorderBrush}"
BorderThickness="1"
CornerRadius="{DynamicResource ControlCornerRadius}"
Padding="8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 搜索框 -->
<ui:TextBox Grid.Row="0"
Text="{Binding SearchKeyword, UpdateSourceTrigger=PropertyChanged}"
PlaceholderText="搜索地图追踪任务..."
Icon="{ui:SymbolIcon Search24}"
Margin="0,0,0,8" />
<!-- TreeView -->
<TreeView Grid.Row="1"
ItemsSource="{Binding FilteredPathingTasks}"
Background="Transparent"
BorderThickness="0"
x:Name="TaskTreeView">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<Grid Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- 图标 -->
<Grid Grid.Column="0" Width="20" Height="20" Margin="0,0,8,0">
<!-- WPF图标 -->
<ui:SymbolIcon Symbol="{Binding IsDirectory, Converter={x:Static local:PathingTaskSelectionWindow.DirectoryToSymbolConverter}}"
FontSize="16"
Visibility="{Binding UseSystemIcon, Converter={StaticResource BooleanToVisibilityConverter}}" />
</Grid>
<!-- 任务信息 -->
<StackPanel Grid.Column="1">
<ui:TextBlock Text="{Binding Name}"
FontWeight="Medium"
TextTrimming="CharacterEllipsis" />
</StackPanel>
</Grid>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Grid>
</ui:Border>
<!-- 分隔线 -->
<GridSplitter Grid.Column="1"
Width="8"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Background="Transparent"
ResizeBehavior="PreviousAndNext" />
<!-- 右侧详情区域 -->
<ui:Border Grid.Column="2"
Background="{DynamicResource CardBackground}"
BorderBrush="{DynamicResource CardBorderBrush}"
BorderThickness="1"
CornerRadius="{DynamicResource ControlCornerRadius}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 详情标题 -->
<ui:TextBlock Grid.Row="0"
Text="{Binding DisplayContentType, StringFormat={}{0} 内容}"
FontWeight="SemiBold"
Margin="12,12,12,8"
Visibility="{Binding SelectedTask, Converter={StaticResource BooleanToVisibilityConverter}}" />
<!-- 详情内容 -->
<ScrollViewer Grid.Row="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
Margin="12,0,12,12"
Visibility="{Binding SelectedTask, Converter={StaticResource BooleanToVisibilityConverter}}">
<ui:TextBox Text="{Binding DisplayContent}"
IsReadOnly="True"
TextWrapping="Wrap"
AcceptsReturn="True"
VerticalScrollBarVisibility="Disabled"
HorizontalScrollBarVisibility="Disabled"
BorderThickness="0"
Background="Transparent"
FontFamily="Consolas" />
</ScrollViewer>
<!-- 空状态提示 -->
<StackPanel Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{Binding SelectedTask, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Invert}">
<ui:SymbolIcon Symbol="Cursor24"
FontSize="48"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
Margin="0,0,0,12" />
<ui:TextBlock Text="请选择一个地图追踪任务查看详情"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
HorizontalAlignment="Center" />
</StackPanel>
</Grid>
</ui:Border>
</Grid>
<!-- 底部按钮 -->
<StackPanel Grid.Row="2"
Orientation="Horizontal"
HorizontalAlignment="Right"
Margin="0,12,0,0">
<ui:Button Content="确定"
Appearance="Primary"
Click="OnConfirmClick"
Margin="0,0,8,0"
MinWidth="80" />
<ui:Button Content="取消"
Click="OnCancelClick"
MinWidth="80" />
</StackPanel>
</Grid>
</Grid>
</ui:FluentWindow>

View File

@@ -0,0 +1,227 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using BetterGenshinImpact.ViewModel.Windows.GearTask;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using Wpf.Ui.Controls;
using Wpf.Ui.Violeta.Controls;
using Image = SixLabors.ImageSharp.Image;
namespace BetterGenshinImpact.View.Windows.GearTask;
/// <summary>
/// 地图追踪任务选择窗口
/// </summary>
public partial class PathingTaskSelectionWindow : FluentWindow
{
/// <summary>
/// ViewModel
/// </summary>
public PathingTaskSelectionViewModel ViewModel { get; }
/// <summary>
/// 选中的地图追踪任务
/// </summary>
public PathingTaskInfo? SelectedTask => ViewModel.SelectedTask;
/// <summary>
/// 对话框结果
/// </summary>
public bool DialogResult { get; private set; }
/// <summary>
/// 目录到符号图标的转换器
/// </summary>
public static readonly DirectoryToSymbolConverter DirectoryToSymbolConverter = new();
public PathingTaskSelectionWindow()
{
ViewModel = new PathingTaskSelectionViewModel();
DataContext = ViewModel;
InitializeComponent();
// 绑定TreeView的选中项变化事件
TaskTreeView.SelectedItemChanged += OnTreeViewSelectedItemChanged;
}
/// <summary>
/// TreeView选中项变化事件处理
/// </summary>
private void OnTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (e.NewValue is PathingTaskInfo selectedTask)
{
ViewModel.SelectedTask = selectedTask;
}
}
/// <summary>
/// 确定按钮点击事件
/// </summary>
private void OnConfirmClick(object sender, RoutedEventArgs e)
{
if (ViewModel.SelectedTask == null)
{
Toast.Warning("请选择一个地图追踪任务");
return;
}
DialogResult = true;
Close();
}
/// <summary>
/// 取消按钮点击事件
/// </summary>
private void OnCancelClick(object sender, RoutedEventArgs e)
{
DialogResult = false;
Close();
}
}
/// <summary>
/// 目录到符号图标的转换器
/// </summary>
public class DirectoryToSymbolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isDirectory)
{
return isDirectory ? SymbolRegular.Folder24 : SymbolRegular.Document24;
}
return SymbolRegular.Document24;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
/// <summary>
/// 布尔值到可见性的反向转换器
/// </summary>
public class BooleanToVisibilityInvertConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue)
{
return boolValue ? Visibility.Collapsed : Visibility.Visible;
}
return Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
/// <summary>
/// 字符串到ImageSource的转换器处理空字符串情况支持WebP格式
/// </summary>
public class StringToImageSourceConverter : IValueConverter
{
private static readonly HttpClient HttpClient = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string url && !string.IsNullOrEmpty(url))
{
try
{
// 检查是否为WebP格式或其他需要特殊处理的格式
if (url.Contains(".webp", StringComparison.OrdinalIgnoreCase))
{
return LoadWebPImage(url);
}
else
{
// 对于其他格式使用原有的BitmapImage
return new BitmapImage(new Uri(url));
}
}
catch (Exception e)
{
Debug.WriteLine(e);
return null;
}
}
return null;
}
private static BitmapSource? LoadWebPImage(string url)
{
try
{
byte[] imageData;
if (url.StartsWith("http", StringComparison.OrdinalIgnoreCase))
{
// 从网络加载
imageData = HttpClient.GetByteArrayAsync(url).Result;
}
else
{
// 从本地文件加载
imageData = File.ReadAllBytes(url);
}
using var image = Image.Load<Rgba32>(imageData);
// 转换为WPF可用的BitmapSource
var bitmap = new WriteableBitmap(image.Width, image.Height, 96, 96, PixelFormats.Bgra32, null);
bitmap.Lock();
try
{
var backBuffer = bitmap.BackBuffer;
var stride = bitmap.BackBufferStride;
image.ProcessPixelRows(accessor =>
{
for (int y = 0; y < accessor.Height; y++)
{
var pixelRow = accessor.GetRowSpan(y);
var targetPtr = backBuffer + y * stride;
for (int x = 0; x < pixelRow.Length; x++)
{
var pixel = pixelRow[x];
// 转换RGBA到BGRA
var bgra = (pixel.A << 24) | (pixel.R << 16) | (pixel.G << 8) | pixel.B;
System.Runtime.InteropServices.Marshal.WriteInt32(targetPtr + x * 4, bgra);
}
}
});
}
finally
{
bitmap.AddDirtyRect(new Int32Rect(0, 0, image.Width, image.Height));
bitmap.Unlock();
}
return bitmap;
}
catch (Exception e)
{
Debug.WriteLine($"Failed to load WebP image: {e}");
return null;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@@ -361,6 +361,30 @@ public partial class GearTaskListPageViewModel : ViewModel
return; // 用户取消了操作
}
}
// 如果是地图追踪类型,使用地图追踪任务选择窗口
else if (taskType == "Pathing")
{
var pathingSelectionWindow = new PathingTaskSelectionWindow
{
Owner = Application.Current.MainWindow
};
pathingSelectionWindow.ShowDialog();
if (pathingSelectionWindow.DialogResult && pathingSelectionWindow.SelectedTask != null)
{
var selectedTask = pathingSelectionWindow.SelectedTask;
newTask = new GearTaskViewModel(selectedTask.Name)
{
TaskType = "Pathing",
Path = selectedTask.RelativePath
};
}
else
{
return; // 用户取消了操作
}
}
else
{
// 其他类型使用原有的对话框

View File

@@ -0,0 +1,91 @@
using System.IO;
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
namespace BetterGenshinImpact.ViewModel.Windows.GearTask;
/// <summary>
/// 地图追踪任务信息
/// </summary>
public partial class PathingTaskInfo : ObservableObject
{
/// <summary>
/// 任务名称
/// </summary>
[ObservableProperty]
private string _name = string.Empty;
/// <summary>
/// 文件夹名称
/// </summary>
[ObservableProperty]
private string _folderName = string.Empty;
/// <summary>
/// 完整路径
/// </summary>
[ObservableProperty]
private string _fullPath = string.Empty;
/// <summary>
/// 是否为文件夹
/// </summary>
[ObservableProperty]
private bool _isDirectory;
/// <summary>
/// JSON内容如果是JSON文件
/// </summary>
[ObservableProperty]
private string _jsonContent = string.Empty;
/// <summary>
/// README内容如果是文件夹且包含README.md
/// </summary>
[ObservableProperty]
private string _readmeContent = string.Empty;
/// <summary>
/// 图标URL
/// </summary>
[ObservableProperty]
private string _iconUrl = string.Empty;
/// <summary>
/// 是否使用系统图标
/// </summary>
[ObservableProperty]
private bool _useSystemIcon;
/// <summary>
/// 父级路径
/// </summary>
[ObservableProperty]
private string _parentPath = string.Empty;
/// <summary>
/// 相对路径相对于pathing文件夹
/// </summary>
[ObservableProperty]
private string _relativePath = string.Empty;
/// <summary>
/// 子项集合用于TreeView层级结构
/// </summary>
[ObservableProperty]
private ObservableCollection<PathingTaskInfo> _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);
}
}

View File

@@ -0,0 +1,376 @@
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Data;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.Logging;
using BetterGenshinImpact.Core.Script;
using BetterGenshinImpact.Helpers;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using BetterGenshinImpact.Core.Config;
namespace BetterGenshinImpact.ViewModel.Windows.GearTask;
/// <summary>
/// 地图追踪任务选择窗口ViewModel
/// </summary>
public partial class PathingTaskSelectionViewModel : ViewModel
{
private readonly ILogger<PathingTaskSelectionViewModel> _logger = App.GetLogger<PathingTaskSelectionViewModel>();
/// <summary>
/// 地图追踪任务列表
/// </summary>
[ObservableProperty]
private ObservableCollection<PathingTaskInfo> _pathingTasks = new();
/// <summary>
/// 过滤后的地图追踪任务列表
/// </summary>
[ObservableProperty]
private ObservableCollection<PathingTaskInfo> _filteredPathingTasks = new();
/// <summary>
/// 当前选中的地图追踪任务
/// </summary>
[ObservableProperty]
private PathingTaskInfo? _selectedTask;
/// <summary>
/// 搜索关键词
/// </summary>
[ObservableProperty]
private string _searchKeyword = string.Empty;
/// <summary>
/// 显示模式true=显示到文件级别false=仅显示文件夹
/// </summary>
[ObservableProperty]
private bool _showFilesMode = true;
/// <summary>
/// 右侧显示的内容
/// </summary>
[ObservableProperty]
private string _displayContent = string.Empty;
/// <summary>
/// 右侧显示的内容类型JSON或README
/// </summary>
[ObservableProperty]
private string _displayContentType = string.Empty;
/// <summary>
/// 图标字典
/// </summary>
private Dictionary<string, string> _iconDictionary = new();
public PathingTaskSelectionViewModel()
{
// LoadIconDictionary();
LoadPathingTasks();
}
// /// <summary>
// /// 加载图标字典
// /// </summary>
// private void LoadIconDictionary()
// {
// try
// {
// var jsonContent = ResourceHelper.GetString("pack://application:,,,/Resources/Json/icons.json");
// if (string.IsNullOrEmpty(jsonContent))
// {
// return;
// }
// var iconArray = JsonConvert.DeserializeObject<JArray>(jsonContent);
// if (iconArray != null)
// {
// foreach (var item in iconArray)
// {
// var name = item["name"]?.ToString();
// var link = item["link"]?.ToString();
// if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(link))
// {
// _iconDictionary[name] = link;
// }
// }
// }
// }
// catch (Exception ex)
// {
// _logger.LogError(ex, "加载图标字典失败");
// }
// }
/// <summary>
/// 加载地图追踪任务
/// </summary>
private void LoadPathingTasks()
{
try
{
PathingTasks.Clear();
var pathingPath = Path.Combine(ScriptRepoUpdater.CenterRepoPath, "repo", "pathing");
if (!Directory.Exists(pathingPath))
{
_logger.LogWarning($"地图追踪任务目录不存在: {pathingPath}");
return;
}
// 加载根目录下的直接子项
LoadDirectChildrenFromDirectory(pathingPath, pathingPath, PathingTasks);
FilterTasks();
}
catch (Exception ex)
{
_logger.LogError(ex, "加载地图追踪任务失败");
}
}
/// <summary>
/// 从目录加载直接子项(用于构建层级结构)
/// </summary>
private void LoadDirectChildrenFromDirectory(string directoryPath, string rootPath, ObservableCollection<PathingTaskInfo> parentCollection)
{
try
{
// 加载文件夹
foreach (var dir in Directory.GetDirectories(directoryPath))
{
var taskInfo = new PathingTaskInfo(dir, rootPath)
{
IsDirectory = true
};
// 设置图标
SetTaskIcon(taskInfo);
// 加载README内容
LoadReadmeContent(taskInfo);
// 递归加载子目录到当前任务的Children集合中
LoadDirectChildrenFromDirectory(dir, rootPath, taskInfo.Children);
parentCollection.Add(taskInfo);
}
// 如果是显示文件模式加载JSON文件
if (ShowFilesMode)
{
foreach (var file in Directory.GetFiles(directoryPath, "*.json"))
{
var taskInfo = new PathingTaskInfo(file, rootPath)
{
IsDirectory = false
};
// 设置图标
SetTaskIcon(taskInfo);
// 加载JSON内容
LoadJsonContent(taskInfo);
parentCollection.Add(taskInfo);
}
}
}
catch (Exception ex)
{
_logger.LogError(ex, $"加载目录任务失败: {directoryPath}");
}
}
/// <summary>
/// 设置任务图标
/// </summary>
private void SetTaskIcon(PathingTaskInfo taskInfo)
{
// var fileName = Path.GetFileNameWithoutExtension(taskInfo.Name);
//
// if (_iconDictionary.TryGetValue(fileName, out var iconUrl))
// {
// taskInfo.IconUrl = iconUrl;
// taskInfo.UseSystemIcon = false;
// }
// else
// {
// taskInfo.UseSystemIcon = true;
// }
taskInfo.UseSystemIcon = true;
}
/// <summary>
/// 加载README内容
/// </summary>
private void LoadReadmeContent(PathingTaskInfo taskInfo)
{
try
{
if (taskInfo.IsDirectory)
{
var readmePath = Path.Combine(taskInfo.FullPath, "README.md");
if (File.Exists(readmePath))
{
taskInfo.ReadmeContent = File.ReadAllText(readmePath);
}
}
}
catch (Exception ex)
{
_logger.LogError(ex, $"加载README内容失败: {taskInfo.FullPath}");
}
}
/// <summary>
/// 加载JSON内容
/// </summary>
private void LoadJsonContent(PathingTaskInfo taskInfo)
{
try
{
if (!taskInfo.IsDirectory && taskInfo.FullPath.EndsWith(".json"))
{
var jsonContent = File.ReadAllText(taskInfo.FullPath);
// 格式化JSON
var jsonObject = JsonConvert.DeserializeObject(jsonContent);
taskInfo.JsonContent = JsonConvert.SerializeObject(jsonObject, Formatting.Indented);
}
}
catch (Exception ex)
{
_logger.LogError(ex, $"加载JSON内容失败: {taskInfo.FullPath}");
taskInfo.JsonContent = "JSON格式错误";
}
}
/// <summary>
/// 过滤任务
/// </summary>
private void FilterTasks()
{
FilteredPathingTasks.Clear();
foreach (var task in PathingTasks)
{
var filteredTask = FilterTaskRecursively(task);
if (filteredTask != null)
{
FilteredPathingTasks.Add(filteredTask);
}
}
}
/// <summary>
/// 递归过滤任务(支持搜索所有子节点)
/// </summary>
private PathingTaskInfo? FilterTaskRecursively(PathingTaskInfo task)
{
// 检查当前节点是否匹配搜索条件
bool currentMatches = string.IsNullOrWhiteSpace(SearchKeyword) ||
task.Name.Contains(SearchKeyword, StringComparison.OrdinalIgnoreCase) ||
task.RelativePath.Contains(SearchKeyword, StringComparison.OrdinalIgnoreCase);
// 根据显示模式过滤
bool modeMatches = ShowFilesMode || task.IsDirectory;
// 创建新的任务对象用于显示
var filteredTask = new PathingTaskInfo
{
Name = task.Name,
FolderName = task.FolderName,
FullPath = task.FullPath,
IsDirectory = task.IsDirectory,
JsonContent = task.JsonContent,
ReadmeContent = task.ReadmeContent,
IconUrl = task.IconUrl,
UseSystemIcon = task.UseSystemIcon,
ParentPath = task.ParentPath,
RelativePath = task.RelativePath
};
// 递归处理子节点
bool hasMatchingChildren = false;
foreach (var child in task.Children)
{
var filteredChild = FilterTaskRecursively(child);
if (filteredChild != null)
{
filteredTask.Children.Add(filteredChild);
hasMatchingChildren = true;
}
}
// 如果当前节点匹配条件且符合显示模式,或者有匹配的子节点,则返回该节点
if ((currentMatches && modeMatches) || hasMatchingChildren)
{
return filteredTask;
}
return null;
}
/// <summary>
/// 当选中任务改变时
/// </summary>
partial void OnSelectedTaskChanged(PathingTaskInfo? value)
{
if (value == null)
{
DisplayContent = string.Empty;
DisplayContentType = string.Empty;
return;
}
if (value.IsDirectory)
{
DisplayContent = value.ReadmeContent;
DisplayContentType = "README";
}
else
{
DisplayContent = value.JsonContent;
DisplayContentType = "JSON";
}
}
/// <summary>
/// 当搜索关键词改变时
/// </summary>
partial void OnSearchKeywordChanged(string value)
{
FilterTasks();
}
/// <summary>
/// 当显示模式改变时
/// </summary>
partial void OnShowFilesModeChanged(bool value)
{
LoadPathingTasks();
}
/// <summary>
/// 刷新任务列表
/// </summary>
[RelayCommand]
private void RefreshTasks()
{
LoadPathingTasks();
}
/// <summary>
/// 切换显示模式
/// </summary>
[RelayCommand]
private void ToggleShowMode()
{
ShowFilesMode = !ShowFilesMode;
}
}