public static bool Connect(int ServerIP, int Port) { Flush(); m_ServerPort = Port; Engine.ValidateHandlers(); m_Server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); m_ServerIP = new IPAddress((long)((ulong)ServerIP)); m_ServerIPEP = new IPEndPoint(m_ServerIP, Port); Debug.Try("Connecting to game server '{0}'", m_ServerIPEP); try { IAsyncResult asyncResult = m_Server.BeginConnect(m_ServerIPEP, null, null); do { Engine.DrawNow(); }while (!asyncResult.AsyncWaitHandle.WaitOne(10, false)); m_Server.EndConnect(asyncResult); } catch (Exception exception) { Debug.FailTry(); Debug.Error(exception); return(false); } Debug.EndTry(); return(true); }
public void Click() { for (int i = 1; i <= 3; i++) { this.State = i % 3; Engine.DrawNow(); } this.InternalOnClicked(); }
protected internal override void OnDoubleClick(int x, int y) { Cursor.Hourglass = true; NewConfig.LastServerID = this.m_Server.ServerID; NewConfig.Save(); this.m_Server.Select(); Gumps.Desktop.Children.Clear(); xGumps.Display("Connecting"); Engine.DrawNow(); }
public static void CheckCache() { if (!m_UnpackCacheLoaded) { ManualResetEvent state = new ManualResetEvent(false); ThreadPool.QueueUserWorkItem(new WaitCallback(Network.Thread_LoadUnpackCache), state); do { Engine.DrawNow(); }while (!state.WaitOne(10, false)); state.Close(); m_UnpackCacheLoaded = true; } }
public void Click() { if (this.m_Enabled) { this.State = 1; Engine.DrawNow(); this.State = 2; Engine.DrawNow(); this.State = 0; Engine.DrawNow(); if (this.m_OnClick != null) { this.m_OnClick(this); } } }
public override void OnClick() { Entry entry = new Entry { AccountName = this.m_Character.Shard.Account.Username, Password = this.m_Character.Shard.Account.Password, CharID = this.m_Character.Index, CharName = this.m_Character.Name, ServerID = this.m_Character.Shard.Index, ServerName = this.m_Character.Shard.Name, CharProfile = this.m_Character }; Engine.m_QuickLogin = true; Engine.m_QuickEntry = entry; Cursor.Hourglass = true; Gumps.Desktop.Children.Clear(); xGumps.Display("Connecting"); Engine.DrawNow(); string serverHost = NewConfig.ServerHost; int serverPort = NewConfig.ServerPort; NewConfig.ServerHost = this.m_Character.Shard.Account.Server.Address; NewConfig.ServerPort = this.m_Character.Shard.Account.Server.Port; if (Network.Connect()) { NewConfig.ServerHost = serverHost; NewConfig.ServerPort = serverPort; Gumps.Desktop.Children.Clear(); xGumps.Display("AccountVerify"); } else { NewConfig.ServerHost = serverHost; NewConfig.ServerPort = serverPort; Gumps.Desktop.Children.Clear(); xGumps.SetVariable("FailMessage", "Couldn't connect to the login server. Either the server is down, or you've entered an invalid host / port. Check Client.cfg."); xGumps.Display("ConnectionFailed"); Cursor.Hourglass = false; Engine.m_QuickLogin = false; return; } Network.Send(new PLoginSeed()); Network.Send(new PAccount(entry.AccountName, entry.Password)); }
public static bool Connect() { m_ServerHost = NewConfig.ServerHost; m_ServerPort = NewConfig.ServerPort; try { Debug.Try("Parsing IP ( \"{0}\" )", m_ServerHost); m_ServerIP = IPAddress.Parse(m_ServerHost); m_ServerIPEP = new IPEndPoint(m_ServerIP, m_ServerPort); Debug.EndTry("( {0} )", m_ServerIPEP); } catch { Debug.FailTry(); try { Debug.Try("Resolving"); IAsyncResult asyncResult = Dns.BeginResolve(m_ServerHost, null, null); do { Engine.DrawNow(); }while (!asyncResult.AsyncWaitHandle.WaitOne(10, false)); IPHostEntry entry = Dns.EndResolve(asyncResult); if (entry.AddressList.Length == 0) { Debug.FailTry("( AddressList is empty )"); return(false); } m_ServerIP = entry.AddressList[0]; m_ServerIPEP = new IPEndPoint(m_ServerIP, m_ServerPort); Debug.EndTry("( {0} )", m_ServerIPEP); } catch (Exception exception) { Debug.FailTry(); Debug.Error(exception); return(false); } } Flush(); Engine.ValidateHandlers(); m_Server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Debug.Try("Connecting to login server '{0}'", m_ServerIPEP); try { IAsyncResult result2 = m_Server.BeginConnect(m_ServerIPEP, null, null); do { Engine.DrawNow(); }while (!result2.AsyncWaitHandle.WaitOne(10, false)); m_Server.EndConnect(result2); } catch (Exception exception2) { Debug.FailTry(); Debug.Error(exception2); return(false); } Debug.EndTry(); return(true); }