mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-15 15:19:59 +08:00
调整C#调用方式,减少编译次数,优化参数传递
This commit is contained in:
@@ -1,16 +1,9 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
// 读取 monitor.cs 模板
|
||||
const monitorTemplate = fs.readFileSync(
|
||||
path.join(__dirname, "..", "..", "csharp", "monitor.cs"),
|
||||
"utf8"
|
||||
);
|
||||
const { runCsharpFeature } = require("../../csharp");
|
||||
|
||||
// 监控剪贴板变化
|
||||
const watchClipboard = async function () {
|
||||
const args = ["-type", "clipboard", "-once"];
|
||||
const result = await quickcommand.runCsharp(monitorTemplate, args);
|
||||
const result = await runCsharpFeature("monitor", args);
|
||||
if (result && result.startsWith("Error:")) {
|
||||
throw new Error(result.substring(7));
|
||||
}
|
||||
@@ -35,7 +28,7 @@ const watchFileSystem = async function (watchPath, options = {}) {
|
||||
args.push("-recursive", "false");
|
||||
}
|
||||
|
||||
const result = await quickcommand.runCsharp(monitorTemplate, args);
|
||||
const result = await runCsharpFeature("monitor", args);
|
||||
if (result && result.startsWith("Error:")) {
|
||||
throw new Error(result.substring(7));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user