コード例 #1
0
        private void oldquanqd()
        {
            apkName = dict["明日方舟"];
            int[]  yunxingIndex = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
            string a_b          = "d";

            qdinit(a_b);
            for (int j = 1; j < 1000; j++)
            {
                WriteLog.WriteLogFile("", "序号" + j + ",开始");
                MyFuncUtil.LaunchAll(yunxingIndex.Length);
                Thread.Sleep(10000);
                List <int> newinx = new List <int>();
                foreach (int myinx in yunxingIndex)
                {
                    int i = MyFuncUtil.QiDongWanChengInx(a_b, myinx, apkName);
                    if (i != -1)
                    {
                        newinx.Add(i);
                    }
                    Thread.Sleep(3000);
                }
                MyLdcmd.mySort(a_b);
                Thread.Sleep(2000);
                ThreadPool.SetMaxThreads(newinx.Count, newinx.Count); //设置最大线程数
                foreach (int inx in newinx)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(duoxiand), inx);//线程池指定线程执行Auto方法
                    Thread.Sleep(20000);
                }

                while (true)
                {
                    Thread.Sleep(10000);//这句写着,主要是没必要循环那么多次。去掉也可以。
                    int maxWorkerThreads, workerThreads;
                    int portThreads;
                    ThreadPool.GetMaxThreads(out maxWorkerThreads, out portThreads);
                    ThreadPool.GetAvailableThreads(out workerThreads, out portThreads);
                    if (maxWorkerThreads - workerThreads == 0)
                    {
                        break;
                    }
                }

                WriteLog.WriteLogFile("", "序号" + j + ",结束");
            }
        }
コード例 #2
0
        private void duoxianxunhuan(string a_b, int dqinx, int xhcishu)
        {
            string dizhi = null;
            string path  = null;
            string seed  = null;

            MyFuncUtil.myqiehuancd(a_b, out dizhi, out path, out seed);
            //MyLdcmd.mySort(dizhi);
            var cishu   = 0;
            var cgcishu = 0;

            for (int cs = 0; cs < xhcishu; cs++)
            {
                var ks = MyFuncUtil.GetTimestamp();
                Thread.Sleep(2000);
                MyFuncUtil.mylogandxianshi("模拟器" + dqinx + "进入到循环当中");
                Thread.Sleep(1000);
                bool temp = false;
                if (!temp)
                {
                    MyFuncUtil.mylogandxianshi("模拟器" + dqinx + "关闭失败");
                    Thread.Sleep(20000);
                    continue;
                }
                MyFuncUtil.mylogandxianshi("模拟器" + dqinx + "复原");
                MyLdcmd.myRestore(dqinx, seed, dizhi);
                MyFuncUtil.mylogandxianshi("模拟器" + dqinx + "改名");
                MyLdcmd.myRename(dqinx, "雷" + dqinx + "-" + cgcishu, dizhi);
                temp = MyFuncUtil.Launch(dqinx, dizhi);
                if (!temp)
                {
                    MyFuncUtil.mylogandxianshi("模拟器" + dqinx + "打开失败");
                    Thread.Sleep(20000);
                    continue;
                }
                int i = MyFuncUtil.QiDongWanChengInx(a_b, dqinx, apkName);
                if (i == -1)
                {
                    MyFuncUtil.mylogandxianshi("模拟器" + dqinx + "打开app" + apkName + "失败");
                    Thread.Sleep(20000);
                    continue;
                }
                MyLdcmd.mySort(a_b);
                //Thread.Sleep(2000 * 60 * 200);
                //lock (obj)
                {
                    myDm        dm = new myDm();
                    MingRi_Sort mr = new MingRi_Sort(dm, dqinx, dizhi);
                    //登录 要下载文件 暂定十分钟 发现start按钮则立刻跳出
                    tmpBool = mr.denglu(10);
                    if (!tmpBool)
                    {
                        tmpBoolString.Append("登录环节出错");
                        return;
                    }
                    tmpBool = mr.zhuce(3);
                    if (!tmpBool)
                    {
                        tmpBoolString.Append("注册环节出错");
                        return;
                    }
                    string bmpname = dqinx + "_" + dm.GetTime();
                    mr.zhuxian();
                    Thread.Sleep(10000);
                    int rg = mr.ganyuan_jietu();
                    if (rg != -1)
                    {
                        Thread.Sleep(10000);
                        MyLdcmd.myScreencap(dqinx, path + bmpname + ".png", dizhi);
                        Thread.Sleep(20000);
                        if (dm.IsFileExist(path + bmpname + ".png") == 1)
                        {
                            string abc = mr.generalBasicDemo(dqinx, path + bmpname + ".png");
                            WriteLog.WriteLogFile(dqinx + "", abc + " " + abc.Length);
                            MyFuncUtil.MyRestore(dqinx, abc, a_b);
                            if (abc.Length > 0)
                            {
                                cgcishu++;
                            }
                            else
                            {
                                dm.DeleteFile(path + bmpname + ".png");
                            }
                        }
                    }
                    cishu++;
                    var js = MyFuncUtil.GetTimestamp();
                    MyFuncUtil.mylogandxianshi("模拟器" + dqinx + "循环" + cishu + "次数");
                    MyFuncUtil.mylogandxianshi("模拟器" + dqinx + "循环1次耗时" + MyFuncUtil.SecondToHour(js - ks));
                }
            }
        }