diff options
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/index.js b/src/index.js index 53781dd..c03326c 100644 --- a/src/index.js +++ b/src/index.js @@ -38,6 +38,12 @@ function start() { ipcMain.on("ns-updated", () => {win.webContents.send("ns-updated")}) ipcMain.on("ns-updating", () => {win.webContents.send("ns-updating")}) ipcMain.on("winLog", (event, ...args) => {win.webContents.send("log", ...args)}) + ipcMain.on("winAlert", (event, ...args) => {win.webContents.send("alert", ...args)}) + ipcMain.on("guigetmods", (event, ...args) => {win.webContents.send("mods", utils.mods.list())}) + + win.webContents.once("dom-ready", () => { + win.webContents.send("mods", utils.mods.list()); + }); if (utils.settings.autoupdate) {utils.updatevp(false)} @@ -49,6 +55,13 @@ function start() { autoUpdater.quitAndInstall(); }) + ipcMain.on("removemod", (event, mod) => {utils.mods.remove(mod)}) + ipcMain.on("togglemod", (event, mod) => {utils.mods.toggle(mod)}) + ipcMain.on("installmod", () => { + dialog.showOpenDialog({properties: ["openFile"]}).then(res => { + utils.mods.install(res.filePaths[0]); + }).catch(err => {console.error(err)}) + }) } ipcMain.on("launch", (event) => {utils.launch()}) @@ -91,6 +104,28 @@ ipcMain.on("versioncli", () => { cli.exit(); }) +ipcMain.on("getmods", (event) => { + let mods = utils.mods.list(); + if (mods.all.length > 0) { + console.log(`${utils.lang("general.mods.installed")} ${mods.all.length}`) + console.log(`${utils.lang("general.mods.enabled")} ${mods.enabled.length}`) + for (let i = 0; i < mods.enabled.length; i++) { + console.log(` ${mods.enabled[i].Name} ${mods.enabled[i].Version}`) + } + + if (mods.disabled.length > 0) { + console.log(`${utils.lang("general.mods.disabled")} ${mods.disabled.length}`) + for (let i = 0; i < mods.disabled.length; i++) { + console.log(` ${mods.disabled[i].Name} ${mods.disabled[i].Version}`) + } + } + cli.exit(0); + } else { + console.log("No mods installed"); + cli.exit(0); + } +}) + process.chdir(app.getPath("appData")); if (cli.hasArgs()) { |