Ejemplo n.º 1
0
 public QQKey(QQUser user)
 {
     this.QQUser = user;
        InitKey = Util.RandomKey();
        Verify_Key1 = Util.RandomKey();
        Verify_Key2 = Util.RandomKey();
        this.PasswordKey = Crypter.MD5(QQUser.Password);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// </summary>
        /// <param name="user">The user.</param>
        public QQClient(QQUser user)
        {
            PacketManager = new PacketManager(this);
            ConnectionManager = new ConnectionManager(this);
            LoginManager = new LoginManager(this);
            MessageManager = new MessageManager(this);
            FriendManager = new FriendManager(this);
            PrivateManager = new PrivateManager(this);
            ClusterManager = new ClusterManager(this);

            // this.inConn = new Dictionary<InPacket, string>();
            this.QQUser = user;
            this.Proxy = new Proxy();
            this.LogManager = new QQLog(this);
            #if DEBUG
            this.LogManager.Log("uin:" + this.QQUser.QQ.ToString() + "-->" + this.QQUser.QQ.ToString("X8") + "\r\nPassword md5_1: " + Utils.Util.ToHex(this.QQUser.Password) + "\r\nPassword md5_2 (key): " + Utils.Util.ToHex(this.QQUser.QQKey.PasswordKey));
            #endif
            this.ServerInfo = new ServerInfo();
        }
Ejemplo n.º 3
0
 //屏蔽 StartLogin for interface
 //   private static void StartLogin()
 //   {
 //   Init:
 //#if !RELEASE
 //        int qq=0;
 //        bool IsQQNum = false;
 //增加通过配置文件读取qq账号密码信息
 //增加通过命令行增加账号密码信息
 //        while (!IsQQNum)
 //        {
 //            try
 //            {
 //                Console.Write("QQ账号:");
 //string s = Console.ReadLine();//先屏蔽手工输入便于调试
 //                string s= "20523167";
 //                Console.WriteLine("您输入的QQ号是:{0}", s);
 //                qq = int.Parse(s);
 //                IsQQNum = true;
 //            }
 //            catch
 //            {
 //                Console.WriteLine("QQ号码错误,请重新输入:");
 //                IsQQNum = false;
 //            }
 //        }
 //        Console.Write("密码:");
 //        string p = "";
 //p = Console.ReadLine();//先屏蔽手工输入便于调试
 //        p = "5551191844";
 //        Console.Write("是否隐身登陆(Y/N):");
 //        //string st = Console.ReadLine();//先屏蔽手工输入便于调试
 //        string st = "N";
 //        Console.Clear();
 //        QQUser user2 = new QQUser(qq, p);
 //        if(st=="Y"||st=="y")
 //        {
 //            user2.LoginMode = QQStatus.HIDDEN;
 //        }
 //#else
 //#endif
 //        Client = new QQClient(user2);
 //        Client.LoginManager.LoginStatusChanged += new EventHandler<TS.QQ.Events.LoginStatusChangedEventArgs<LoginStatus>>(LoginManager_LoginStatusChanged);
 //user2.IsUdp = true;//设置登录模式 udp 或tcp
 //        Client.LoginServerHost = "219.133.49.171"; //指定默认的服务器IP地址,可以不指定服务器IP,系统自动搜索可用的IP
 //        Client.Login();
 //        while (Client.LoginStatus != LoginStatus.Login)//如果没有登录成功则
 //        {
 //            if (Client.LoginStatus == LoginStatus.NeedVerifyCode)
 //            {
 //                Console.Write("请输入验证码:");
 //                string code = Console.ReadLine();
 //                Client.LoginStatus = LoginStatus.SendVerifyCode;
 //                Client.LoginManager.LoginSendVerifyCode(code);
 //            }
 //            else if (Client.LoginStatus == LoginStatus.WrongPassword)
 //            {
 //                goto Init;
 //            }
 //            else if(Client.LoginStatus ==LoginStatus.ChangeServer)
 //            {
 //                Console.WriteLine("尝试连接:"+Client.LoginServerHost);
 //            }
 //            Thread.Sleep(100);
 //        }
 //    }
 /// <summary>
 /// 开始登陆
 /// </summary>
 private static void StartLogin()
 {
     int num;
     Label_0000:
     num = 0;
     bool flag = false;
     while (!flag)
     {
         try
         {
             Console.Write("QQ账号:" + Program.qqnum + "\n");
             string qqnum = Program.qqnum;
             num = int.Parse(qqnum);
             flag = true;
             Console.Title = "QQ机器人 For txj 当前QQ:" + qqnum;
             continue;
         }
         catch
         {
             Console.WriteLine("QQ号码错误,请关闭机器人重新配置!");
             flag = false;
             Console.ReadLine();
             continue;
         }
     }
     Console.Write("密码:************\n");
     string qQpassword = QQpassword;
     Console.Write("是否隐身登陆(Y/N):" + Program.ys + "\n");
     string ys = Program.ys;
     QQUser user = new QQUser(num, qQpassword);
     switch (ys)
     {
         case "Y":
         case "y":
             user.LoginMode = QQStatus.HIDDEN;
             break;
     }
     Client = new QQClient(user);
     Client.LoginManager.LoginStatusChanged += new EventHandler<LoginStatusChangedEventArgs<LoginStatus>>(Program.LoginManager_LoginStatusChanged);
     Client.LoginServerHost = "219.133.49.171";
     Client.Login();
     while (Client.LoginStatus != LoginStatus.Login)
     {
         if (Client.LoginStatus == LoginStatus.NeedVerifyCode)
         {
             Console.Write("请输入验证码:");
             string verifyCode = Console.ReadLine();
             Client.LoginStatus = LoginStatus.SendVerifyCode;
             Client.LoginManager.LoginSendVerifyCode(verifyCode);
         }
         else if (Client.LoginStatus == LoginStatus.WrongPassword)
         {
             goto Label_0000;
         }
         Thread.Sleep(100);
     }
     Console.Clear();
 }