Esempio n. 1
0
        static void Main(string[] args)
        {
#if DEBUG
            uint   qq   = 976811781u;
            string pass = Console.ReadLine();
#else
            Console.Write("请输入QQ:");
            uint qq = uint.Parse(Console.ReadLine());
            Console.Write("请输入密码:");
            string pass = Console.ReadLine();
#endif

            client                       = new QQClient(qq, pass);
            client.User.IsUdp            = true;
            client.LoginStatusChanged   += client_LoginStatusChanged;
            client.ReceiveClusterIM     += client_ReceiveClusterIM;
            client.ReceiveNormalIM      += client_ReceiveNormalIM;
            client.AddedToCluster       += client_AddedToCluster;
            client.LoginSuccessed       += client_LoginSuccessed;
            client.CardChanged          += client_CardChanged;
            client.ClusterAdminChanged  += client_ClusterAdminChanged;
            client.AddToClusterNeedAuth += client_AddToClusterNeedAuth;
            client.AddedToClusterInvite += client_AddedToClusterInvite;
            client.Login();

            var input = Console.ReadLine();
            while (client.User.LoginStatus == Coco.Framework.Entities.LoginStatus.NeedVerifyCode)
            {
                client.SendVerifyCode(input);
                input = Console.ReadLine();
            }

            client.Logout();
        }
Esempio n. 2
0
 static void Main(string[] args)
 {
     Init : Console.Title = "LFNet.QQ 基于QQ2009协议开发 作者:dobit QQ:156798087";
     StartLogin();
     AddEvents();
     HelpMessage();
     while (Client.LoginStatus == LoginStatus.Login)
     {
         string s = Console.ReadLine();
         if (s == "")
         {
             continue;
         }
         if (s.StartsWith("-") || s.StartsWith("/") || TQQ == null)
         {
             s = s.Replace("-", "").Replace("/", "");
             if (s.ToLower() == "x")
             {
                 Client.Logout();
                 Console.WriteLine();
                 Console.WriteLine("退出成功");
                 Client.LoginStatus = LoginStatus.Logout;
                 break;
             }
             ParseCommand(s);
         }
         else
         {
             if (TQQ != null)
             {
                 if (AutoReply)
                 {
                     Lynfo.GoogleTranslateApi.GoogleTranslateApi GTA = new Lynfo.GoogleTranslateApi.GoogleTranslateApi();
                     GTA.TranslateCompleted += new EventHandler <Lynfo.GoogleTranslateApi.TranslateCompletedEventArgs>(GTA_TranslateCompleted);
                     GTA.TranslateAsync(Lynfo.GoogleTranslateApi.GoogleTranslateApi.Language.CHINESE_SIMPLIFIED, Lynfo.GoogleTranslateApi.GoogleTranslateApi.Language.ENGLISH, s, TQQ);
                 }
                 else
                 {
                     SendMsg(TQQ, s);
                 }
             }
         }
     }
     //Console.WriteLine();
     Echo("是否重新登录(Y/N):");
     if (Console.ReadLine().ToLower() == "y")
     {
         goto Init;
     }
 }