Exemplo n.º 1
0
        public void Start()
        {
            try
            {
                Debug.LogLine("【加载数据中】");
                active = true;
                InitData();
                Debug.LogLine("【准备环境中】");
                //AutoLogin.CloseQQProcess();
                Debug.LogLine("【奔跑吧!兄弟!!】");
                //Tools.OpenAllQQWindow();

                if (qqInfo.Count == 0)
                {
                    Debug.LogError("没有找到任何QQ!请检查IP什么是否配置正确");
                    return;
                }
                //进入循环
                while (active)
                {
                    while (qqs.Count < 3)
                    {
                        QQInfo info = NextQQ();
                        if (info == null)
                        {
                            break;
                        }

                        QQ qq = new QQ(this);
                        if (qq.Start(info))
                        {
                            qqs.Enqueue(qq);
                        }
                    }

                    QQ _qq = qqs.Dequeue();
                    qqs.Enqueue(_qq);

                    if (_qq.Tick())
                    {
                        _qq.Stop();

                        //加入下一个QQ
                        QQInfo info = NextQQ();
                        if (info != null)
                        {
                            _qq.Start(info);
                        }
                    }

                    System.Threading.Thread.Sleep(100);
                }
            }
            catch (Exception e)
            {
                Debug.LogError("启动QQ客户端失败了");
                Debug.OnException(e);
            }
        }
Exemplo n.º 2
0
        public bool Start(QQInfo qq)
        {
            if (!qq.allow_login)
            {
                Debug.LogLine(string.Format("{0}被限制登录,原因:{1}", qq.qq, qq.state));
                return(false);
            }

            qqinfo = qq;

            AutoLogin autoLogin = new AutoLogin();

            appElement = autoLogin.Login(qq.qq, qq.pws, qq.nickname);
            if (appElement == null)
            {
                OnLoginFail(qq.qq, autoLogin._ErrorType, autoLogin._ErrorDesc);
                return(false);
            }

            //根据QQ情况分配执行命令
            DateTime endtime = DateTime.Now + new TimeSpan(1, 0, 0);

            //每个QQ必挂机1小时
            actions.Add(QQAction.Create <QAC_GuaJi>(this, endtime));

            //加好友
            if (qq.addFriendTime < endtime)
            {
                actions.Add(QQAction.Create <QAC_FindFriend>(this, qq.addFriendTime));
            }

            //统计数据上报
            if (qq.refshDataTime < endtime)
            {
                actions.Add(QQAction.Create <QAC_StatisticsFriendCount>(this, qq.refshDataTime));
            }

            return(true);
        }
Exemplo n.º 3
0
        void InitializeAccount()
        {
            try
            {
                String   URL = Config.ROOT_URL + "account_getlist";
                PostData nvc = new PostData();
                Func.putPassWord(nvc);
                nvc.Add("order", "logintime");
                nvc.Add("desc", "DESC");
                nvc.Add("start", "0");
                nvc.Add("count", "100");
                nvc.Add("tag", "loginip");
                string ip = Tools.GetIP();
                nvc.Add("tagval", ip);

                Debug.LogLine("本机IP:" + ip);
                if (nvc != null)
                {
                    string sttuas = Func.HttpPostData(URL, 10000, nvc);
                    Debug.Log(sttuas);
                    if (sttuas.Length > 10)
                    {
                        MyJson.JsonNode_Array jsons = MyJson.Parse(sttuas) as MyJson.JsonNode_Array;
                        for (int i = 0; i < jsons.GetListCount(); i++)
                        {
                            MyJson.JsonNode_Object json = jsons.GetArrayItem(i) as MyJson.JsonNode_Object;
                            int canuse = json["canuse"].AsInt();
                            if (canuse == 1)
                            {
                                QQInfo info = new QQInfo();
                                info.qq       = json["qq"].AsString();
                                info.pws      = Func.MyUrlDeCode(json["password"].AsString());
                                info.nickname = Func.MyUrlDeCode(json["nickname"].AsString());

                                if (!qqInfo.ContainsKey(info.qq))
                                {
                                    qqinfo.Enqueue(info.qq);
                                    qqInfo.Add(info.qq, info);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Debug.OnException(e);
            }


            try
            {
                String   URL = Config.ROOT_URL + "accountex_getlist";
                PostData nvc = new PostData();
                Func.putPassWord(nvc);
                nvc.Add("start", "0");
                nvc.Add("count", "0");
                //nvc.Add("tag", "qq");
                //nvc.Add("tagval", "251197161");
                if (nvc != null)
                {
                    string sttuas = Func.HttpPostData(URL, 10000, nvc);
                    if (sttuas.Length > 10)
                    {
                        MyJson.JsonNode_Array jsons = MyJson.Parse(sttuas) as MyJson.JsonNode_Array;
                        for (int i = 0; i < jsons.GetListCount(); i++)
                        {
                            MyJson.JsonNode_Object json = jsons.GetArrayItem(i) as MyJson.JsonNode_Object;
                            string qq = json["qq"].AsString();

                            QQInfo info;
                            if (qqInfo.TryGetValue(qq, out info))
                            {
                                info.state = Func.MyUrlDeCode(json["state"].AsString());
                                try
                                {
                                    info.locktime = DateTime.Now;
                                    info.locktime = DateTime.Parse(Func.MyUrlDeCode(json["locktime"].AsString()));
                                }
                                catch (Exception) { }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }