public string shuzishibie(int ind, string path) { WriteLog.WriteLogFile(ind + "", "进入到数字识别"); JObject rs = Number(path); if (rs.Root["words_result"] == null) { return(null); } var txts = (from obj in (JArray)rs.Root["words_result"] select(string) obj["words"]); string rt = ""; foreach (var r in txts) { if (r != null) { string ar = r.Trim(); if (!ar.Equals("")) { WriteLog.WriteLogFile(ind + "", "识别出的" + ar + "--" + ar.Equals("")); rt = r; break; } } } int a = -1; try { a = int.Parse(rt); } catch (Exception e) { WriteLog.WriteLogFile(ind + "", "数字转换出错" + e.Message); a = -1; throw e; } return(a + ""); }
private static void duokaiqiAdd() { WriteLog.WriteLogFile("", "打开模拟器,新增9个,搞账号"); lock (obj) { myDm dm = new myDm(); int jb = dm.FindWindowEx(0, "", "雷电多开器"); if (jb <= 0) { WriteLog.WriteLogFile("", "多开器未找到"); return; } int res = dm.bindWindow(jb); for (int i = 0; i < 2; i++) { if (res > 0) { dm.mytap_duokai(jb, 125, 628); Thread.Sleep(2000); int jb2 = dm.FindWindowEx(0, "assistantupdateframe", ""); if (jb2 <= 0) { WriteLog.WriteLogFile("", "多开器弹出框未找到"); return; } myDm dm2 = new myDm(); int res2 = dm2.bindWindow(jb2); if (res2 > 0) { dm2.click(92, 12, 300); Thread.Sleep(1000 * 30); } } } } }
public static void LaunchAll(int shuliang) { zaiciguanbi(); Thread.Sleep(2000); myDm dm = new myDm(); lock (dm) { int jb = dm.FindWindowEx(0, "", "雷电多开器"); int res = dm.bindWindow(jb); int dian = 0; if (res > 0) { Thread.Sleep(2000); for (var j = 0; j < 20; j++) { dm.mytap(jb, 674, 97); Thread.Sleep(1500); } for (int i = 0; i < shuliang; i++) { Thread.Sleep(2000); int x = 373; int y = 116; int jiange = 50; if (i <= 9) { String tmpcolor = dm.GetColor(x - 90, y + i * jiange); if (!("c6c6c6".Equals(tmpcolor))) { WriteLog.WriteLogFile("", i + " " + tmpcolor); //return; } dm.mytap(jb, x, y + i * jiange); Thread.Sleep(12000); } else { if (dian == 0) { Thread.Sleep(2000); for (var j = 0; j < 12; j++) { dm.mytap(jb, 674, 593); Thread.Sleep(1500); } dian = 1; } String tmpcolor = dm.GetColor(x - 90, y + i * jiange - 340); if (!("c6c6c6".Equals(tmpcolor))) { WriteLog.WriteLogFile("", i + "颜色不对呀 " + tmpcolor); //return; } dm.mytap(jb, x, y + i * jiange - 340); Thread.Sleep(12000); } } } } }
public static void Qidong(int dqinx, string app) { WriteLog.WriteLogFile("" + dqinx, dqinx + "----" + app + ",thread:" + Thread.CurrentThread.ManagedThreadId); MyLdcmd.getLdCmd().StartApp(dqinx, app); }
public static bool lurenResizeOk1(int index) { WriteLog.WriteLogFile(index + "", "改变窗口位置--开始"); string dizhi = @"d:\ChangZhi\dnplayer2\"; bool t = false; long ksjs = GetTimestamp(); long ks = GetTimestamp(); int width = -1, height = -1; myReSize1(index, out width, out height); 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 = 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) { myReSize1(index, out width, out height); } ksjs = GetTimestamp(); WriteLog.WriteLogFile(index + "", "30s resize一次"); } if ((js - ks) > 10 * 60 * 1000) { WriteLog.WriteLogFile(index + "", "10分钟改变位置不成功 "); break; } } return(t); }
public static void mylogandxianshi(String a) { WriteLog.WriteLogFile("", a); //myxinxitishi(a); }
private static void dakaimoniqiByIndex(int index) { zaiciguanbi(); Thread.Sleep(2000); WriteLog.WriteLogFile(index + "", "打开模拟器" + index); lock (obj) { myDm dm = new myDm(); int jb = dm.FindWindowEx(0, "", "雷电多开器"); if (jb <= 0) { WriteLog.WriteLogFile(index + "", "多开器未找到" + index); return; } int res = dm.bindWindow(jb); if (res > 0) { Thread.Sleep(2000); for (var i = 0; i < 25; i++) { dm.mytap_duokai(jb, 674, 97); Thread.Sleep(1500); } int x = 373; int y = 126; int jiange = 50; if (index <= 9) { String tmpcolor = dm.GetColor(x - 90, y + index * jiange); if (!("c6c6c6".Equals(tmpcolor))) { //WriteLog.WriteLogFile("", index + " " + tmpcolor); //return; } dm.mytap_duokai(jb, x, y + index * jiange); Thread.Sleep(12000); } else if (index > 9 && index <= 16) { Thread.Sleep(2000); for (var i = 0; i < 12; i++) { dm.mytap_duokai(jb, 674, 593); Thread.Sleep(1500); } String tmpcolor = dm.GetColor(x - 90, y + index * jiange - 340); if (!("c6c6c6".Equals(tmpcolor))) { //WriteLog.WriteLogFile("", index + "颜色不对呀 " + tmpcolor); //return; } dm.mytap_duokai(jb, x, y + index * jiange - 340); Thread.Sleep(12000); } else { Thread.Sleep(2000); for (var i = 0; i < 19; i++) { dm.mytap_duokai(jb, 674, 593); Thread.Sleep(1500); } String tmpcolor = dm.GetColor(x - 90, y + index * jiange - 545); WriteLog.WriteLogFile("", (x - 90) + " " + (y + index * jiange - 545)); if (!("c6c6c6".Equals(tmpcolor))) { //WriteLog.WriteLogFile("", index + "颜色不对呀 " + tmpcolor); //return; } dm.mytap_duokai(jb, x, y + index * jiange - 545); Thread.Sleep(12000); } } } }
/// <summary> /// 更新运行情况表 /// </summary> /// <param name="youxi"></param> public void gxYunXingQk() { //得到运行情况后存入表 WriteLog.WriteLogFile("", "得到运行情况后存入表"); SqlHelp sqh = SqlHelp.GetInstance(); lock (obj) { try { YunXingQK jqqk = new YunXingQK(); string selsql = "select " + "sum(case when z.pcname='1hao' and z.xgsj>=convert(varchar(10),getdate(),120) then 1 else 0 end) hao1chanshu," + "sum(case when z.pcname='2hao' and z.xgsj>=convert(varchar(10),getdate(),120) then 1 else 0 end) hao2xiugai," + "sum(case when z.pcname='2hao' and z.zuanshi>0 and z.xgsj>=convert(varchar(10),getdate(),120) then 1 else 0 end) hao2chanshu," + "sum(case when z.pcname='3hao' and z.xgsj>=convert(varchar(10),getdate(),120) then 1 else 0 end) hao3xiugai," + "sum(case when z.pcname='3hao' and z.zuanshi>0 and z.xgsj>=convert(varchar(10),getdate(),120) then 1 else 0 end) hao2chanshu," + "sum(case when z.pcname='wlzhongkong' and z.xgsj>=convert(varchar(10),getdate(),120) then 1 else 0 end) zkxiugai," + "sum(case when z.pcname='wlzhongkong' and z.zuanshi>0 and z.xgsj>=convert(varchar(10),getdate(),120) then 1 else 0 end) zkchanshu," + "sum(case when z.zuanshi>0 then 1 else 0 end) zuanshidayu0," + "sum(case when z.zuanshi>1000 then 1 else 0 end) zuanshidayu1000," + "sum(case when z.zuanshi>3000 then 1 else 0 end) zuanshidayu3000," + "sum(case when z.qiangzhequan>0 then 1 else 0 end) qiangzhedayu0," + "sum(case when z.xgsj>=convert(varchar(10),getdate(),120) then 1 else 0 end) zxiugai" + " from zhanghao z where yxbz='Y' and yimai='N'"; DataTable dt = sqh.getAll(selsql); int a = dt.Rows.Count; if (dt.Rows.Count > 0) { Dictionary <string, JiQiYunXing> dict = new Dictionary <string, JiQiYunXing>(); JiQiYunXing jq1 = new JiQiYunXing(); jq1.Chuchan = (int)dt.Rows[0][0]; dict.Add("hao1", jq1); JiQiYunXing jq2 = new JiQiYunXing(); jq2.Xiugai = (int)dt.Rows[0][1]; jq2.Chuchan = (int)dt.Rows[0][2]; dict.Add("hao2", jq2); JiQiYunXing jq3 = new JiQiYunXing(); jq3.Xiugai = (int)dt.Rows[0][3]; jq3.Chuchan = (int)dt.Rows[0][4]; dict.Add("hao3", jq3); JiQiYunXing zk = new JiQiYunXing(); zk.Xiugai = (int)dt.Rows[0][5]; zk.Chuchan = (int)dt.Rows[0][6]; dict.Add("zk", zk); jqqk.Jqyx = dict; jqqk.Zuanshidayu0 = (int)dt.Rows[0][7]; jqqk.Zuanshidayu1000 = (int)dt.Rows[0][8]; jqqk.Zuanshidayu3000 = (int)dt.Rows[0][9]; jqqk.Qiangzhedayu0 = (int)dt.Rows[0][10]; jqqk.Xgsj = DateTime.Now; jqqk.Zongxiugai = (int)dt.Rows[0][11]; WriteLog.WriteLogFile("", "当前运行机器的出产情况" + jqqk.Zongxiugai + "单独:" + jqqk.Jqyx["hao1"].Chuchan + " " + jqqk.Jqyx["hao2"].Chuchan + " " + jqqk.Jqyx["hao3"].Chuchan + " " + jqqk.Jqyx["zk"].Chuchan); } string inssql = "insert into yunxingqk (hao1chanchu,hao2xiugai,hao2chanchu,hao3xiugai,hao3chanchu,zkxiugai,zkchanchu,zuanshidayu0,zuanshidayu1000,zuanshidayu3000,qiangzhedayu0,gxsj,zxiugai) values(" + jqqk.Jqyx["hao1"].Chuchan + "," + jqqk.Jqyx["hao2"].Xiugai + "," + jqqk.Jqyx["hao2"].Chuchan + "," + jqqk.Jqyx["hao3"].Xiugai + "," + jqqk.Jqyx["hao3"].Chuchan + "," + jqqk.Jqyx["zk"].Xiugai + "," + jqqk.Jqyx["zk"].Chuchan + "," + jqqk.Zuanshidayu0 + "," + jqqk.Zuanshidayu1000 + "," + jqqk.Zuanshidayu3000 + "," + jqqk.Qiangzhedayu0 + ",'" + jqqk.Xgsj + "'," + jqqk.Zongxiugai + ")"; sqh.update(inssql); } catch (Exception ex) { WriteLog.WriteLogFile("", "更新运行情况失败"); throw ex; } } }
public void zhunbeizhanghao(int dqinx, string youxi, out string name, out string pwd, out int xuanqu, out int dengji, out string jieduan) { //服务器上有应该登录的账号则使用指定账号登录 WriteLog.WriteLogFile(dqinx + "", "开始找需要练级的账号"); name = ""; pwd = null; xuanqu = -1; dengji = -1; jieduan = ""; SqlHelp sqh = SqlHelp.GetInstance(); string dqsj = DateTime.Now.ToString("yyyy-MM-dd"); lock (obj) { DataTable dt = sqh.getAll("select top 1 name,pwd,isnull(xuanqu,-1),isnull(dengji,-1),isnull(jieduan,'') from zhanghao where yxbz='Y' and yimai='N' and dengluzhong='Y' and pcname='" + WriteLog.getMachineName() + "' and dqindex=" + dqinx + " and youxi='" + youxi + "' order by xuanqu desc") ; if (dt.Rows.Count > 0) { name = (string)dt.Rows[0][0]; pwd = (string)dt.Rows[0][1]; xuanqu = (int)dt.Rows[0][2]; dengji = (int)dt.Rows[0][3]; jieduan = (string)dt.Rows[0][4]; WriteLog.WriteLogFile(dqinx + "", "找到需要练级的账号" + name + " " + pwd + ",xuanqu " + xuanqu + "并置为登录中"); return; } string updatesql = "update zhanghao with (UPDLOCK) set dengluzhong='Y',pcname='" + WriteLog.getMachineName() + "', dqindex=" + dqinx + " where name=(select top 1 name from zhanghao " + " where xgsj < '" + dqsj + "' and yxbz='Y' and dengluzhong='N' " + " and yimai='N' and youxi='" + youxi + "' order by xuanqu desc)"; sqh.update(updatesql); dt = sqh.getAll("select top 1 name,pwd,isnull(xuanqu,-1),isnull(dengji,-1),isnull(jieduan,'') from zhanghao where yxbz='Y' and yimai='N' and dengluzhong='Y' and pcname='" + WriteLog.getMachineName() + "' and dqindex=" + dqinx + " and youxi='" + youxi + "'") ; if (dt.Rows.Count > 0) { name = (string)dt.Rows[0][0]; pwd = (string)dt.Rows[0][1]; xuanqu = (int)dt.Rows[0][2]; dengji = (int)dt.Rows[0][3]; jieduan = (string)dt.Rows[0][4]; WriteLog.WriteLogFile(dqinx + "", "找到需要练级的账号" + name + " " + pwd + ",xuanqu " + xuanqu + "并置为登录中"); } } }
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; * } */ } }
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); }
public string getYanZhengMa(string path, string datileixing) { SetRebate("4600|01FE85EAC115FE87"); StringBuilder sb = new StringBuilder(512); var ans = SendFile("rzdanzhuo|B3DA446EB9AF6B25", datileixing, path, 300, 0, "", sb);//@"c:\mypic_save\2_653355203.bmp" //X3004 var TID = sb.ToString(); StringBuilder Reply = new StringBuilder(512); if (IsRight(TID)) { for (int i = 0; i < 999; i++) { Thread.Sleep(1000); GetAnswer(TID, Reply); //WriteLog.WriteLogFile("", Reply.ToString() + "Reply1"); if (Reply.ToString() != "") { WriteLog.WriteLogFile("", Reply.ToString() + "Reply1"); break; //跳出FOR循环 } }//end for if (IsRight(Reply.ToString())) { WriteLog.WriteLogFile("", Reply.ToString() + "Reply2"); } else { if (Reply.ToString() == "#编号不存在") { } // 应检查网络后 重新发送(原因:我们数据在一小段时间里会转移数据 如果您的网络质量不好 或者一直发送总会遇到编号不存在的情况) if (Reply.ToString() == "#答案不确定") { } // 应换验证码后 重新发送(答案不确定是会返回题分的) if (Reply.ToString() == "#超时") { } // 应重新发送(超时是会返回题分的,这个超时是指的在您规定的时间内 没有返回答案) if (Reply.ToString() == "#网络错误") { } // 应重新发送 WriteLog.WriteLogFile("", Reply.ToString() + "Reply3"); } } else { if (TID.ToString() == "") { } // 应检查网络后 重新发送(原因:我们的函数有10-15秒的超时 如果请求在规定时间内没有完成 函数则会返回空) if (TID.ToString() == "#验证码错") { } // 应调用SendError 后再重新发送(原因:返回的验证码小于设置的最小位数) if (TID.ToString() == "#图片过小") { } // 应确认图片截图没问题后 再重新发送(原因:您的截图出了问题) if (TID.ToString() == "#密码串有误") { } // 应提示用户 if (TID.ToString() == "#GameID不存在") { } // 应提示用户 if (TID.ToString() == "#题分不足") { } // 应提示用户 if (TID.ToString() == "#网络错误") { } // 应重新发送 WriteLog.WriteLogFile("", TID.ToString() + "TID"); //throw new Exception(); } return(Reply.ToString()); }