Beispiel #1
0
        public void MonitorThreadProc()
        {
            while (true)
            {
                OSCManager.Update();

                Process[] processes = Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(_processName));
                if (processes != null && processes.Length > 0)
                {
                    foreach (Process p in processes)
                    {
                        if (!p.Responding || _restartRequested)
                        {
                            p.Kill();
                        }
                    }
                }
                else
                {
                    // Didn't find the process, start it now
                    Process p = new Process();
                    p.StartInfo.FileName        = _processName;
                    p.StartInfo.UseShellExecute = true;
                    p.StartInfo.LoadUserProfile = true;
                    p.Start();
                    Thread.Sleep(10000);
                }
                _restartRequested = false;

                Thread.Sleep(50);
            }
        }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        OSCManager.Update();

        if (_theShow != null)
        {
            if ((System.DateTime.Now - _lastStatusTime).TotalSeconds > 5)
            {
                OSCManager.SendToAll(new OSCMessage("/unity/server/status", null));
                _lastStatusTime = System.DateTime.Now;
            }

            if (_timerSeconds > 0)
            {
                System.TimeSpan ts = (System.DateTime.Now - _timerMarker);
                if (ts.TotalSeconds >= _timerSeconds)
                {
                    // Timer expired, go to the next step
                    Show_ExecuteStep();
                }
                else
                {
                    SetSecondaryShowText((_timerSeconds - ts.TotalSeconds).ToString("N3"));
                }
            }

            // Bypass gesture with space bar
            if (_waitingForGesture != null)
            {
                if (Input.GetKeyDown(KeyCode.Space))
                {
                    Show_ExecuteStep();
                }
            }
        }

        foreach (var kvp in _knownClients)
        {
            if (kvp.Value.Status == ClientInfo.ConnectionStatus.Normal &&
                ((System.DateTime.Now - kvp.Value.LastSeenTime).TotalSeconds > 5))
            {
                // This client hasn't been seen for 5 seconds
                kvp.Value.Status = ClientInfo.ConnectionStatus.NotResponding;
            }

            if (kvp.Value.Status == ClientInfo.ConnectionStatus.NotResponding &&
                ((System.DateTime.Now - kvp.Value.RestartMsgTime).TotalSeconds > 2))
            {
                // Its been more than 2 seconds since the restarter was notified, send it again
                OSCManager.SendTo(new OSCMessage("/unity/client/restart"), kvp.Value.IPAddress, RemoteManagerPort);
                kvp.Value.RestartMsgTime = System.DateTime.Now;
            }
        }
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        if ((System.DateTime.Now - _lastStatusTime).TotalSeconds >= 2)
        {
            OSCManager.SendToAll(new OSCMessage("/unity/client/status", _clientConfig.Id));
            _lastStatusTime = System.DateTime.Now;
        }

        if (_pendingSceneLoad != null && _pendingSceneLoad.isDone)
        {
            _pendingSceneLoad = null;
        }

        if (_pendingSceneLoad == null)
        {
            OSCManager.Update();                // Only process packets if pending scene loads are all done
        }
    }