Ejemplo n.º 1
0
        /// <summary>
        /// 从指定坐标按下鼠标左键 开始拖鼠标 到指定坐标2结束
        /// </summary>
        /// <param name="jubing"></param>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        public void touch(int x1, int y1, int x2, int y2)
        {
            //int res = mf.IsBind(jubing);
            //if (res != 1)
            {
                //res = bindWindow(jubing);
            }
            mf.mydelay(10, 20);
            mf.Mydm.MoveTo(x1, y1);
            mf.mydelay(200, 300);
            mf.Mydm.LeftDown();
            mf.mydelay(100, 200);
            int beichu1    = x1 >= x2 ? 10 : -10;
            int beichu2    = y1 >= y2 ? 10 : -10;
            int jiangex    = System.Math.Abs(x1 - x2) / beichu1;
            int jiangey    = System.Math.Abs(y1 - y2) / beichu2;
            int absjiangex = System.Math.Abs(jiangex);
            int absjiangey = System.Math.Abs(jiangey);
            //MyFuncUtil.mylogandxianshi("jiangex,jiangey" + jiangex + " " + jiangey + " beichu1:" + beichu1 + " beichu2:" + beichu2);
            int jiaoxiao = absjiangex <= absjiangey ? absjiangex : absjiangey;
            //MyFuncUtil.mylogandxianshi("jiaoxiao" + jiaoxiao);
            int dqx = x1;
            int dqy = y1;

            MyFuncUtil.mylogandxianshi("x1,y1---" + x1 + " " + y1);
            for (int i = 0; i < jiaoxiao; i++)
            {
                mf.Mydm.MoveTo(x1 - (i + 1) * beichu1, y1 - (i + 1) * beichu2);
                dqx = x1 - (i + 1) * beichu1;
                dqy = y1 - (i + 1) * beichu2;
                mf.mydelay(100, 300);
                //MyFuncUtil.mylogandxianshi("x1,y1 " + (x1 - (i + 1) * beichu1) + " " + (y1 - (i + 1) * beichu2));
                //MyFuncUtil.mylogandxianshi("dqx,dqy --"+dqx+" "+dqy);
            }
            int jiaoxiao2 = absjiangex > absjiangey ? absjiangex - absjiangey : absjiangey - absjiangex;

            if (absjiangex > absjiangey)
            {
                for (int i = 0; i < jiaoxiao2; i++)
                {
                    mf.Mydm.MoveTo(dqx - (i + 1) * beichu1, dqy);
                    mf.mydelay(100, 300);
                    //MyFuncUtil.mylogandxianshi("dqx,dqy --" + (dqx - (i + 1) * beichu1) + " " + dqy);
                }
            }
            else if (absjiangex < absjiangey)
            {
                for (int i = 0; i < jiaoxiao2; i++)
                {
                    mf.Mydm.MoveTo(dqx, dqy - (i + 1) * beichu2);
                    mf.mydelay(100, 300);
                    //MyFuncUtil.mylogandxianshi("dqx,dqy" + dqx + " " + (dqy - (i + 1) * beichu2));
                }
            }
            mf.Mydm.MoveTo(x2, y2);
            mf.mydelay(500, 2000);
            mf.Mydm.LeftUp();
            mf.mydelay(100, 300);
        }
Ejemplo n.º 2
0
        private void dpanduoxiancheng_Click(object sender, EventArgs e)
        {
            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 + ",开始");
                Thread.Sleep(2000);
                ThreadPool.SetMaxThreads(yunxingIndex.Length, yunxingIndex.Length); //设置最大线程数
                foreach (int inx in yunxingIndex)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(duoxiand), inx);//线程池指定线程执行Auto方法
                    Thread.Sleep(20000);
                }
                var ks = MyFuncUtil.GetTimestamp();
                var xs = false;
                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;
                    }
                    var js = MyFuncUtil.GetTimestamp();
                    if ((js - ks) > 1000 * 60 * 10)
                    {
                        xs = true;
                    }
                    if (xs)
                    {
                        MyFuncUtil.mylogandxianshi("当前工作线程数" + workerThreads);
                        xs = false;
                        ks = MyFuncUtil.GetTimestamp();
                    }
                }

                WriteLog.WriteLogFile("", "序号" + j + ",结束");
            }

            /*foreach (int a in yunxingIndex)
             * {
             *  ParameterizedThreadStart threadStart = new ParameterizedThreadStart(duoxiand);//通过ThreadStart委托告诉子线程执行什么方法 
             *  Thread thread = new Thread(threadStart);
             *  thread.Start(a);
             *  Thread.Sleep(60000);
             *  if (a > 9)
             *  {
             *      Thread.Sleep(120000);
             *  }
             * }*/
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            MyFuncUtil.mylogandxianshi("开始测试");
            string dizhi = null;
            string path  = null;
            string seed  = null;

            MyFuncUtil.myqiehuancd("d", out dizhi, out path, out seed);

            MyFuncUtil.panduanqidong(7, "d");
        }
Ejemplo n.º 4
0
        private void duoxian_cs(object dqind)
        {
            int    a     = (int)dqind;
            string a_b   = "d";
            string dizhi = null;
            string path  = null;
            string seed  = null;

            MyFuncUtil.myqiehuancd(a_b, out dizhi, out path, out seed);
            MyFuncUtil.mylogandxianshi("准备打开模拟器" + a);
            MyLdcmd.myRestore(a, seed, dizhi);
            Thread.Sleep(5000);
            MyFuncUtil.mylogandxianshi("模拟器" + a + "打开结束");
        }
Ejemplo n.º 5
0
        private bool panduanzhandou(SanDian sd)
        {
            bool rs = false;
            long ks = -1;

            if (mf.mohuByLei(sd) == 1)
            {
                ks = MyFuncUtil.GetTimestamp();
            }
            long js = MyFuncUtil.GetTimestamp();

            if ((js - ks) > 1000 * 60 * 10)
            {
                MyFuncUtil.mylogandxianshi("10分钟未战斗");
                //截图
                rs = true;
            }
            return(rs);
        }
Ejemplo n.º 6
0
        private bool panduankaping(int x, int y, int chushi = 1)
        {
            bool   rs     = false;
            string yanse1 = null;
            long   ks     = -1;

            if (chushi == 1)
            {
                yanse1 = mf.myGetColorWuJbYanse(x, y);
                ks     = MyFuncUtil.GetTimestamp();
            }
            string yanse2 = mf.myGetColorWuJbYanse(x, y);
            long   js     = MyFuncUtil.GetTimestamp();

            if ((js - ks) > 1000 * 60 * 5 && yanse2.Equals(yanse1))
            {
                MyFuncUtil.mylogandxianshi("卡屏5分钟,取点x:" + x + ",y:" + y);
                //截屏
                rs = true;
            }
            return(rs);
        }
Ejemplo n.º 7
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));
                }
            }
        }
Ejemplo n.º 8
0
        private void ceshi_button_Click(object sender, EventArgs e)
        {
            apkName = dict["明日方舟"];
            int[] yunxingIndex = new int[] { 1, 2, 11 };
            //MyFuncUtil.createDirIfNotExist("C");

            /*foreach (int a in yunxingIndex)
             * {
             *  ParameterizedThreadStart threadStart = new ParameterizedThreadStart(duoxianc);//通过ThreadStart委托告诉子线程执行什么方法 
             *  Thread thread = new Thread(threadStart);
             *  thread.Start(a);
             *  Thread.Sleep(60000);
             * }*/
            string dizhi = null;
            string path  = null;
            string seed  = null;
            string a_b   = "d";

            MyFuncUtil.myqiehuancd(a_b, out dizhi, out path, out seed);
            MyFuncUtil.mylogandxianshi("准备多线程测试");
            for (int j = 0; j < 5; j++)
            {
                MyFuncUtil.mylogandxianshi("序号" + j + ",开始");
                //MyLdcmd.ClearAndCopySimulator("d");
                //打开多开器
                //MyLdcmd.RunDuokaiqi("d");

                /*List<int> newinx = new List<int>();
                 * foreach (int myinx in yunxingIndex)
                 * {
                 *  int i=MyFuncUtil.QiDongWanChengInx("d", myinx, apkName);
                 *  if (i != -1) {
                 *      newinx.Add(i);
                 *  }
                 *  Thread.Sleep(3000);
                 * }*/

                ThreadPool.SetMaxThreads(yunxingIndex.Length, yunxingIndex.Length); //设置最大线程数
                foreach (int inx in yunxingIndex)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(duoxian_cs), inx);//线程池指定线程执行Auto方法
                    Thread.Sleep(1000);
                }
                long ks = MyFuncUtil.GetTimestamp();
                var  xs = false;
                while (true)
                {
                    Thread.Sleep(1000);//这句写着,主要是没必要循环那么多次。去掉也可以。
                    int maxWorkerThreads, workerThreads;
                    int portThreads;
                    ThreadPool.GetMaxThreads(out maxWorkerThreads, out portThreads);
                    ThreadPool.GetAvailableThreads(out workerThreads, out portThreads);
                    if (maxWorkerThreads - workerThreads == 0)
                    {
                        Console.WriteLine("结束了");
                        break;
                    }
                    long js = MyFuncUtil.GetTimestamp();
                    if ((js - ks) > 1000 * 60 * 10)
                    {
                        xs = true;
                    }
                    if (xs)
                    {
                        MyFuncUtil.mylogandxianshi("当前工作线程数" + workerThreads);
                        xs = false;
                        ks = MyFuncUtil.GetTimestamp();
                    }
                }
                MyFuncUtil.mylogandxianshi("序号" + j + ",结束");
            }
        }