zusbdll 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +17 -3
- package/package.json +1 -1
- package/test.js +8 -1
package/index.js
CHANGED
|
@@ -386,8 +386,21 @@ async function autoRun() {
|
|
|
386
386
|
data:null,
|
|
387
387
|
msg:'error'
|
|
388
388
|
}
|
|
389
|
+
|
|
390
|
+
// 添加路径信息到返回结果
|
|
391
|
+
const dllPath = path.join(__dirname, "lib", "SG.dll");
|
|
392
|
+
const scenarioPath = path.join(__dirname, "lib", "scenario.json");
|
|
393
|
+
|
|
394
|
+
res.paths = {
|
|
395
|
+
dllPath: dllPath,
|
|
396
|
+
scenarioPath: scenarioPath,
|
|
397
|
+
executableDir: EXECUTABLE_DIR,
|
|
398
|
+
executablePath: EXECUTABLE_PATH,
|
|
399
|
+
workingDir: __dirname
|
|
400
|
+
};
|
|
401
|
+
|
|
389
402
|
try {
|
|
390
|
-
const scenarioPath = path.join(__dirname, "lib", "scenario.json");
|
|
403
|
+
// const scenarioPath = path.join(__dirname, "lib", "scenario.json");
|
|
391
404
|
const result = await executeZusbdll(scenarioPath);
|
|
392
405
|
// res.result=result;
|
|
393
406
|
// 解析返回的 JSON 数据
|
|
@@ -420,11 +433,12 @@ async function autoMD5() {
|
|
|
420
433
|
msg:'error'
|
|
421
434
|
}
|
|
422
435
|
try {
|
|
423
|
-
|
|
436
|
+
const dllpath = path.join(__dirname, "lib", "SG.dll");
|
|
437
|
+
let md5v=await calculateMD5(dllpath)
|
|
424
438
|
res.code=0;
|
|
425
439
|
res.data=md5v;
|
|
426
440
|
res.msg='success';
|
|
427
|
-
} catch (
|
|
441
|
+
} catch (err) {
|
|
428
442
|
res.data=err;
|
|
429
443
|
res.msg=err.message;
|
|
430
444
|
}
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -56,10 +56,17 @@ try {
|
|
|
56
56
|
console.log('start')
|
|
57
57
|
res = await autoRun();
|
|
58
58
|
resmd5 = await autoMD5();
|
|
59
|
+
console.log(res)
|
|
59
60
|
console.log(resmd5)
|
|
60
61
|
} catch (error) {
|
|
61
62
|
console.log("错误详情:", error);
|
|
62
63
|
}
|
|
63
64
|
})()
|
|
64
65
|
|
|
65
|
-
module.exports = { runDemo };
|
|
66
|
+
module.exports = { runDemo };
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
const crypto = require('crypto');
|
|
71
|
+
|
|
72
|
+
// console.log(crypto.createHash('md5').update('abc123').digest('hex'));
|