diff --git a/.vscode/launch.json b/.vscode/launch.json index a595d1f..7edb612 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,11 @@ "request": "launch", "program": "${workspaceRoot}/src/setup.js", "stopOnEntry": false, - "args": [], + "args": [ + "--debug-mode", + "--input", + "D:/workspace/p4/TGF/TGF_Main/Client/Projects/TGF/Plugins/TGFBattleUtility/Install/Shared/Xml/xresconv.install.verify.xml" + ], "cwd": "${workspaceRoot}", "preLaunchTask": null, "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", diff --git a/CHANGELOG.md b/CHANGELOG.md index 054458b..17f9434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ 更新记录 ========== +2.5.1 +------ + +1. 调试选项 `--debug` 改为 `--debug-mode` 以适配冲突。 +2. 修复 `--input` 失效的问题。 + 2.5.0 ------ diff --git a/package-lock.json b/package-lock.json index 6847653..be93373 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "xresconv-gui", - "version": "2.5.0", + "version": "2.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "xresconv-gui", - "version": "2.5.0", + "version": "2.5.1", "license": "MIT", "dependencies": { "@popperjs/core": "^2.11.8", diff --git a/package.json b/package.json index c623fca..ca69f90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xresconv-gui", - "version": "2.5.0", + "version": "2.5.1", "publisher": "owent", "description": "xresconv 批量转表工具-GUI\r ==========", "main": "src/setup.js", diff --git a/src/main.js b/src/main.js index 3544167..899883f 100644 --- a/src/main.js +++ b/src/main.js @@ -913,7 +913,17 @@ function alert_warning(content, tittle, options) { } } - function get_string_file(file_path, data) { + async function get_string_file(file_path, data) { + if (!data) { + const fs = require("fs"); + try { + data = await fs.promises.readFile(file_path, { encoding: "utf8" }); + } catch (err) { + logger_append_error_message(err); + alert_error(err.toString(), "加载 " + file_path + " 失败"); + } + } + const ret = { path: file_path, filename: "", @@ -946,7 +956,7 @@ function alert_warning(content, tittle, options) { const file = sel_dom.files.length > 0 ? sel_dom.files[0] : null; if (file) { - return get_string_file( + return await get_string_file( file.path || (function () { const { webUtils } = require("electron"); @@ -956,15 +966,7 @@ function alert_warning(content, tittle, options) { await file.text() ); } else { - const fs = require("fs"); - let data = null; - try { - data = fs.readFileSync(sel_dom.value, { encoding: "utf8" }); - } catch (err) { - logger_append_error_message(err); - alert_error(err.toString(), "加载 " + sel_dom.value + " 失败"); - } - return get_string_file(sel_dom.value, data); + return await get_string_file(sel_dom.value); } } @@ -2687,8 +2689,10 @@ function alert_warning(content, tittle, options) { var input_file = location.search.match(/input=([^\\&\\#]+)/i); if (input_file && input_file.length > 1) { const init_file_path = decodeURIComponent(input_file[1]); - console.log("open file: " + init_file_path); - on_load_conv_list_file(get_string_file(init_file_path)); + (async function () { + console.log("open file: " + init_file_path); + on_load_conv_list_file(await get_string_file(init_file_path)); + })(); } } diff --git a/src/setup.js b/src/setup.js index 8600ff9..8508bdb 100644 --- a/src/setup.js +++ b/src/setup.js @@ -153,7 +153,7 @@ function createWindow() { param_mode = INPUT_PARAMS_MODE.INPUT_FILE; } else if (v == "--custom-selector" || v == "--custom-button") { param_mode = INPUT_PARAMS_MODE.CUSTOM_BUTTON; - } else if (v == "--debug") { + } else if (v == "--debug-mode") { app_config.debug = true; } else if (v == "--log-configure") { param_mode = INPUT_PARAMS_MODE.LOG_CONFIGURE; diff --git a/yarn.lock b/yarn.lock index 324d66f..2d081a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -520,7 +520,21 @@ debug@^2.2.0: dependencies: ms "2.0.0" -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: +debug@^4.0.1: + version "4.3.3" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== + dependencies: + ms "2.1.2" + +debug@^4.1.0: + version "4.3.3" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== + dependencies: + ms "2.1.2" + +debug@^4.1.1: version "4.3.3" resolved "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz" integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== @@ -709,13 +723,6 @@ fastq@^1.13.0: dependencies: reusify "^1.0.4" -fd-slicer2@^1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/fd-slicer2/-/fd-slicer2-1.2.0.tgz" - integrity sha512-3lBUNUckhMZduCc4g+Pw4Ve16LD9vpX9b8qUkkKq2mgDRLYWzblszZH2luADnJqjJe+cypngjCuKRm/IW12rRw== - dependencies: - pend "^1.2.0" - fd-slicer@~1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz" @@ -723,6 +730,13 @@ fd-slicer@~1.1.0: dependencies: pend "~1.2.0" +fd-slicer2@^1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/fd-slicer2/-/fd-slicer2-1.2.0.tgz" + integrity sha512-3lBUNUckhMZduCc4g+Pw4Ve16LD9vpX9b8qUkkKq2mgDRLYWzblszZH2luADnJqjJe+cypngjCuKRm/IW12rRw== + dependencies: + pend "^1.2.0" + filename-reserved-regex@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz" @@ -1133,7 +1147,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@2: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -1268,7 +1282,7 @@ jquery.fancytree@^2.38.3: resolved "https://registry.npmjs.org/jquery.fancytree/-/jquery.fancytree-2.38.3.tgz" integrity sha512-C3CJcp4sPThy497YBXZNrDSVn/B34sv6kB+toC8gfHrPvJWgYkL3NSMovBxXo6fN6yXUnvWhWaON/ejG3Nsxdg== -jquery@^3.7.1: +jquery@^3.7.1, jquery@>=1.9: version "3.7.1" resolved "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz" integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg== @@ -1422,15 +1436,15 @@ mimic-response@^3.1.0: minimatch@^10.0.1: version "10.0.1" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.1.tgz#ce0521856b453c86e25f2c4c0d03e6ff7ddc440b" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz" integrity sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ== dependencies: brace-expansion "^2.0.1" minimatch@^3.0.4: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + version "3.0.4" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" @@ -1471,7 +1485,7 @@ normalize-package-data@^2.3.2: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@3.0.0, normalize-path@^3.0.0, normalize-path@~3.0.0: +normalize-path@^3.0.0, normalize-path@~3.0.0, normalize-path@3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== @@ -1871,12 +1885,12 @@ semver-greatest-satisfied-range@^2.0.0: dependencies: sver "^1.8.3" -"semver@2 || 3 || 4 || 5": - version "5.7.2" - resolved "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz" - integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== +semver@^6.2.0: + version "6.3.1" + resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^6.2.0, semver@^6.3.0: +semver@^6.3.0: version "6.3.1" resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== @@ -1888,6 +1902,11 @@ semver@^7.1.3, semver@^7.3.2: dependencies: lru-cache "^6.0.0" +"semver@2 || 3 || 4 || 5": + version "5.7.2" + resolved "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== + serialize-error@^7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz" @@ -1980,6 +1999,13 @@ streamx@^2.12.0, streamx@^2.12.5, streamx@^2.13.2, streamx@^2.14.0: optionalDependencies: bare-events "^2.2.0" +string_decoder@^1.1.1, string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" @@ -1989,13 +2015,6 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string_decoder@^1.1.1, string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" @@ -2256,8 +2275,9 @@ xmlbuilder@^9.0.7: resolved "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz" integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0= -"xresconv-gui@file:.": - version "2.5.0" +"xresconv-gui@file:": + version "2.5.1" + resolved "file:" dependencies: "@popperjs/core" "^2.11.8" adm-zip "^0.5.16" @@ -2267,7 +2287,7 @@ xmlbuilder@^9.0.7: jquery.fancytree "^2.38.3" log4js "^6.9.1" minimatch "^10.0.1" - xresconv-gui "file:." + xresconv-gui "file:" xtend@^4.0.0: version "4.0.2"