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); }
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); }
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); }
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); }
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); }
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; } } }
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); }
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); }
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); }