Ejemplo n.º 1
0
        /// <summary>
        /// Login into server - this is called when BeginConnect callback is called
        /// </summary>
        public void LoginIntoServer()
        {
            /// Send our login details to server
            ClientPacket l_ClientPacket = new ClientPacket();

            l_ClientPacket.AppendInterger(Common.CLIENT_LAUNCHER_LOGIN);
            l_ClientPacket.AppendString(AccountInfo.Account.GetUsername(), false);
            l_ClientPacket.AppendString(AccountInfo.Account.GetPassword(), false);
            l_ClientPacket.AppendSOH();
            MainEntry.GetInstance.SendPacket(l_ClientPacket.GetData());
        }
        /// <summary>
        /// Login result
        /// </summary>
        private void HandleLogin(ServerPacket p_ServerPacket)
        {
            int l_ErrorCode = p_ServerPacket.ReadBase64Int();

            string l_Message = "Success";

            switch (l_ErrorCode)
            {
            case (int)AuthResult.WOW_FAIL_SUSPENDED:
                l_Message = "This account is currently supsended. Please try again later.";
                break;

            case (int)AuthResult.WOW_FAIL_BANNED:
                l_Message = "This account is permanently banned.";
                break;

            case (int)AuthResult.WOW_FAIL_INCORRECT_PASSWORD:
                l_Message = "Username/Password is incorrect!";
                break;

            /// Success! Player successfully logged in!
            case (int)AuthResult.WOW_SUCCESS:
            {
                Account.SetAccountId(p_ServerPacket.ReadBase64Uint());
                Account.SetAccountType(p_ServerPacket.ReadBase64Uint());

                /// Lets boot up our launcher
                /// Send packet to server to get launcher information
                ClientPacket l_ClientPacket = new ClientPacket();
                l_ClientPacket.AppendInterger(Common.CLIENT_LAUNCHER_INFO);
                l_ClientPacket.AppendSOH();
                MainEntry.GetInstance.SendPacket(l_ClientPacket.GetData());
            }
            break;
            }

            if (l_Message != "Success")
            {
                MessageBox.Show(l_Message, "Error #0003", MessageBoxButtons.OK, MessageBoxIcon.Error);

                MainEntry.GetInstance.GetLogin().Invoke((MethodInvoker) delegate {
                    MainEntry.GetInstance.GetLogin().Login_Text_Box_Password.Clear();
                    MainEntry.GetInstance.GetLogin().Login_Text_Box_Username.Clear();
                });
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Update status info
        /// </summary>
        private void SendLauncherUpdate()
        {
            using (TcpClient l_TCPClient = new TcpClient())
            {
                try
                {
                    l_TCPClient.Connect("151.228.138.247", 8085);
                    Main_Label_Online_Status.Text = "Online";
                }
                catch (Exception)
                {
                    Main_Label_Online_Status.Text = "Offline";
                }
            }

            /// Get update status
            ClientPacket l_ClientPacket = new ClientPacket();

            l_ClientPacket.AppendInterger(Common.CLIENT_LAUNCHER_UPDATE);
            l_ClientPacket.AppendSOH();
            MainEntry.GetInstance.SendPacket(l_ClientPacket.GetData());
        }