From 359da568d8018db4667c1b20b07dbb15cec32691 Mon Sep 17 00:00:00 2001 From: pc-ls Date: Thu, 7 Jul 2022 11:30:50 +0800 Subject: [PATCH] =?UTF-8?q?GenJson=20=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 +++- package.json | 1 + src/views/yeahmao/code_gen/codeGenJson.vue | 56 +++++++++++++++------- 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index a04d0e4..02eea09 100644 --- a/README.md +++ b/README.md @@ -79,4 +79,10 @@ npm run build -adapter=[chrome|edge|utools|firefox|web] ## 功能列表-yeahmao | 功能 | 说明 |离线使用| |--------------|-------------------------------------------------------------------------------------------------------------------------------|---| -| 字节转码 | `16进制字节流`, `美化后`, `字符串格式`, `字节数组格式`,`` |√| \ No newline at end of file +| 字节转码 | `x64dbg拷贝的汇编代码`, `美化后`, `字符串格式`, `字节数组格式`,`` |√| + +## 功能列表-代码生成器 +| 功能 | 说明 |离线使用| +|--------------|-------------------------------------------------------------------------------------------------------------------------------|---| +| GenJson | `k-v字符串列表转换为json`, `excel表中数据转json` |√| +| GenJava | `超长字符串报错`,`StringBuilder ==> str` |√| diff --git a/package.json b/package.json index 6202a7c..ba4cac0 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "scripts": { "serve": "vue-cli-service serve --port 8081", + "dev": "vue-cli-service serve --port 8081", "build": "vue-cli-service build --no-module", "lint": "vue-cli-service lint", "report": "vue-cli-service build --report" diff --git a/src/views/yeahmao/code_gen/codeGenJson.vue b/src/views/yeahmao/code_gen/codeGenJson.vue index a837305..b2ff7c6 100644 --- a/src/views/yeahmao/code_gen/codeGenJson.vue +++ b/src/views/yeahmao/code_gen/codeGenJson.vue @@ -25,6 +25,25 @@ import heightResize from "../../tool/components/heightResize"; import autoHeightTextarea from "../../tool/components/autoHeightTextarea"; export default { + data() { + return { + current: { + input: ` +123033 31 +123034 31 +123035 32 + `, + isUppercase: false, + output_beautiful: "", // 一行,全字节内容,美化的内容 + output_str: "", // 字符串格式 + output_bytes: "", // 字节数组格式 + output: "", + operation: "" + }, + inputHeight: 100, + outputHeight: 100 + } + }, components: { heightResize, autoHeightTextarea @@ -33,7 +52,7 @@ export default { this.$initToolData('input') }, methods: { - codeGenJson() { + codeGenJsonOld() { console.log('enter...') var objJson = {} if (this.current.input) { @@ -56,27 +75,32 @@ export default { console.log('leave...', objJson) this.current.output = JSON.stringify(objJson) }, + codeGenJson() { + console.log('enter...') + var objJson = {} + if (this.current.input) { + var lines = this.current.input.split('\n'); + lines.forEach(line => { + console.log(line) + line = line.trim().replace(/\s+/g, ' ') + var items = line.split(' ') + if (items.length != 2) { + console.log(items) + return + } + + objJson[items[0]] = items[1] + }) + } + console.log('leave...', objJson) + this.current.output = JSON.stringify(objJson) + }, resize(height) { this.inputHeight = Math.min(320, Math.ceil(height / 2)) this.outputHeight = height - this.inputHeight // this.outputHeight = 180 } }, - data() { - return { - current: { - input: "", - isUppercase: false, - output_beautiful: "", // 一行,全字节内容,美化的内容 - output_str: "", // 字符串格式 - output_bytes: "", // 字节数组格式 - output: "", - operation: "" - }, - inputHeight: 100, - outputHeight: 100 - } - }, } -- GitLab