2026-02-04 11:25:30 +01:00
|
|
|
import type { Socket } from "net";
|
|
|
|
|
|
|
|
|
|
let electronSocket: Socket;
|
2019-11-30 01:30:22 +01:00
|
|
|
|
2021-07-02 02:04:23 +02:00
|
|
|
export = (socket: Socket, app: Electron.App) => {
|
2026-02-04 11:25:30 +01:00
|
|
|
electronSocket = socket;
|
2019-11-30 01:30:22 +01:00
|
|
|
|
2026-02-04 11:25:30 +01:00
|
|
|
socket.on(
|
|
|
|
|
"appCommandLineAppendSwitch",
|
|
|
|
|
(the_switch: string, value: string) => {
|
|
|
|
|
app.commandLine.appendSwitch(the_switch, value);
|
|
|
|
|
},
|
|
|
|
|
);
|
2019-11-30 01:30:22 +01:00
|
|
|
|
2026-02-04 11:25:30 +01:00
|
|
|
socket.on("appCommandLineAppendArgument", (value: string) => {
|
|
|
|
|
app.commandLine.appendArgument(value);
|
|
|
|
|
});
|
2019-11-30 01:30:22 +01:00
|
|
|
|
2026-02-04 11:25:30 +01:00
|
|
|
socket.on("appCommandLineHasSwitch", (value: string) => {
|
|
|
|
|
const hasSwitch = app.commandLine.hasSwitch(value);
|
|
|
|
|
electronSocket.emit("appCommandLineHasSwitchCompleted", hasSwitch);
|
|
|
|
|
});
|
2019-11-30 01:30:22 +01:00
|
|
|
|
2026-02-04 11:25:30 +01:00
|
|
|
socket.on("appCommandLineGetSwitchValue", (the_switch: string) => {
|
|
|
|
|
const value = app.commandLine.getSwitchValue(the_switch);
|
|
|
|
|
electronSocket.emit("appCommandLineGetSwitchValueCompleted", value);
|
|
|
|
|
});
|
2019-11-30 01:30:22 +01:00
|
|
|
};
|