Example #1
0
        /// <summary>
        ///     <remark>abu 2008-03-10 </remark>
        /// </summary>
        /// <param name="client">The client.</param>
        internal PacketManager(QQClient client)
        {
            router = new ProcessorRouter(client);
            router.InstallProcessor(new BasicFamilyProcessor(client));

            this.QQClient = client;
            receiveQueue  = new Queue <InPacket>();

            SetupTrigger();
        }
Example #2
0
        public QQLog(QQClient qqClient)
        {
            this.QQClient = qqClient;
            string directory = Util.MapPath("/Log/" + qqClient.QQUser.QQ);

            this.FileName = Path.Combine(directory, System.DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
        }
Example #3
0
 void PacketManager_SendPacketTimeOut(object sender, QQEventArgs <InPacket, OutPacket> e)
 {
     if (QQClient.LoginStatus == LoginStatus.Connectting)
     {
         //更换IP地址
         string newserverIp = GetNewServerIP();
         if (newserverIp != null)
         {
             QQClient.ConnectionManager.ConnectionPool.Release(QQPort.Main.Name);
             QQClient.LoginServerHost = newserverIp;
             QQClient.LoginStatus     = LoginStatus.ChangeServer;
             this.QQClient.LogManager.Log("change ServerIP to:" + newserverIp);
             QQClient.Login();
         }
     }
 }
Example #4
0
        ///// <summary>登录成功事件
        /////   <remark>abu 2008-03-08 </remark>
        ///// </summary>
        //public event EventHandler<QQEventArgs<LoginReplyPacket, LoginPacket>> LoginSuccessed;
        ///// <summary>
        ///// Raises the <see cref="E:LoginSuccessed"/> event.
        ///// </summary>
        ///// <param name="e">The <see cref="LFNet.QQ.Events.QQEventArgs&lt;LFNet.QQ.Packets.In.LoginReplyPacket&gt;"/> instance containing the event data.</param>
        //internal void OnLoginSuccessed(QQEventArgs<LoginReplyPacket, LoginPacket> e)
        //{
        //    this.QQClient.IsLogon = true;
        //    this.QQUser.IsLoggedIn = true;

        //    if (LoginSuccessed != null)
        //    {
        //        LoginSuccessed(this, e);
        //    }
        //}
        // //<summary>
        // //登录重定向事件
        // //</summary>
        //public event EventHandler<QQEventArgs<LoginReplyPacket, LoginPacket>> LoginRedirect;
        //internal void OnLoginRedirect(QQEventArgs<LoginReplyPacket, LoginPacket> e)
        //{
        //    // 如果是登陆重定向,继续登陆
        //    QQClient.LoginRedirect = true;
        //    QQClient.ConnectionManager.ConnectionPool.Release(QQPort.Main.Name);
        //    QQClient.Login(Utils.Util.GetIpStringFromBytes(e.InPacket.RedirectIP), e.InPacket.RedirectPort);
        //    if (LoginRedirect != null)
        //    {
        //        LoginRedirect(this, e);
        //    }
        //}

        // //<summary>
        // //重定向登录时,重定向服务器为空
        // //   <remark>abu 2008-03-10 </remark>
        // //</summary>
        //public event EventHandler<QQEventArgs<LoginReplyPacket, LoginPacket>> LoginRedirectNull;
        // //<summary>
        // //Raises the <see cref="E:LoginRedirectNull"/> event.
        // //</summary>
        // //<param name="e">The <see cref="LFNet.QQ.Events.QQEventArgs&lt;LFNet.QQ.Packets.In.LoginReplyPacket&gt;"/> instance containing the event data.</param>
        //internal void OnLoginRedirectNull(QQEventArgs<LoginReplyPacket, LoginPacket> e)
        //{
        //    if (LoginRedirectNull != null)
        //    {
        //        LoginRedirectNull(this, e);
        //    }
        //}

        ///// <summary>
        ///// 登录失败触发的事件
        /////   <remark>abu 2008-03-10 </remark>
        ///// </summary>
        //public event EventHandler<QQEventArgs<LoginReplyPacket, LoginPacket>> LoginFailed;
        ///// <summary>
        ///// Raises the <see cref="E:LoginFailed"/> event.
        ///// </summary>
        ///// <param name="e">The <see cref="LFNet.QQ.Events.QQEventArgs&lt;LFNet.QQ.Packets.In.LoginReplyPacket&gt;"/> instance containing the event data.</param>
        //internal void OnLoginFailed(QQEventArgs<LoginReplyPacket, LoginPacket> e)
        //{
        //    if (LoginFailed != null)
        //    {
        //        LoginFailed(this, e);
        //    }
        //}

        ///// <summary>
        ///// 登录过程中的未知错误
        ///// </summary>
        //public event EventHandler<QQEventArgs<LoginReplyPacket, LoginPacket>> LoginUnknownError;
        ///// <summary>
        ///// Raises the <see cref="E:LoginUnknownError"/> event.
        ///// </summary>
        ///// <param name="e">The <see cref="LFNet.QQ.Events.QQEventArgs&lt;LFNet.QQ.Packets.In.LoginReplyPacket&gt;"/> instance containing the event data.</param>
        //internal void OnLoginUnknownError(QQEventArgs<LoginReplyPacket, LoginPacket> e)
        //{
        //    if (LoginUnknownError != null)
        //    {
        //        LoginUnknownError(this, e);
        //    }
        //}

        #endregion

        internal void ProcessLoginTouchReply(LoginTouchReplyPacket loginTouchReplyPacket, LoginTouchPacket loginTouchPacket)
        {
            QQEventArgs <LoginTouchReplyPacket, LoginTouchPacket> e = new QQEventArgs <LoginTouchReplyPacket, LoginTouchPacket>(QQClient, loginTouchReplyPacket, loginTouchPacket);

            if (loginTouchReplyPacket.ReplyCode == ReplyCode.OK)
            {
                QQClient.LoginStatus = LoginStatus.Connected;
                if (loginTouchReplyPacket.IsRedirect)//转向
                {
                    if (Utils.Util.IsIPZero(loginTouchReplyPacket.RedirectIP))
                    {
                        //OnLoginRedirectNull(e);
                        QQClient.LogManager.Log("RedirectIp Is Zero!");
                        QQClient.LoginStatus = LoginStatus.Failed;
                    }
                    else
                    {
                        QQClient.LoginStatus = new LoginStatus("Redirect to" + Utils.Util.GetIpStringFromBytes(loginTouchReplyPacket.RedirectIP), "重定向到服务器" + Utils.Util.GetIpStringFromBytes(loginTouchReplyPacket.RedirectIP));
                        //OnLoginRedirect(e);
                        QQClient.LoginRedirect = true;
                        QQClient.ConnectionManager.ConnectionPool.Release(QQPort.Main.Name);
                        QQClient.LogManager.Log("Redirect to " + Utils.Util.GetIpStringFromBytes(loginTouchReplyPacket.RedirectIP));
                        string ipTemp = QQClient.LoginServerHost;
                        QQClient.LoginServerHost         = Utils.Util.GetIpStringFromBytes(QQClient.ServerInfo.CSP_dwConnIP);
                        QQClient.ServerInfo.CSP_dwConnIP = Utils.Util.IpToBytes(ipTemp);
                        //重新登录
                        QQClient.Login();
                    }
                }
                else
                {
                    //将服务器返回的时间和IP存入QQClient等待使用
                    QQClient.ServerTime = loginTouchReplyPacket.ServerTime;
                    QQClient.ClientIP   = loginTouchReplyPacket.ClientIP;
                    //0xba开始登陆
                    QQUser.QQKey.LoginRequestToken = loginTouchReplyPacket.Token;
                    OutPacket outPacket = new LoginRequestPacket(this.QQClient);
                    QQClient.PacketManager.SendPacketAnyway(outPacket, QQPort.Main.Name);
                    //QQUser.QQKey = new QQKey(this.QQUser);
                    //QQClient.LoginManager.
                }
            }
            else
            {
                QQClient.LoginStatus = LoginStatus.Failed;
            }
        }
Example #5
0
 /// <summary>
 ///     <remark>abu 2008-03-29 </remark>
 /// </summary>
 /// <param name="client">The client.</param>
 public ClusterManager(QQClient client)
 {
     QQClient = client;
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConnectionManager"/> class.
 /// </summary>
 /// <param name="client">The client.</param>
 internal ConnectionManager(QQClient client)
 {
     QQClient       = client;
     ConnectionPool = new LFNet.QQ.Net.Sockets.ConnectionPool();
 }
Example #7
0
 /// <summary>
 ///     <remark>abu 2008-03-10 </remark>
 /// </summary>
 /// <param name="client">The client.</param>
 internal MessageManager(QQClient client)
 {
     QQClient = client;
 }
Example #8
0
 internal LoginManager(QQClient client)
 {
     QQClient = client;
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PrivateManager"/> class.
 /// </summary>
 /// <param name="client">The client.</param>
 internal PrivateManager(QQClient client)
 {
     this.QQClient = client;
 }