protected NetworkHelperStatus LoginMaster() { NetworkHelperStatus rv = networkHelper.LoginMaster(loginSettings); log.InfoFormat("Login return: {0}", rv); switch (rv) { case NetworkHelperStatus.Success: break; case NetworkHelperStatus.LoginFailure: StatusMessage = ""; ErrorMessage = "Invalid username or password"; break; case NetworkHelperStatus.MasterTcpConnectFailure: StatusMessage = ""; ErrorMessage = "Unable to connect to master tcp server"; break; default: StatusMessage = ""; ErrorMessage = "Unable to login"; break; } return(rv); }
public void LoginMaster(string worldId) { // MessageBox.Show(string.Format("In Login: {0}:{1} => {2} {3}", username, password, worldId, remember)); Trace.TraceInformation("LoginButton_Click"); loginSettings.username = username; loginSettings.password = password; loginSettings.worldId = worldId; StatusMessage = "Connecting ..."; NetworkHelperStatus rv = networkHelper.LoginMaster(loginSettings); System.Diagnostics.Trace.TraceInformation("Login return: " + rv); switch (rv) { case NetworkHelperStatus.WorldResolveSuccess: System.Diagnostics.Trace.TraceInformation("Success: " + rv); break; case NetworkHelperStatus.WorldResolveFailure: StatusMessage = ""; ErrorMessage = "Unable to resolve world id"; break; case NetworkHelperStatus.LoginFailure: StatusMessage = ""; ErrorMessage = "Invalid username or password"; break; case NetworkHelperStatus.MasterTcpConnectFailure: case NetworkHelperStatus.MasterConnectFailure: StatusMessage = ""; ErrorMessage = "Unable to connect to master server"; break; default: StatusMessage = ""; ErrorMessage = "Unable to login"; break; } }
public void LoginMaster(string worldId) { // MessageBox.Show(string.Format("In Login: {0}:{1} => {2} {3}", username, password, worldId, remember)); log.Info("LoginButton_Click"); loginSettings.username = username; loginSettings.password = password; loginSettings.worldId = worldId; StatusMessage = "Logging In ..."; NetworkHelperStatus rv = LoginMaster(); if (rv != NetworkHelperStatus.Success) { return; } StatusMessage = "Resolving World ..."; ResolveWorld(); }
public bool SetWorld(string worldId) { string savedWorldId = loginSettings.worldId; if (!networkHelper.HasWorldEntry(loginSettings.worldId)) { NetworkHelperStatus status = networkHelper.ResolveWorld(loginSettings); if (status != NetworkHelperStatus.WorldResolveSuccess) { // revert the loginSettings loginSettings.worldId = savedWorldId; return(false); } } WorldServerEntry entry = networkHelper.GetWorldEntry(worldId); parentForm.AbortUpdate(); parentForm.Updater.FullScan = false; parentForm.Updater.BaseDirectory = entry.WorldRepository; parentForm.Updater.UpdateUrl = entry.UpdateUrl; parentForm.Updater.SetupLog(logFile); return(true); }
protected NetworkHelperStatus ResolveWorld() { // We may already have the world entry.. if so, skip the resolve if (networkHelper.HasWorldEntry(loginSettings.worldId)) { parentForm.DialogResult = DialogResult.OK; parentForm.Close(); return(NetworkHelperStatus.WorldResolveSuccess); } NetworkHelperStatus rv = networkHelper.ResolveWorld(loginSettings); switch (rv) { case NetworkHelperStatus.WorldResolveSuccess: parentForm.DialogResult = DialogResult.OK; log.InfoFormat("Success: {0}", rv); parentForm.Close(); break; case NetworkHelperStatus.WorldResolveFailure: StatusMessage = ""; ErrorMessage = "Unable to resolve world id"; break; case NetworkHelperStatus.MasterConnectFailure: StatusMessage = ""; ErrorMessage = "Unable to connect to master rdp server"; break; default: StatusMessage = ""; ErrorMessage = "Unable to resolve world"; break; } return(rv); }
/// <summary> /// Overridden to switch to event based keyboard input. /// </summary> /// <returns></returns> protected bool Setup() { #if USE_PERFORMANCE_COUNTERS SetupPerformanceCategories(); CreateCounters(); #endif this.Tick += new TickEvent(OnTick); worldManager = new WorldManager(verifyServer, behaviorParms); NetworkHelper helper = new NetworkHelper(worldManager); if (this.LoopbackWorldServerEntry != null) { string worldId = this.LoopbackWorldServerEntry.WorldName; // Bypass the login and connection to master server loginSettings.worldId = worldId; helper.SetWorldEntry(worldId, this.LoopbackWorldServerEntry); helper.AuthToken = this.LoopbackIdToken; } networkHelper = helper; // Sets up the various things attached to the world manager, // as well as registering the various message handlers. // This also initializes the networkHelper. worldManager.Init(this); // Register our handlers. We must do this before we call // MessageDispatcher.Instance.HandleMessageQueue, so that we will // get the callbacks for the incoming messages. #if NOT // NOTE: Test client isn't advanced enough to handle these. // Register our handler for the Portal messages, so that we // can drop our connection to the world server, and establish a new // connection to the new world. MessageDispatcher.Instance.RegisterHandler(WorldMessageType.Portal, new MessageHandler(this.HandlePortal)); // Register our handler for the UiTheme messages, so that we // can swap out the user interface. MessageDispatcher.Instance.RegisterHandler(WorldMessageType.UiTheme, new MessageHandler(this.HandleUiTheme)); #endif // Register our handler for the LoginResponse messages, so that we // can throw up a dialog if needed. MessageDispatcher.Instance.RegisterHandler(WorldMessageType.LoginResponse, new WorldMessageHandler(this.HandleLoginResponse)); if (!networkHelper.HasWorldEntry(loginSettings.worldId)) { networkHelper.ResolveWorld(loginSettings); } WorldServerEntry entry = networkHelper.GetWorldEntry(loginSettings.worldId); NetworkHelperStatus status = networkHelper.ConnectToLogin(loginSettings.worldId); // We need to hook our message filter, whether or not we are // standalone, so instead of doing it later (right before // RdpWorldConnect), do it here. RequireLoginFilter checkAndHandleLogin = new RequireLoginFilter(worldManager); MessageDispatcher.Instance.SetWorldMessageFilter(checkAndHandleLogin.ShouldQueue); if (status != NetworkHelperStatus.Success && status != NetworkHelperStatus.Standalone) { Trace.TraceInformation("World Connect Status: " + status); return(false); } networkHelper.DisconnectFromLogin(); CharacterEntry charEntry = SelectCharacter(networkHelper.CharacterEntries, -1); status = networkHelper.ConnectToWorld(charEntry.CharacterId, charEntry.Hostname, charEntry.Port, this.Version); if (status != NetworkHelperStatus.Success) { Trace.TraceInformation("World Connect Status: " + status); return(false); } // At this point, the network helper can start handling messages. if (!WaitForStartupMessages()) { if (loginFailed && loginMessage != null) { // The server rejected our login throw new ClientException(loginMessage); } else if (loginMessage != null) { // our login went ok (and we got something back), but something else (terrain/player) failed throw new ClientException("Unable to communicate with server"); } else { throw new ClientException("Unable to connect to server"); } } // At this point, I can have a camera // networkHelper.WorldManager = worldManager; // inputHandler.InitViewpoint(worldManager.Player); Logger.Log(4, "Client setup complete: " + DateTime.Now); // At this point, you can create timer events. return(true); }