|
|
|
|
|
|
} |
|
|
|
Process[] after = null; |
|
|
|
|
|
|
|
int maxAttempts = 5; |
|
|
|
int maxAttempts = 20; |
|
|
|
Thread.Sleep(1000); |
|
|
|
Thread.Sleep(200); |
|
|
|
after = Process.GetProcesses(); |
|
|
|
newVisualizerPID = GetNewProcessID(before, after, nameOfVisualizerProcess); |
|
|
|
if(attempts == maxAttempts) |
|
|
|
|
|
|
attempts = 0; |
|
|
|
while(newPythonPID == -1) |
|
|
|
{ |
|
|
|
Thread.Sleep(1000); |
|
|
|
Thread.Sleep(200); |
|
|
|
after = Process.GetProcesses(); |
|
|
|
newPythonPID = GetNewProcessID(before, after, "python"); |
|
|
|
if(attempts == maxAttempts) |
|
|
|
|
|
|
attempts = 0; |
|
|
|
while(newPort == -1) |
|
|
|
{ |
|
|
|
Thread.Sleep(1000); |
|
|
|
Thread.Sleep(200); |
|
|
|
newPort = GetPortForPID(newPythonPID); |
|
|
|
if(attempts == maxAttempts) |
|
|
|
{ |
|
|
|
|
|
|
StartInfo.Arguments = "-a -n -o"; |
|
|
|
#elif UNITY_EDITOR_OSX
|
|
|
|
StartInfo.FileName = "netstat"; |
|
|
|
StartInfo.Arguments = "-v -a"; |
|
|
|
StartInfo.Arguments = "-n -v -a"; |
|
|
|
#endif
|
|
|
|
StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
|
|
|
StartInfo.UseShellExecute = false; |
|
|
|