From cc73a1dd283674bb57cd8f89e02dfd885ef96770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 1 Apr 2024 17:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=B5=84=E6=BA=90=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extension.ts | 12 +++++++++++- src/preset/ui.ts | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 93916fb..f7190de 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -470,7 +470,17 @@ class Helper { private registerCommandOfDownloadPresetUI() { vscode.commands.registerCommand('y3-helper.downloadPresetUI', async () => { - return; + // await env.mapReady(true); + // if (!env.mapUri) { + // vscode.window.showErrorMessage("未找到地图路径!"); + // return false; + // }; + // await vscode.window.withProgress({ + // location: vscode.ProgressLocation.Notification, + // title: '正在下载预设UI...', + // }, async (progress, token) => { + // await new preset.UI().download("https://up5.nosdn.127.net/editor/zip/edc461b312fc308779be9273a2cee6bb"); + // }); }); } diff --git a/src/preset/ui.ts b/src/preset/ui.ts index c5dd31f..fb8b508 100644 --- a/src/preset/ui.ts +++ b/src/preset/ui.ts @@ -168,7 +168,12 @@ export class UI { ignoreAttributes: false, }).parse(xmlContent) ?? {}; } catch { - localXml = {}; + localXml = { + "?xml": { + "@_version": "1.0", + "@_encoding": "utf-8", + }, + }; } let items = this.getXmlItem(localXml, 'Repository.Items.Item'); items = typeof items === 'object' ? items : [];