Esempio n. 1
0
        private void HandleDisconnect(BattlEyeDisconnectEventArgs args)
        {
            switch (args.DisconnectionType)
            {
            case EBattlEyeDisconnectionType.Manual:
                break;

            case EBattlEyeDisconnectionType.ConnectionLost:
                Console.WriteLine("Connection lost.");
                break;

            case EBattlEyeDisconnectionType.SocketException:
                Console.WriteLine("Invalid host");
                break;

            case EBattlEyeDisconnectionType.LoginFailed:
                Console.WriteLine("Login invalid!");
                break;

            case EBattlEyeDisconnectionType.ConnectionFailed:
                this.write("Could not connect to Battleye. (Is Battleye enabled?)", ConsoleColor.DarkRed);
                break;

            default:
                Console.WriteLine("Unknown Battleye error!");
                break;
            }
        }
Esempio n. 2
0
 private static void BattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     //if (args.DisconnectionType == BattlEyeDisconnectionType.ConnectionLost) { /* Connection lost (timeout), if ReconnectOnPacketLoss is set to true it will reconnect */ }
     //if (args.DisconnectionType == BattlEyeDisconnectionType.SocketException) { /* Something went terribly wrong... */ }
     //if (args.DisconnectionType == BattlEyeDisconnectionType.Manual) { /* Disconnected by implementing application, that would be you */ }
     Environment.Exit(0); // Выход при отключении
 }
Esempio n. 3
0
 void BattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     if (OnBeDisconnectedEvent != null)
     {
         OnBeDisconnectedEvent();
     }
 }
Esempio n. 4
0
        /* Private methods */
        private void Disconnected(BattlEyeDisconnectEventArgs pArgs)
        {
            SendMessage(new BE_Message(BE_MessageType.ServerDisconnected, null));

            if (pArgs.DisconnectionType != BattlEyeDisconnectionType.Manual)
            {
                while (BEClient.Connect() != BattlEyeConnectionResult.Success)
                {
                    Console.WriteLine("Attempting to reconnect to RCON server");
                    Thread.Sleep(Timeout);
                }
            }
        }
Esempio n. 5
0
        private void HandleDisconnect(BattlEyeDisconnectEventArgs args)
        {
            switch (args.DisconnectionType)
            {
            case BattlEyeDisconnectionType.ConnectionLost:
                if (!_reconnecting)
                {
                    if (_form != null)
                    {
                        _form.Log("Connection to server was lost. Attempting to reconnect...", LogType.Console, false);
                    }
                    this.Reconnect();
                }
                break;

            case BattlEyeDisconnectionType.Manual:
                // Handle manual reconnect
                break;

            case BattlEyeDisconnectionType.SocketException:
                if (_form.connect.Enabled)
                {
                    if (_form != null)
                    {
                        _form.Log("Host invalid!", LogType.Console, false);
                    }
                }
                else
                {
                    if (!_reconnecting)
                    {
                        if (_form != null)
                        {
                            _form.Log("It appears that the server went down. Attempting to reconnect...", LogType.Console, false);
                        }
                        this.Reconnect();
                    }
                }
                break;

            default:
                if (_form != null)
                {
                    _form.Log("Unknown error.", LogType.Console, false);
                }
                break;
            }
        }
Esempio n. 6
0
        private void HandleDisconnect(BattlEyeDisconnectEventArgs args)
        {
            switch (args.DisconnectionType)
            {
            case BattlEyeDisconnectionType.ConnectionLost:
                if (!_reconnecting)
                {
                    if (_form != null)
                    {
                        _form.Log(Resources.Strings.Error_conlost, LogType.Console, false);
                    }
                    this.Reconnect();
                }
                break;

            case BattlEyeDisconnectionType.Manual:
                // Handle manual reconnect
                break;

            case BattlEyeDisconnectionType.SocketException:
                if (_form.connect.Enabled)
                {
                    if (_form != null)
                    {
                        _form.Log(Resources.Strings.Error_sel_host, LogType.Console, false);
                    }
                }
                else
                {
                    if (!_reconnecting)
                    {
                        if (_form != null)
                        {
                            _form.Log(Resources.Strings.Error_sdown, LogType.Console, false);
                        }
                        this.Reconnect();
                    }
                }
                break;

            default:
                if (_form != null)
                {
                    _form.Log(Resources.Strings.Error_occ, LogType.Console, false);
                }
                break;
            }
        }
Esempio n. 7
0
        private void BattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
        {
            if (args.DisconnectionType == BattlEyeDisconnectionType.ConnectionLost)
            {
                this.Invoke((MethodInvoker) delegate() { this.BeginInvoke((MethodInvoker) delegate() { appendChat("\nConnection lost (timeout). Attempting to reconnect.\n", Color.Black); }); });
            }
            ;
            if (args.DisconnectionType == BattlEyeDisconnectionType.SocketException)
            {
                this.Invoke((MethodInvoker) delegate() { appendChat("\nConnection closed (socket error)\n", Color.Black); });
            }
            //if (args.DisconnectionType == BattlEyeDisconnectionType.Manual) { /* Disconnected by implementing application, that would be you */ }

            this.BeginInvoke((MethodInvoker) delegate() { this.txAll.AppendText("\n" + args.Message + "\n"); });
            this.Invoke((MethodInvoker) delegate() { handleDisconnect(); });
        }
Esempio n. 8
0
 private static void BattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     // This method decides what to do when getting disconnected from the BE server
     if (args.DisconnectionType == BattlEyeDisconnectionType.SocketException)
     {
         Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " Connection lost: Socket exception! Reconnecting in 5 seconds...");
         Thread.Sleep(5000);
         if (!beConn.b.Connected)
         {
             beConn.b.Connect();
         }
     }
     if (args.DisconnectionType == BattlEyeDisconnectionType.Manual)
     {
         Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " Connection lost: Disconnected");
     }
 }
Esempio n. 9
0
 private void Client_BattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     Task.Run(() =>
     {
         _busy = true;
         Console.WriteLine("Connection to the server has been lost...\n Will try to reconnect now!");
         for (int tries = 0; tries < _settings.repeat; tries++)
         {
             Console.WriteLine($"Try {tries}/{_settings.repeat}");
             int result = OpenConnection();
             if (result == 0)
             {
                 Console.WriteLine("Connection reestablished...");
                 _busy = false;
                 return;
             }
             Console.WriteLine("Connection could not be reestablished...");
             Task.Delay(5000);
         }
         Environment.Exit(1);
     });
 }
Esempio n. 10
0
        private void HandleDisconnect(BattlEyeDisconnectEventArgs args)
        {
            switch (args.DisconnectionType)
            {
            case EBattlEyeDisconnectionType.Manual:
                break;

            case EBattlEyeDisconnectionType.ConnectionLost:
                Console.WriteLine("Connection lost. Trying reconnect...");
                break;

            case EBattlEyeDisconnectionType.SocketException:
                Console.WriteLine("Invalid host");
                break;

            case EBattlEyeDisconnectionType.LoginFailed:
                Console.WriteLine("Login invalid!");
                break;

            default:
                Console.WriteLine("Unknown error");
                break;
            }
        }
Esempio n. 11
0
 private static void Disconnected(BattlEyeDisconnectEventArgs args)
 {
     Console.WriteLine(args.Message);
 }
Esempio n. 12
0
 private void BattlEyeServerBattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     OnDisconnectHandler();
 }
 private void OnBattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     BattlEyeDisconnected?.Invoke(args);
 }
Esempio n. 14
0
 protected virtual void OnBattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     BattlEyeDisconnected?.Invoke(args);
 }
Esempio n. 15
0
 private void OnBattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     _log.Info($"{_serverName}: Disconnected");
     BattlEyeDisconnected?.Invoke(args);
 }
Esempio n. 16
0
 private void BattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     AppConsole.Log("BE Disconnected", ConsoleColor.Yellow);
     Thread.Sleep(2000);
     Environment.Exit(0);
 }