예제 #1
0
 /// <summary>
 /// Marks OBS as closed and disconnected. If the Disconnect happened without obs being closed, it will reconnect to the Websocket.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void onDisconnect(object sender, EventArgs e)
 {
     onConnectTriggered = false;
     if (closingOBS)
     {
         opened     = false;
         closingOBS = false;
         supporterForm.writeInConsole(System.Drawing.Color.Red, "DISCONNECTED FROM WEBSOCKET");
         supporterForm.Invoke(new MethodInvoker(delegate { supporterForm.onDisconnect(); }));
         replayBufferState = false;
     }
     else
     {
         supporterForm.writeInConsole(System.Drawing.Color.Orange, "CONNECTION FAILED");
         if (obsProcess.HasExited)
         {
             supporterForm.Invoke(new MethodInvoker(delegate { supporterForm.onDisconnect(); }));
             replayBufferState = false;
         }
         else if (connectionAttempts < 5)
         {
             connectionAttempts++;
             thread = new Thread(new ThreadStart(connect));
             thread.Start();
         }
     }
 }