示例#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;
            }
        }
示例#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); // Выход при отключении
 }
示例#3
0
 void BattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     if (OnBeDisconnectedEvent != null)
     {
         OnBeDisconnectedEvent();
     }
 }
示例#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);
                }
            }
        }
示例#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;
            }
        }
示例#6
0
文件: RCon.cs 项目: aimrabbit/DaRT
        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;
            }
        }
示例#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(); });
        }
示例#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");
     }
 }
示例#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);
     });
 }
示例#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;
            }
        }
示例#11
0
 private static void Disconnected(BattlEyeDisconnectEventArgs args)
 {
     Console.WriteLine(args.Message);
 }
示例#12
0
 private void BattlEyeServerBattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     OnDisconnectHandler();
 }
 private void OnBattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     BattlEyeDisconnected?.Invoke(args);
 }
示例#14
0
 protected virtual void OnBattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     BattlEyeDisconnected?.Invoke(args);
 }
示例#15
0
 private void OnBattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     _log.Info($"{_serverName}: Disconnected");
     BattlEyeDisconnected?.Invoke(args);
 }
示例#16
0
 private void BattlEyeDisconnected(BattlEyeDisconnectEventArgs args)
 {
     AppConsole.Log("BE Disconnected", ConsoleColor.Yellow);
     Thread.Sleep(2000);
     Environment.Exit(0);
 }