This commit is contained in:
Namhyeon Go 2020-11-27 22:31:51 +09:00
parent 187adf9b34
commit 3fb0613444
2 changed files with 92 additions and 78 deletions

View File

@ -125,6 +125,14 @@ exports.getPIDList = function() {
return result; return result;
}; };
exports.isAlivePID = function(pid) {
if (!pid) {
return false;
} else {
return (exports.getPIDList().indexOf(pid) > -1);
}
};
exports.getProcessListByName = function(name) { exports.getProcessListByName = function(name) {
return exports.getProcessList().filter(function(s) { return exports.getProcessList().filter(function(s) {
return (s.Caption === name); return (s.Caption === name);

View File

@ -57,16 +57,18 @@ var check_LDPlayer = function() {
AppsMutex.push(pid); AppsMutex.push(pid);
if (title in Apps.LDPlayer) { if (title in Apps.LDPlayer) {
while (!SYS.isAlivePID(ssPID)) {
var ss = SS.connect(Apps.LDPlayer[title]); var ss = SS.connect(Apps.LDPlayer[title]);
ssPort = ss.listenPort; ssPort = ss.listenPort;
ssPID = ss.processID; ssPID = ss.processID;
}
} else { } else {
console.error("Not assigned static IP: " + title); console.error("Not assigned static IP: " + title);
continue; continue;
} }
var process; var process;
while (!(shadowPID > 0)) { while (!SYS.isAlivePID(shadowPID)) {
process = SHELL.createProcess([ process = SHELL.createProcess([
SYS.getCurrentScriptDirectory() + "/bin/shadow.exe", SYS.getCurrentScriptDirectory() + "/bin/shadow.exe",
"-c", "-c",
@ -76,7 +78,7 @@ var check_LDPlayer = function() {
"-p", "-p",
pid pid
]); ]);
sleep(1000); sleep(3000);
shadowPID = process.ProcessID; shadowPID = process.ProcessID;
} }
@ -102,16 +104,18 @@ var check_NoxPlayer = function() {
AppsMutex.push(pid); AppsMutex.push(pid);
if (hostname in Apps.NoxPlayer) { if (hostname in Apps.NoxPlayer) {
while (!SYS.isAlivePID(ssPID)) {
var ss = SS.connect(Apps.NoxPlayer[hostname]); var ss = SS.connect(Apps.NoxPlayer[hostname]);
ssPort = ss.listenPort; ssPort = ss.listenPort;
ssPID = ss.processID; ssPID = ss.processID;
}
} else { } else {
console.error("Not assigned static IP: " + hostname); console.error("Not assigned static IP: " + hostname);
continue; continue;
} }
var process; var process;
while (!(shadowPID > 0)) { while (!SYS.isAlivePID(shadowPID)) {
process = SHELL.createProcess([ process = SHELL.createProcess([
SYS.getCurrentScriptDirectory() + "/bin/shadow.exe", SYS.getCurrentScriptDirectory() + "/bin/shadow.exe",
"-c", "-c",
@ -121,7 +125,7 @@ var check_NoxPlayer = function() {
"-p", "-p",
pid pid
]); ]);
sleep(1000); sleep(3000);
shadowPID = process.ProcessID; shadowPID = process.ProcessID;
} }
@ -156,13 +160,15 @@ var check_ProcessName = function() {
AppsMutex.push("processName_" + uniqueId); AppsMutex.push("processName_" + uniqueId);
// 소켓 연결 // 소켓 연결
while (!SYS.isAlivePID(ssPID)) {
var ss = SS.connect(Apps.ProcessName[uniqueId]); var ss = SS.connect(Apps.ProcessName[uniqueId]);
ssPort = ss.listenPort; ssPort = ss.listenPort;
ssPID = ss.processID; ssPID = ss.processID;
}
// 프로세스 이름으로 실행 // 프로세스 이름으로 실행
var process; var process;
while (!(shadowPID > 0)) { while (!SYS.isAlivePID(shadowPID)) {
process = SHELL.createProcess([ process = SHELL.createProcess([
SYS.getCurrentScriptDirectory() + "/bin/shadow.exe", SYS.getCurrentScriptDirectory() + "/bin/shadow.exe",
"-c", "-c",
@ -172,7 +178,7 @@ var check_ProcessName = function() {
"-n", "-n",
uniqueId uniqueId
]); ]);
sleep(1000); sleep(3000);
shadowPID = process.ProcessID; shadowPID = process.ProcessID;
} }