public static void HandleAuthenticationTicketMessage(Bot bot, AuthenticationTicketMessage message) { if (m_languageFound) return; Languages lang; if (!m_langsShortcuts.TryGetValue(message.lang, out lang)) return; Host.ChangeLanguage(lang); m_languageFound = true; }
private static void HandleAuthenticationTicketMessage(Bot bot, AuthenticationTicketMessage message) { // theorically not received message.BlockNetworkSend(); }
private void HandleAuthenticationTicketMessage(ConnectionMITM client, AuthenticationTicketMessage message) { if (!m_tickets.ContainsKey(message.ticket)) throw new Exception(string.Format("Ticket {0} not registered", message.ticket)); var tuple = m_tickets[message.ticket]; m_tickets.Remove(message.ticket); client.Bot = tuple.Item1; client.Bot.ChangeConnection(client); client.Bot.ConnectionType = ClientConnectionType.GameConnection; client.Bot.CancelAllMessages(); // avoid to handle message from the auth client. client.Bot.Start(); ( (NetworkMessageDispatcher) client.Bot.Dispatcher ).Client = client; ( (NetworkMessageDispatcher) client.Bot.Dispatcher ).Server = client.Server; try { client.BindToServer(tuple.Item2.address, tuple.Item2.port); } catch (Exception) { logger.Error("Cannot connect to {0}:{1}.", tuple.Item2.address, tuple.Item2.port); client.Bot.Stop(); return; } // unblock the connection (fix #14) client.SendToServer(new BasicPingMessage()); client.Bot.CallDelayed(ServerConnectionTimeout * 1000, () => OnServerConnectionTimedOut(client)); logger.Debug("Bot retrieved with ticket {0}", message.ticket); }
private static void HandleAuthenticationTicketMessage(Bot bot, AuthenticationTicketMessage message) { message.BlockNetworkSend(); }
private void HandleAuthenticationTicketMessage(ConnectionMITM client, AuthenticationTicketMessage message) { if (!m_tickets.ContainsKey(message.ticket)) throw new Exception(string.Format("Ticket {0} not registered", message.ticket)); var tuple = m_tickets[message.ticket]; m_tickets.Remove(message.ticket); client.Bot = tuple.Item1; client.Bot.ChangeConnection(client); client.Bot.ConnectionType = ClientConnectionType.GameConnection; client.Bot.Start(); ( client.Bot.Dispatcher as NetworkMessageDispatcher ).Client = client; ( client.Bot.Dispatcher as NetworkMessageDispatcher ).Server = client.Server; try { client.BindToServer(tuple.Item2.address, tuple.Item2.port); } catch (Exception) { logger.Error("Cannot connect to {0}:{1}.", tuple.Item2.address, tuple.Item2.port); client.Bot.Stop(); return; } logger.Debug("Bot retrieved with ticket {0}", message.ticket); }