From 4a37f812eb74a50e9c68e132cd6ca22a7094c886 Mon Sep 17 00:00:00 2001 From: TomatoCake <60300461+DEVTomatoCake@users.noreply.github.com> Date: Sat, 18 May 2024 17:47:24 +0200 Subject: [PATCH] Auto detect rp mode in vsc ext --- assets/jszip.js | 7 +++---- vscExtension/package.json | 2 +- vscExtension/src/extension.js | 13 +++++++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/assets/jszip.js b/assets/jszip.js index 4f4998b..bec6540 100644 --- a/assets/jszip.js +++ b/assets/jszip.js @@ -9428,8 +9428,8 @@ https://github.com/nodeca/pako/blob/main/LICENSE //--- if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && - (state.mode < CHECK || flush !== Z_FINISH))) { - updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out) + (state.mode < CHECK || flush !== Z_FINISH))) { + updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out); } _in -= strm.avail_in; _out -= strm.avail_out; @@ -9481,7 +9481,6 @@ https://github.com/nodeca/pako/blob/main/LICENSE var state; var dictid; - var ret; /* check state */ if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } @@ -9502,7 +9501,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE } /* copy dictionary to window using updatewindow(), which will amend the existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary, dictLength, dictLength); + updatewindow(strm, dictionary, dictLength, dictLength); state.havedict = 1; // Tracev((stderr, "inflate: dictionary set\n")); return Z_OK; diff --git a/vscExtension/package.json b/vscExtension/package.json index 0b46ba3..c91a2f0 100644 --- a/vscExtension/package.json +++ b/vscExtension/package.json @@ -2,7 +2,7 @@ "name": "pack-analyzer", "displayName": "Minecraft Data and Resource pack Analyzer", "description": "Allows you to analyze and generate stats for [Minecraft](https://minecraft.net) Java Edition data and resource packs.", - "version": "1.0.0", + "version": "1.1.0", "publisher": "tomatocake", "main": "./out/extension", "browser": "./out/extension", diff --git a/vscExtension/src/extension.js b/vscExtension/src/extension.js index d0284bf..5209229 100644 --- a/vscExtension/src/extension.js +++ b/vscExtension/src/extension.js @@ -234,11 +234,20 @@ class PackAnalyzer { this.onDidChangeTreeData = this._onDidChangeTreeData.event } - refresh() { + async refresh() { files = 0 done = 0 error = 0 - rpMode = false //document.getElementById("radiorp").checked + + rpMode = false + try { + if (await vscode.workspace.fs.readDirectory("assets") && !await vscode.workspace.fs.readDirectory("data")) { + rpMode = true + log("Resource pack mode enabled") + } + } catch (e) { + log("Resource pack mode disabled (" + e.message + ")") + } filetypes = {} filetypesOther = {}