Exemple #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            string szMsg = textBox.Text;

            if (szMsg.StartsWith("/connect"))
            {
                if (m_iClientEmulator == null)
                {
                    var pLogin = szMsg.Split(' ');
                    if (pLogin.Length != 3)
                    {
                        return;
                    }
                    m_iClientEmulator = new XChat.XClientEmulator();
                    m_iClientEmulator.EmulateClient(pLogin[1], pLogin[2]);
                }
            }
            else if (szMsg.Equals("/disconnect"))
            {
                m_iClientEmulator.StopClient();
            }
            else if (szMsg.StartsWith("/select"))
            {
                string[] pSelection;
                if ((pSelection = szMsg.Split(' ')).Length == 2)
                {
                    int nCode = 0;
                    if (!int.TryParse(pSelection[1], out nCode))
                    {
                        return;
                    }
                    m_iClientEmulator.OnServerSelect(nCode);
                }
            }
            else if (szMsg.StartsWith("/use"))
            {
                string[] pSelection;
                if ((pSelection = szMsg.Split(' ')).Length == 2)
                {
                    int nCode = 0;
                    if (!int.TryParse(pSelection[1], out nCode))
                    {
                        return;
                    }
                    m_iClientEmulator.OnGameLogin(nCode);
                }
            }
            else
            {
                onSendMessage(szMsg);
            }
            textBox.Text = string.Empty;
        }
Exemple #2
0
 public XClientGameEmulator(Config.ConfigNet conf, TCPManager man, XChat.XClientEmulator pBase, string pAccount, PacketOut pOut)
 {
     m_szAccount       = pAccount;
     m_cGameConnection = new TCPConnection(man, null, this, conf);
     try {
         m_cGameConnection.Start();
         m_cGameConnection.SendTCP(CreateVersionPacket());
         m_cGameConnection.SendTCP(pOut);
     }
     catch {
         XLog.Log("Can't connect to Game Server!");
     }
 }
Exemple #3
0
        public XClientAuthEmulator(TCPManager man, Config.ConfigNet conf, string pAccount, string pPassword, XChat.XClientEmulator cBase)
        {
            m_szName      = pAccount;
            m_szPassword  = pPassword;
            m_cClientBase = cBase;

            try {
                m_cAuthConnection = new TCPConnection(man, null, this, conf);
                m_cAuthConnection.Start();
                m_cAuthConnection.SendTCP(this.CreateVersionPacket());
                m_cAuthConnection.SendTCP(this.CreateAESPacket());
            }
            catch {
                XLog.Log("Can't connect to Authentication Server!");
            }
        }
Exemple #4
0
        public XClientAuthEmulator(TCPManager man, Config.ConfigNet conf, string pAccount, string pPassword, XChat.XClientEmulator cBase)
        {
            m_szName = pAccount;
            m_szPassword = pPassword;
            m_cClientBase = cBase;

            try {
                m_cAuthConnection = new TCPConnection( man, null, this, conf );
                m_cAuthConnection.Start();
                m_cAuthConnection.SendTCP( this.CreateVersionPacket() );
                m_cAuthConnection.SendTCP( this.CreateAESPacket() );
            }
            catch {
                XLog.Log( "Can't connect to Authentication Server!" );
            }
        }
Exemple #5
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     string szMsg = textBox.Text;
     if ( szMsg.StartsWith( "/connect" ) ) {
         if(m_iClientEmulator == null ) {
             var pLogin = szMsg.Split( ' ' );
             if ( pLogin.Length != 3 )
                 return;
             m_iClientEmulator = new XChat.XClientEmulator();
             m_iClientEmulator.EmulateClient( pLogin[1], pLogin[2]);
         }
     }else if ( szMsg.Equals( "/disconnect" ) ) {
         m_iClientEmulator.StopClient();
     }else if ( szMsg.StartsWith( "/select" ) ) {
         string[] pSelection;
         if((pSelection = szMsg.Split(' ')).Length == 2 ) {
             int nCode = 0;
             if(!int.TryParse(pSelection[1], out nCode)) {
                 return;
             }
             m_iClientEmulator.OnServerSelect( nCode );
         }
     }else if ( szMsg.StartsWith( "/use" ) ) {
         string[] pSelection;
         if ( ( pSelection = szMsg.Split( ' ' ) ).Length == 2 ) {
             int nCode = 0;
             if ( !int.TryParse( pSelection[1], out nCode ) ) {
                 return;
             }
             m_iClientEmulator.OnGameLogin( nCode );
         }
     }
     else {
         onSendMessage( szMsg );
     }
     textBox.Text = string.Empty;
 }