welsonjs/lib/noxplayer.js

53 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-10-19 08:11:56 +00:00
////////////////////////////////////////////////////////////////////////
2020-12-07 03:48:37 +00:00
// NoxPlayer API
2020-10-19 08:11:56 +00:00
///////////////////////////////////////////////////////////////////////
var SHELL = require("lib/shell");
var SYS = require("lib/system");
2020-12-07 03:48:37 +00:00
exports.VERSIONINFO = "NoxPlayer (noxplayer.js) version 0.2";
2020-10-19 08:11:56 +00:00
exports.global = global;
exports.require = global.require;
exports.getList = function() {
2020-10-20 02:41:26 +00:00
var data = [];
2020-12-07 03:48:37 +00:00
var commands = [
[SYS.getEnvString("PROGRAMFILES(X86)") + "/Nox/bin/NoxConsole", "list"]
];
for (var i = 0; i < commands.length; i++) {
var result = SHELL.exec(commands[i]);
var lines = result.split(/\r?\n/);
for(var k = 0; k < lines.length; k++) {
var row = lines[k].split(',');
if(row.length == 7) {
data.push({
index: row[0],
name: row[1],
title: row[2],
handle1: row[3],
handle2: row[4],
handle3: row[5],
PID: parseInt(row[6]),
handle4: -1
});
} else if(row.length == 8) {
data.push({
index: row[0],
name: row[1],
title: row[2],
handle1: row[3],
handle2: row[4],
handle3: row[5],
PID: parseInt(row[6]),
handle4: row[7]
});
}
}
2020-10-20 02:41:26 +00:00
}
2020-10-19 08:11:56 +00:00
2020-12-07 03:48:37 +00:00
return data;
2020-10-19 08:11:56 +00:00
};