Exemple #1
0
        public static void ClearAndCopySimulator(string a_b)
        {
            MyFuncUtil.mylogandxianshi("关闭全部模拟器");
            string dizhi = null;
            string path  = null;
            string seed  = null;

            MyFuncUtil.myqiehuancd(a_b, out dizhi, out path, out seed);
            MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);

            myQuitAll(dizhi);
            Thread.Sleep(20000);
            MyFuncUtil.mylogandxianshi("删除全部模拟器");
            myRemoveAll(dizhi);
            Thread.Sleep(20000);
            MyFuncUtil.mylogandxianshi("模拟器0复原");
            myRestore(0, seed, dizhi);
            Thread.Sleep(30000);
            MyFuncUtil.mylogandxianshi("开始模拟器复制");
            int sl = 0;

            if (a_b.ToLower().Equals("c"))
            {
                sl = 19;
            }
            if (a_b.ToLower().Equals("d"))
            {
                sl = 21;
            }
            myCopySimulator(sl, dizhi);
            Thread.Sleep(20000);
        }
Exemple #2
0
        public int qushufrombaidu_gaoqing(myDm mf, int dqinx, int jubing, int x1, int y1, int x2w, int y2h)
        {
            WriteLog.WriteLogFile(dqinx + "", "先截图再取数gaoqing");
            int    qushu     = -1;
            string timestamp = mf.GetTime() + "";
            string mydir1    = @"d:\mypic_save\" + timestamp + ".png";

            MyLdcmd.myScreencap(dqinx, mydir1);
            System.Drawing.Bitmap f = MyFuncUtil.ReadImageFile(mydir1);
            if (f != null)
            {
                System.Drawing.Bitmap g = MyFuncUtil.KiCut(f, x1, y1, x2w, y2h);
                g.Save(@"d:\mypic_save\" + timestamp + "_1.jpg");
                g.Dispose();
            }
            if (File.Exists(@"d:\mypic_save\" + timestamp + "_1.jpg"))
            {
                string r = shuzishibie(dqinx, @"d:\mypic_save\" + timestamp + "_1.jpg");
                if (r != null && r != "")
                {
                    qushu = int.Parse(r);
                    WriteLog.WriteLogFile(dqinx + "", " 高清取数的结果" + qushu);
                }
            }
            return(qushu);
        }
Exemple #3
0
        public static void myCopySimulator(int shuliang, string dizhi)
        {
            MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);
            int     i       = 0;

            while (true)
            {
                MyFuncUtil.mylogandxianshi((i++) + "个模拟器开始复制");
                int[] moniqiIndex = getDqmoniqiIndex(dizhi);
                try
                {
                    LogWriteLock.EnterWriteLock();
                    ld.CopySimulator(0);
                }
                catch { }
                finally
                {
                    LogWriteLock.ExitWriteLock();
                }
                Thread.Sleep(40000);
                if (moniqiIndex.Length >= shuliang)
                {
                    break;
                }
            }
        }
Exemple #4
0
        public static bool PanDuan_Qidong(string a_b, int dqinx)
        {
            //大框 原始 376 668 横过来后 960 540
            //小框 原始 217 387 横过来后216 122
            //1920 分辨率  2560 1440
            string dizhi = null;
            string path  = null;
            string seed  = null;

            MyFuncUtil.myqiehuancd(a_b, out dizhi, out path, out seed);
            myDm dm     = new myDm();
            int  x1     = -1;
            int  y1     = -1;
            int  jubing = MyLdcmd.getDqmoniqiJuBingByIndex(dqinx, dizhi);

            if (jubing <= 0)
            {
                WriteLog.WriteLogFile(dqinx + "", "游戏判断启动,句柄绑定错误");
                return(false);
            }
            dm.myGetClientRect(jubing, out x1, out y1);
            if (y1 != 540 && y1 != 122 && y1 != 668 && y1 != 432)
            {
                WriteLog.WriteLogFile(dqinx + "", "游戏启动不成功,界面有微信图标 " + x1 + " " + y1);
                return(false);
            }
            return(true);
        }
Exemple #5
0
        public bool PanDuan_QidongByYiQuDian(int dqinx, int haomiao, myDm mf, int jubing, out string yiqudian)
        {
            WriteLog.WriteLogFile(dqinx + "", "模拟器发现已取点已去电非ip-开始判断" + haomiao);
            long   ks        = MyFuncUtil.GetTimestamp();
            var    rt        = false;
            string oyiqudian = "";

            while (true)
            {
                long js = MyFuncUtil.GetTimestamp();
                if ((js - ks) > haomiao)
                {
                    break;
                }
                int r = panduankasiqudian(dqinx, mf, jubing, out oyiqudian);
                if (r >= 1)
                {
                    rt = true;
                    break;
                }
            }
            yiqudian = oyiqudian;
            WriteLog.WriteLogFile(dqinx + "", "模拟器发现已取点已去电非ip-结束判断" + haomiao);
            return(rt);
        }
Exemple #6
0
        public static void myQuitAll(string dizhi)
        {
            MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);

            MyFuncUtil.killProcess("dnplayer");
            Thread.Sleep(10000);
            int[] abcd = getDqmoniqiHuodongIndex(dizhi);
            foreach (var a in abcd)
            {
                if (a == -1)
                {
                    continue;
                }
                while (true)
                {
                    int[]     abc = getDqmoniqiHuodongIndex(dizhi);
                    ArrayList ar  = new ArrayList(); //实例化一个ArrayList
                    ar.AddRange(abc);                //把数组赋到Arraylist对象
                    if (ar.Contains(a))
                    {
                        MyFuncUtil.mylogandxianshi("关闭模拟器" + a);
                        ld.Quit(a);
                    }
                    if (!ar.Contains(a))
                    {
                        MyFuncUtil.mylogandxianshi("模拟器" + a + ",关闭成功");
                        break;
                    }
                }
            }
        }
Exemple #7
0
        public void shuruqianhuitui(myDm mf, int dqinx, int jubing)
        {
            WriteLog.WriteLogFile(dqinx + "", "输入前要回退");
            int i1 = MyFuncUtil.suijishu(15, 15);

            for (int i = 0; i < i1; i++)
            {
                mf.myKeyPressChar(jubing, "back");
                mf.mydelay(2, 5);
            }
            mf.mydelay(800, 1200);
        }
Exemple #8
0
        public static bool lureninstallOk(int dqinx, string apppackage, Action myinstall)
        {
            WriteLog.WriteLogFile(dqinx + "", "检测安装是否成功" + apppackage);
            bool t = false;
            //隔30秒检测是否安装成功
            long ksjs   = MyFuncUtil.GetTimestamp();
            long ks     = MyFuncUtil.GetTimestamp();
            long ks2    = MyFuncUtil.GetTimestamp();
            bool luren  = false;
            int  yici   = 0;
            int  zhuang = 0;

            while (true)
            {
                if (yici == 0)
                {
                    yici = 1;
                    WriteLog.WriteLogFile(dqinx + "", "开头要检测安装一次" + apppackage);
                    luren = MyLdcmd.jingjieisok(dqinx, apppackage);
                    if (!luren)
                    {
                        WriteLog.WriteLogFile(dqinx + "", "开头不成功,安装一次" + apppackage);
                        myinstall();
                    }
                }
                long js = MyFuncUtil.GetTimestamp();
                if ((js - ks) > 30 * 1000)
                {
                    luren = MyLdcmd.jingjieisok(dqinx, apppackage);
                    ks    = MyFuncUtil.GetTimestamp();
                    WriteLog.WriteLogFile(dqinx + "", "30s检测安装一次" + apppackage + "检测结果:" + luren);
                }
                if ((js - ksjs) > 4 * 60 * 1000)
                {
                    WriteLog.WriteLogFile(dqinx + "", "4分钟了,安装app没成功" + apppackage);
                    break;
                }
                if (luren)
                {
                    WriteLog.WriteLogFile(dqinx + "", "安装app成功" + apppackage);
                    t = true;
                    break;
                }
                if (zhuang < 1 && !luren && (js - ks2) > 60 * 1000)
                {
                    WriteLog.WriteLogFile(dqinx + "", "准备安装app,restore或者install");
                    myinstall();
                    ks2 = MyFuncUtil.GetTimestamp();
                    zhuang++;
                }
            }
            return(t);
        }
Exemple #9
0
        public bool PanDuan_QidongByYiQuDian_IP(int dqinx, int haomiao, myDm mf, int jubing, out string yiqudian)
        {
            WriteLog.WriteLogFile(dqinx + "", "模拟器发现已取点-开始判断" + haomiao);
            long   ks        = MyFuncUtil.GetTimestamp();
            var    rt        = false;
            string oyiqudian = "请稍候";

            Entity.FuHeSanDian f = fuzhu.TongYong_SanDian.GetObject().findFuHeSandianByName("IPtool");
            lock (obj)
            {
                while (true)
                {
                    long js = MyFuncUtil.GetTimestamp();
                    if ((js - ks) > haomiao)
                    {
                        break;
                    }
                    if (mf.mohuByLeiBool(f.Sd))
                    {
                        WriteLog.WriteLogFile(dqinx + "", f.Name + "模糊取到" + jubing + " " + mf.bindWindow(jubing));
                        //mf.mytap(this._jubing, fh.Zhidingx, fh.Zhidingy);
                        //mf.myMove(jubing, f.Zhidingx, f.Zhidingy);
                        if (mf.mohu_duokai(84, 237, 0xd5d5d5) == 1)
                        {
                            mf.mytap_duokai(jubing, 84, 237);
                            WriteLog.WriteLogFile(dqinx + "", "复制信息1");
                        }
                        mf.mydelay(2000, 3000);
                        if (mf.mohu_duokai(80, 536, 0xffffff) == 1)
                        {
                            mf.mytap_duokai(jubing, 80, 536);
                            mf.mydelay(2000, 3000);
                            //mf.mytap_duokai(jubing, 428, 763);
                            //mf.mydelay(2000, 3000);
                            WriteLog.WriteLogFile(dqinx + "", "复制信息2");
                        }
                        WriteLog.WriteLogFile(dqinx + "", mf.GetClipboard() + " 当前剪切板");
                        oyiqudian = mf.GetClipboard();
                        if (oyiqudian != "" && oyiqudian.IndexOf("请") < 0)
                        {
                            rt = true;
                            break;
                        }
                    }
                }
            }
            yiqudian = oyiqudian;
            return(rt);
        }
Exemple #10
0
        public void zd()
        {
            MyFuncUtil.mylogandxianshi("开始测试");
            string        connString = @"Data Source=DEEP-2019RJUDYT\SQLEXPRESS;Initial Catalog=yiquan;User ID=sa;Password=123456";
            SqlConnection conn       = new SqlConnection(connString); //实例连接对象

            conn.Open();                                              //打开数据库连接
            string     sqlString = "select * from zhanghao";
            SqlCommand command   = conn.CreateCommand();              //通过连接对象创建数据库命令对象

            command.CommandText = sqlString;                          //确定文本对象执行的SQL语句
            SqlDataReader dataReader = command.ExecuteReader();

            while (dataReader.Read())
            {
                string str = null;
                for (int i = 0; i < dataReader.FieldCount; i++)
                {
                    str += dataReader.GetValue(i).ToString().Trim() + "\t";
                }
                str += "\n";
                MyFuncUtil.mylogandxianshi(str);
            }
            dataReader.Close();
            //数据库查询:
            SqlDataAdapter sqlDa = new SqlDataAdapter("select * from zhanghao", conn);
            DataTable      dt    = new DataTable();

            sqlDa.Fill(dt);
            string name = dt.Rows[0][0].ToString();

            MyFuncUtil.mylogandxianshi(name + "----");
            //数据库插入更新操作:
            //SqlCommand sqlCmd = new SqlCommand("insert into tb_scene_tb (id,scene_id) values('1','123')", conn);
            SqlCommand sqlCmd = new SqlCommand("update zhanghao set name='lisi2' where name='lisi'", conn);

            sqlCmd.ExecuteNonQuery();
            sqlDa = new SqlDataAdapter("select * from zhanghao", conn);
            dt    = new DataTable();
            sqlDa.Fill(dt);
            name = dt.Rows[0][0].ToString();
            MyFuncUtil.mylogandxianshi(name + "----2");
            conn.Close();

            MyFuncUtil.mylogandxianshi("结束测试");
        }
Exemple #11
0
        public static void RunDuokaiqi(string a_b)
        {
            WriteLog.WriteLogFile("", "打开多开器");
            MyFuncUtil.killProcess("dnmultiplayer");
            Thread.Sleep(10000);
            Process p = new Process();

            if (a_b.ToLower().Equals("c"))
            {
                p.StartInfo.FileName = appNamec;
            }
            if (a_b.ToLower().Equals("d"))
            {
                p.StartInfo.FileName = appNamed;
            }
            //启动程序
            p.Start();
            WriteLog.WriteLogFile("", "结束打开多开器2");
        }
Exemple #12
0
        public static void panduanqidong(int dqinx, string a_b)
        {
            string dizhi = null;
            string path  = null;
            string seed  = null;

            MyFuncUtil.myqiehuancd(a_b, out dizhi, out path, out seed);
            myDm dm     = new myDm();
            int  x1     = -1;
            int  y1     = -1;
            int  jubing = MyLdcmd.getDqmoniqiJuBingByIndex(dqinx, dizhi);

            if (jubing <= 0)
            {
                return;
            }
            dm.myGetClientRect(jubing, out x1, out y1);
            MyFuncUtil.mylogandxianshi("游戏启动不成功,界面有微信图标" + x1 + "  " + y1);
        }
Exemple #13
0
        public static int QiDongWanChengLurenzhanghao(string a_b, int dqinx, string app)
        {
            WriteLog.WriteLogFile(dqinx + "", "尝试打开app" + app);
            bool qidongcg = true;
            long ks       = GetTimestamp();
            int  i        = 1;

            while (true)
            {
                if (i == 1)
                {
                    Qidong(dqinx, app);
                    Thread.Sleep(1000 * 20);
                    i++;
                }
                if (PanDuan_QidongLurenzhanghao(a_b, dqinx))
                {
                    break;
                }
                long js = MyFuncUtil.GetTimestamp();
                Thread.Sleep(20000);
                if ((js - ks) > 1000 * 60)
                {
                    i = 1;
                }
                if ((js - ks) > 1000 * 60 * 5)
                {
                    WriteLog.WriteLogFile(dqinx + "", "打开app很久5分钟也没打开" + dqinx);
                    qidongcg = false;
                    break;
                }
            }
            if (!qidongcg)
            {
                MyFuncUtil.mylogandxianshi("打开app失败" + dqinx);
                return(-1);
            }
            return(dqinx);
        }
Exemple #14
0
        public int QiDongWanChengGetZhiDingDian(int dqinx, string app, myDm dm, int jubing, fuzhu.SanDianAbs sdabs, string sdname)
        {
            WriteLog.WriteLogFile(dqinx + "", "尝试打开app" + app);
            bool qidongcg = true;
            long ks       = MyFuncUtil.GetTimestamp();
            int  i        = 1;

            while (true)
            {
                if (i == 1)
                {
                    MyFuncUtil.Qidong(dqinx, app);
                    Thread.Sleep(1000 * 20);
                    i++;
                }
                if (PanDuan_GetZhiDingDian(dqinx, dm, jubing, sdabs, sdname))
                {
                    break;
                }
                long js = MyFuncUtil.GetTimestamp();
                Thread.Sleep(20000);
                if ((js - ks) > 1000 * 60)
                {
                    i = 1;
                }
                if ((js - ks) > 1000 * 60 * 5)
                {
                    WriteLog.WriteLogFile(dqinx + "", "打开app很久5分钟也没打开" + dqinx);
                    qidongcg = false;
                    break;
                }
            }
            if (!qidongcg)
            {
                MyFuncUtil.mylogandxianshi("打开app失败" + dqinx);
                return(-1);
            }
            return(dqinx);
        }
Exemple #15
0
        public static void myLaunch1(int index, string dizhi)
        {
            MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);
            Int64   kstime  = MyFuncUtil.GetTimestamp();

            while (true)
            {
                ld.Launch(index);
                Thread.Sleep(20000);
                int[] abc = getDqmoniqiHuodongIndex(dizhi);
                if (abc.Contains(index))
                {
                    break;
                }
                Int64 jstime = MyFuncUtil.GetTimestamp();
                if ((jstime - kstime) > 1000 * 60 * 5)
                {
                    MyFuncUtil.mylogandxianshi("打开很久5分钟也没打开" + index);
                    break;
                }
            }
        }
Exemple #16
0
        public static void myRemoveAll(string dizhi)
        {
            MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);

            while (true)
            {
                int[] moniqiIndex = getDqmoniqiIndex(dizhi);
                foreach (int i in moniqiIndex)
                {
                    if (i == 0)
                    {
                        continue;
                    }
                    ld.RemoveSimulator(i);
                    MyFuncUtil.mylogandxianshi(i + "个模拟器开始移除");
                    Thread.Sleep(10000);
                }
                if (moniqiIndex.Length == 1)
                {
                    break;
                }
            }
        }
Exemple #17
0
        public bool PanDuan_QidongBySize(int dqinx, int waicengjubing, int haomiao, int wid = 727, int hei = 425)
        {
            long ks = MyFuncUtil.GetTimestamp();
            var  rt = false;

            while (true)
            {
                long js = MyFuncUtil.GetTimestamp();
                if ((js - ks) > haomiao)
                {
                    break;
                }
                int w = -1, h = -1;
                getWindowSize(dqinx, waicengjubing, out w, out h);
                if (w == wid && h == hei)
                {
                    rt = true;
                    break;
                }
                Thread.Sleep(3000);
                myReSizeByWAndH(dqinx, waicengjubing, wid, hei);
            }
            return(rt);
        }
Exemple #18
0
        /// <summary>
        /// 写入日志文件
        /// </summary>
        /// <param name="input"></param>
        public static void WriteLogFile(string moniqi, string input)
        {
            //MyFuncUtil.myxinxitishi(moniqi+" "+input);
            MyFuncUtil.setXinXiTiShi(moniqi + " " + input);
            string dir = "C:\\mylog\\" + DateTime.Now.Year +
                         DateTime.Now.Month +
                         DateTime.Now.Day + "\\";
            ///指定日志文件的目录
            string fname2 = dir +
                            DateTime.Now.Year + '-' +
                            DateTime.Now.Month + '-' +
                            DateTime.Now.Day + "_LogFile" + ".txt";
            string fname = dir + moniqi + "_LogFile" + ".txt";

            if (!Directory.Exists(dir))//如果不存在就创建file文件夹                 
            {
                Directory.CreateDirectory(dir);
            }

            if (!File.Exists(fname))
            {
                //不存在文件
                File.Create(fname).Dispose();//创建该文件
            }

            /**/
            ///判断文件是否存在以及是否大于2K

            /* if (finfo.Length > 1024 * 1024 * 10)
             * {
             * /**/
            //文件超过10MB则重命名

            /* File.Move(fname, Directory.GetCurrentDirectory() + DateTime.Now.TimeOfDay + "\\LogFile.txt");
             * //删除该文件
             * //finfo.Delete();
             * }*/
            try
            {
                LogWriteLock.EnterWriteLock();


                using (StreamWriter log = new StreamWriter(fname, true))
                {
                    //FileStream fs = new FileStream(url, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);FileMode.Append

                    ///设置写数据流的起始位置为文件流的末尾
                    log.BaseStream.Seek(0, SeekOrigin.End);

                    ///写入“Log Entry : ”
                    log.Write("\n\rLog Entry : ");

                    ///写入当前主机名 模拟器名字并换行
                    //log.Write("{0} {1} \t", getMachineName(), moniqi);
                    ///写入当前系统时间并换行
                    log.Write("{0} {1} {2}  \n\r", moniqi + "__", DateTime.Now.ToLongTimeString(),
                              DateTime.Now.ToLongDateString());
                    ///写入日志内容并换行
                    log.Write("{0} {1}  \n\r", moniqi + "__", input);

                    //清空缓冲区
                    log.Flush();
                    //关闭流
                    log.Close();
                }
            }
            catch (Exception) { }
            finally {
                LogWriteLock.ExitWriteLock();
            }
        }
Exemple #19
0
        public bool myQuit(int index, string dizhi, int jubing)
        {
            var res = false;

            if (jubing <= 0)
            {
                WriteLog.WriteLogFile(index + "", "准备获取句柄,在myquit处");
                jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
            }
            IntPtr p = new IntPtr(jubing);

            PostMessage(p, WM_CLOSE, 0, 0);
            Thread.Sleep(5000);
            MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);
            long    kstime  = MyFuncUtil.GetTimestamp();
            long    kstime2 = MyFuncUtil.GetTimestamp();

            int[] abc = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
            if (abc.Contains(index))
            {
                MyLdcmd.getLdCmd().Quit(index);
                Thread.Sleep(5000);
                MyFuncUtil.zaiciguanbi();
            }
            abc = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
            if (!abc.Contains(index))
            {
                return(true);
            }
            int shi = 0;

            while (true)
            {
                long jstime = MyFuncUtil.GetTimestamp();
                if ((jstime - kstime2) > 1000 * 30)
                {
                    abc     = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                    kstime2 = MyFuncUtil.GetTimestamp();
                }
                if (shi == 0 && abc.Contains(index))
                {
                    MyLdcmd.getLdCmd().Quit(index);
                    Thread.Sleep(5000);
                    MyFuncUtil.zaiciguanbi();
                    shi = 1;
                }
                if (shi == 1 && abc.Contains(index))
                {
                    PostMessage(p, WM_CLOSE, 0, 0);
                    Thread.Sleep(5000);
                    shi = 0;
                }
                if (!abc.Contains(index))
                {
                    res = true;
                    break;
                }
                if ((jstime - kstime) > 1000 * 60 * 5)
                {
                    MyFuncUtil.mylogandxianshi("循环很久5分钟也没有关闭" + index);
                    break;
                }
            }

            return(res);
        }
Exemple #20
0
        public void getIP(int dqinx, string dizhi, string seed, int jubing, int waicengjubing, out string ip)
        {
            WriteLog.WriteLogFile(dqinx + "", "获取IP,jubing:" + jubing + ",waicengjubing:" + waicengjubing);
            ip = "";
            bool   t           = false;
            string packagename = "package:com.ddm.iptools";
            //lock (obj)
            {
                t = MyFuncUtil.lureninstallOk(dqinx, packagename, () =>
                {
                    WriteLog.WriteLogFile(dqinx + "", "安装app没成功--iptools");

                    /*temp = myQuit(dqinx, dizhi);
                     * if (!temp)
                     * {
                     *  WriteLog.WriteLogFile(dqinx + "", "模拟器" + dqinx + "关闭失败");
                     *  Thread.Sleep(20000);
                     *  return;
                     * }*/
                    WriteLog.WriteLogFile(dqinx + "", "模拟器" + dqinx + "安装iptools");
                    //MyLdcmd.myRestore(dqinx, seed, dizhi);
                    MyLdcmd.installApp(dqinx, @"C:\迅雷下载\2_1b823b1928a42f09423f28cb79179bfe.apk");

                    /*temp = myQuit(dqinx, dizhi);
                     * if (!temp)
                     * {
                     *  WriteLog.WriteLogFile(dqinx + "", "模拟器" + dqinx + "关闭失败");
                     *  Thread.Sleep(20000);
                     *  return;
                     * }
                     * temp = MyFuncUtil.Launch(dqinx, dizhi);
                     * if (!temp)
                     * {
                     *  WriteLog.WriteLogFile(dqinx + "", "模拟器" + dqinx + "打开失败");
                     *  Thread.Sleep(20000);
                     *  return;
                     * }*/
                    Thread.Sleep(3000);
                });
                if (t == false)
                {
                    Thread.Sleep(1000 * 60 * 2);
                    bool luren = MyLdcmd.jingjieisok(dqinx, packagename);
                    if (!luren)
                    {
                        return;
                    }
                }
                //窗口已打开 获取句柄
                if (jubing <= 0)
                {
                    WriteLog.WriteLogFile(dqinx + "", "准备获取句柄,在getIP处");
                    jubing = MyLdcmd.getDqmoniqiJuBingByIndex(dqinx, dizhi);
                    WriteLog.WriteLogFile(dqinx + "", "模拟器" + dqinx + "句柄为" + jubing);
                }
                myDm dm = new myDm();
                int  r1 = 0;
                if (jubing > 0)
                {
                    r1 = dm.bindWindow(jubing);
                }
                if (r1 != 1)
                {
                    WriteLog.WriteLogFile(dqinx + "", "模拟器" + dqinx + "绑定失败");
                    Thread.Sleep(20000);
                    return;
                }
                //dm.SetClipboard("请");
                //apkName = dict["IPtool"];
                string apkName = "com.ddm.iptools/com.ddm.iptools.ui.MainActivity";
                //int i = MyFuncUtil.QiDongWanChengLurenzhanghao("d", dqinx, apkName);
                fuzhu.YouXiFactory yxf = new fuzhu.YouXiFactory();
                int i = QiDongWanChengGetZhiDingDian(dqinx, apkName, dm, jubing, yxf.CreateYouXiSanDian("tongyongsandian"), "IPtool");
                if (i == -1)
                {
                    WriteLog.WriteLogFile(dqinx + "", "模拟器" + dqinx + "打开app" + apkName + "失败");
                    Thread.Sleep(20000);
                    return;
                }
                string yiqu = "";
                bool   t2   = PanDuan_QidongByYiQuDian_IP(dqinx, 1000 * 60, dm, jubing, out yiqu);
                if (t2)
                {
                    WriteLog.WriteLogFile(dqinx + "", "模拟器发现已取点" + yiqu);
                }
                ip = yiqu;

                /*if (ip != "" && ip.IndexOf("请") < 0)
                 * {
                 *  return;
                 * }  */
            }
        }
Exemple #21
0
        public bool lurenResizeOk(int index, string youxi = "luneng")
        {
            WriteLog.WriteLogFile(index + "", "改变窗口位置--开始");
            string dizhi = @"d:\ChangZhi\dnplayer2\";
            bool   t = false;
            long   ksjs = MyFuncUtil.GetTimestamp();
            long   ks = MyFuncUtil.GetTimestamp();
            int    width = -1, height = -1;

            myReSize(index, out width, out height, youxi);
            WriteLog.WriteLogFile(index + "", "准备获取句柄,在lurenResizeOk处");
            int jubing  = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
            int jubing2 = MyLdcmd.getDqmoniqiJuBingByIndex(index, dizhi);

            if (jubing <= 0)
            {
                WriteLog.WriteLogFile(index + "", "改变窗口位置,句柄绑定错误");
                return(t);
            }
            Rect lprect = new Rect();

            GetWindowRect(new IntPtr(jubing), out lprect);
            Rect rprect = new Rect();

            GetWindowRect(new IntPtr(jubing2), out rprect);
            WriteLog.WriteLogFile(index + "", "当前width,height" + width + "," + height + " 改变位置外框" + (lprect.Right - lprect.Left) + " " + (lprect.Bottom - lprect.Top) + ",内框" + (rprect.Right - rprect.Left) + " " + (rprect.Bottom - rprect.Top));
            if ((lprect.Right - lprect.Left) == width && (lprect.Bottom - lprect.Top) == height)
            {
                WriteLog.WriteLogFile(index + "", "改变位置外框成功" + (lprect.Right - lprect.Left) + " " + (lprect.Bottom - lprect.Top) + ",内框" + (rprect.Right - rprect.Left) + " " + (rprect.Bottom - rprect.Top));
                t = true;
                return(t);
            }
            while (true)
            {
                long js = MyFuncUtil.GetTimestamp();
                if ((js - ksjs) > 30 * 1000)
                {
                    lprect = new Rect();
                    GetWindowRect(new IntPtr(jubing), out lprect);
                    rprect = new Rect();
                    GetWindowRect(new IntPtr(jubing2), out rprect);
                    WriteLog.WriteLogFile(index + "", "当前width,height" + width + "," + height + " 改变位置外框" + (lprect.Right - lprect.Left) + " " + (lprect.Bottom - lprect.Top) + ",内框" + (rprect.Right - rprect.Left) + " " + (rprect.Bottom - rprect.Top));
                    if ((lprect.Right - lprect.Left) == width && (lprect.Bottom - lprect.Top) == height)
                    {
                        WriteLog.WriteLogFile(index + "", "改变位置外框" + (lprect.Right - lprect.Left) + " " + (lprect.Bottom - lprect.Top) + ",内框" + (rprect.Right - rprect.Left) + " " + (rprect.Bottom - rprect.Top));
                        t = true;
                        break;
                    }
                    if ((lprect.Right - lprect.Left) != width || (lprect.Bottom - lprect.Top) != height)
                    {
                        myReSize(index, out width, out height);
                    }
                    ksjs = MyFuncUtil.GetTimestamp();
                    WriteLog.WriteLogFile(index + "", "30s resize一次");
                }
                if ((js - ks) > 10 * 60 * 1000)
                {
                    WriteLog.WriteLogFile(index + "", "10分钟改变位置不成功 ");
                    break;
                }
            }
            return(t);
        }