dev #14

Merged
HorizonCode merged 6 commits from dev into master 2024-04-14 15:32:58 +00:00
2 changed files with 36 additions and 0 deletions
Showing only changes of commit 528af70446 - Show all commits

20
electron/netUtils.js Normal file
View File

@ -0,0 +1,20 @@
const { exec } = require("child_process");
async function isNet8Installed() {
return new Promise((resolve, reject) => {
exec("dotnet --version", (error, stdout, stderr) => {
if (error) {
resolve(false);
return;
}
if (stderr) {
resolve(false);
return;
}
const version = stdout.trim();
resolve(version.startsWith("8."));
})
});
}
module.exports = { isNet8Installed };

16
main.js
View File

@ -37,6 +37,7 @@ const { appName, appVersion } = require("./electron/appInfo");
const { updateAvailable, releasesUrl } = require("./electron/updateCheck"); const { updateAvailable, releasesUrl } = require("./electron/updateCheck");
const fkill = require("fkill"); const fkill = require("fkill");
const { checkImageExists } = require("./electron/imageUtil"); const { checkImageExists } = require("./electron/imageUtil");
const { isNet8Installed } = require("./electron/netUtils");
// Keep a global reference of the window object, if you don't, the window will // Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected. // be closed automatically when the JavaScript object is garbage collected.
@ -209,6 +210,10 @@ function stopOsuStatus() {
} }
function registerIPCPipes() { function registerIPCPipes() {
(async () => {
const isNet8 = await isNet8Installed();
console.log("net8:", isNet8);
})();
ipcMain.handle("ezpplauncher:login", async (e, args) => { ipcMain.handle("ezpplauncher:login", async (e, args) => {
const hwid = getHwId(); const hwid = getHwId();
const timeout = new AbortController(); const timeout = new AbortController();
@ -415,6 +420,17 @@ function registerIPCPipes() {
}); });
return; return;
} }
if (patch) {
if (!(await isNet8Installed())) {
mainWindow.webContents.send("ezpplauncher:launchabort");
mainWindow.webContents.send("ezpplauncher:alert", {
type: "error",
message: ".NET 8 is not installed.",
});
//open .net 8 download in browser
shell.openExternal('https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-8.0.4-windows-x64-installer');
}
}
mainWindow.webContents.send("ezpplauncher:launchstatus", { mainWindow.webContents.send("ezpplauncher:launchstatus", {
status: "Checking for osu! updates...", status: "Checking for osu! updates...",
}); });