private void HandleDataForLoggingIn(string packet) { if (packet.Length > 0) { #if DEBUG Console.WriteLine("Got Data from Server:"); Console.WriteLine(packet); #endif if (packet[0] == '<' && !IsLoggedIn) { if (packet.ToLowerInvariant().Contains("cross-domain")) { _countForServerDisconnections++; if (_countForServerDisconnections == 1) { if (_socket != null) { _socket.BeginDisconnect(true, DisconnectCallback, _socket); } } else if (_countForServerDisconnections >= 2) { var _loc3_ = "tsys"; var loc2 = $"<ver v=\'{Version}\' />"; Send(_loc3_, "verChk", 0, loc2); _waitForReconnect?.Abort(); } } else if (packet.ToLowerInvariant().Contains("apiok")) { WasConnected = true; Connected?.Invoke(); LogMessage?.Invoke("Sending authentication to the server...."); Login(Zone, Username, HashPassword); } else if (packet.Contains("rmList")) { AutoJoin(); } else if (packet.Contains("joinOK")) { IsLoggedIn = true; JoinedRoom?.Invoke(); } } else if (packet.Contains("xt") && packet.Contains("l") && packet.Contains("-1")) { SuccessfullyAuthenticated?.Invoke(); GetRoomList(); } } }
private void HandleDataForLoggingIn(string packet) { if (packet.Length > 0) { #if DEBUG Console.WriteLine("Got Data from Server:"); Console.WriteLine(packet); #endif if (packet[0] == '<' && !IsLoggedIn) { if (packet.ToLowerInvariant().Contains("cross-domain")) { _countForServerDisconnections++; if (_countForServerDisconnections == 1) { if (_socket != null) { _socket.BeginDisconnect(true, DisconnectCallback, _socket); } } else if (_countForServerDisconnections >= 2) { var _loc3_ = "tsys"; var loc2 = $"<ver v=\'{Version}\' />"; Send(_loc3_, "verChk", 0, loc2); } } else if (packet.ToLowerInvariant().Contains("apiok")) { WasConnected = true; Connected?.Invoke(); LogMessage?.Invoke("Sending authentication to the server...."); // Auto loggs in... Login(Zone, Username, HashPassword); _checkForLogin = ExecutionPlan.Delay(TimeoutDelay, delegate { if (!_isLoggedIn) { Close(new Exception("Authentication timedout. This happened because either your account is already logged in a browser or either your account got banned.")); } }); } else if (packet.Contains("rmList")) { AutoJoin(); } else if (packet.Contains("joinOK")) { IsLoggedIn = true; JoinedRoom?.Invoke(); } } else if (packet.Contains("xt") && packet.Contains("l") && packet.Contains("-1")) { _isLoggedIn = true; SuccessfullyAuthenticated?.Invoke(); GetRoomList(); } } }