UNPKG

fofstudio-mcpservererp

Version:

fofstudio

115 lines (108 loc) 2.55 kB
const { Notification, powerSaveBlocker, screen, shell} = require('electron'); const operativeSystemModule = require("os"); exports.getPlatform = () => { return process.platform; } exports.Notification = (data) => { try { if (data["图片地址"] != undefined) { if (data["图片地址"] != "") { new Notification({ title: data["标题"], body: data["内容"], icon: data["图片地址"] }).show(); return; } } new Notification({ title: data["标题"], body: data["内容"] }).show(); } catch (err) { } } exports.powerSaveBlocker = () => { try { const id = powerSaveBlocker.start('prevent-display-sleep') powerSaveBlocker.isStarted(id) powerSaveBlocker.stop(id) } catch (err) { } } exports.getCursorScreenPoint = () => { let Xy = screen.getCursorScreenPoint(); return { "横向位置": Xy["x"], "纵向位置": Xy["y"] }; } exports.dipToScreenPoint = (point) => { try { let XyYS = { "x": point["横向位置"], "y": point["纵向位置"] } let Xy = screen.dipToScreenPoint(XyYS); return { "横向位置": Xy["x"], "纵向位置": Xy["y"] }; } catch (err) { return { "横向位置": 0, "纵向位置": 0 }; } } exports.networkInterfaces = () => { return operativeSystemModule.networkInterfaces(); } exports.cpus = () => { return operativeSystemModule.cpus(); } exports.tmpDir = () => { return operativeSystemModule.tmpdir(); } exports.arch = () => { return operativeSystemModule.arch(); } exports.totalmem = () => { return operativeSystemModule.totalmem(); } exports.freemem = () => { return operativeSystemModule.freemem(); } exports.OStype = () => { return operativeSystemModule.type(); } exports.hostname = () => { return operativeSystemModule.hostname(); } exports.release = () => { return operativeSystemModule.release(); } exports.uptime = () => { return operativeSystemModule.uptime(); } exports.loadavg = () => { return operativeSystemModule.loadavg(); } exports.showItemInFolder = (fullPath) => { try { shell.showItemInFolder(fullPath) } catch (err) { } } exports.openPath = (fullPath) => { try { shell.openPath(fullPath) } catch (err) { } } exports.openExternal = (url) => { try { shell.openExternal(url) } catch (err) { } } exports.trashItem = (fullPath) => { try { shell.trashItem(fullPath) } catch (err) { } } exports.openItem = (fullPath) => { try { shell.openItem(fullPath) } catch (err) { } }