public void getZhanghaoXinxi(int dqinx, string youxi, string zhanghao, string xinxi, out int ox) { //服务器上有登录账号后置为登陆中 SqlHelp sqh = SqlHelp.GetInstance(); ox = -1; WriteLog.WriteLogFile(dqinx + "", "取到账号" + zhanghao + "相关信息"); lock (obj) { try { DataTable dt = sqh.getAll("select isnull(" + xinxi + ",-1) from zhanghao where name='" + zhanghao + "'and youxi='" + youxi + "'") ; if (dt.Rows.Count > 0) { ox = (int)dt.Rows[0][0]; WriteLog.WriteLogFile(dqinx + "", "找到需要练级的账号" + zhanghao + " " + xinxi + ", " + ox); } } catch (Exception ex) { WriteLog.WriteLogFile(dqinx + "", "更新登录中账号失败"); throw ex; } } }
public string suijizifu() { string uuidN = Guid.NewGuid().ToString("N"); WriteLog.WriteLogFile(this.moniqiname, uuidN); return(uuidN); }
/// <summary> /// 取点取色直接返回坐标 /// </summary> /// <param name="fir"></param> /// <param name="off"></param> /// <param name="sim"></param> /// <param name="x0"></param> /// <param name="y0"></param> /// <param name="x1"></param> /// <param name="y1"></param> /// <returns></returns> public void myqudianqusezuobiao(Int32 fir, string off, int sim, int x0, int y0, int x1, int y1, out int ox, out int oy) { //适用FindMultiColor方法 int res = bindWindow(jubing); if (!(res > 0)) { WriteLog.WriteLogFile("", "绑定不成功 " + res); } string result = "-1|-1"; string firstColor = fir.ToString("X"); string offsetColor = off.Replace("|0x", "|"); double isim = sim * 0.01; result = mydm.FindMultiColorE(x0, y0, x1, y1, firstColor, offsetColor, isim, 1); string[] a1 = result.Split('|'); ox = -1; oy = -1; if (int.Parse(a1[0]) == -1) { return; } if (int.Parse(a1[0]) != -1) { ox = int.Parse(a1[0]); oy = int.Parse(a1[1]); } }
private static void dakaimoniqiByIndexQiHao(int index) { 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) { 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); } } } }
public void lurenSaveNameAndPas(string name, string pwd, int dqindex, string youxi = "jingjie") { SqlHelp sqh = SqlHelp.GetInstance(); DataTable dt = sqh.getAll("select top 1 name from zhanghao where name = '" + name + "' and youxi='" + youxi + "'"); if (dt.Rows.Count > 0) { WriteLog.WriteLogFile(dqindex + "", "当前游戏 " + youxi + " 已存在这个账号" + name); return; } lock (obj) { try { sqh.update("insert into zhanghao (name,pwd,dqindex,yxbz,yimai,dengluzhong,pcname,xgsj,youxi,xuanqu) values('" + name + "','" + pwd + "'," + dqindex + ",'Y','N','N','" + WriteLog.getMachineName() + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + youxi + "',1)"); } catch (Exception ex) { throw ex; } } }
public bool panduanIpKeYong(int dqinx, string youxi, string ip) { //服务器上有登录账号后置为登陆中 SqlHelp sqh = SqlHelp.GetInstance(); lock (obj) { try { DataTable dt = sqh.getAll("select name,isnull(ip,'') from zhanghao where ip='" + ip + "' and youxi='" + youxi + "' and yxbz='Y' and dengluzhong='Y' and xgsj='" + DateTime.Now.ToString("yyyy-MM-dd") + "'") ; if (dt.Rows.Count > 0) { WriteLog.WriteLogFile(dqinx + "", "找到需要练级的账号" + dt.Rows[0][0] + " " + dt.Rows[0][1] + "为相同ip:" + ip); return(true); } } catch (Exception ex) { WriteLog.WriteLogFile(dqinx + "", "更新账号的ip,更新失败"); throw ex; } return(false); } }
public string wenzishibie(int ind, string path) { WriteLog.WriteLogFile(ind + "", "进入到文字识别"); JObject rs = GeneralBasic(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; } } } return(rt); }
public DataTable getAll(string sql) { WriteLog.WriteLogFile("", sql); DataTable dt = new DataTable(); lock (obj) { SqlConnection conn = getConn(); if (conn.State == ConnectionState.Open) { conn.Close(); } try { conn.Open(); SqlDataAdapter sqlDa = new SqlDataAdapter(sql, conn); dt = new DataTable(); sqlDa.Fill(dt); } catch (Exception ex) { WriteLog.WriteLogFile("", ex.Message); throw new Exception(ex.Message); } finally { //close(conn); } } return(dt); }
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); }
/// <summary> /// 得到可卖情况 /// </summary> /// <param name="youxi"></param> public List <Object[]> getPcKeMai(string youxi) { //得到运行情况后存入表 WriteLog.WriteLogFile("", "得到运行情况后显示在前台-可卖"); SqlHelp sqh = SqlHelp.GetInstance(); List <Object[]> rs = new List <Object[]>(); try { string selsql = "select pcname,COUNT(name) from zhanghao where yxbz='Y' and yimai='N' and youxi='" + youxi + "' group by pcname"; DataTable dt = sqh.getAll(selsql); int a = dt.Rows.Count; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Object[] obj = new Object[] { (string)dt.Rows[i][0], (int)dt.Rows[i][1] }; rs.Add(obj); } } } catch (Exception ex) { WriteLog.WriteLogFile("", "得到运行情况失败"); throw ex; } return(rs); }
public void myReSize(int index, out int width, out int height, string youxi = "luneng", string dizhi = @"d:\ChangZhi\dnplayer2\") { WriteLog.WriteLogFile(index + "", "模拟器" + index + "开始改位置"); int dqwidth = 2560; //1920 1024 int dqheight = 1440; //1080 768 int yiquanw = 601; int yiquany = 338; if (youxi.Equals("luneng")) { yiquanw = 727; //原来外框 727 425 yiquany = 425; } width = yiquanw; height = yiquany; int jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi); IntPtr p = new IntPtr(jubing); IntPtr p2 = new IntPtr(HWND_TOP); int x = 0; int y = 0; x = (index % 4) * (dqwidth / 4); y = (index / 4) * (dqheight / 4); WriteLog.WriteLogFile(index + "", index + "x:" + x + ",y:" + y); if (youxi.Equals("luneng")) { SetWindowPos(p, p2, x, y, yiquanw, yiquany, SWP_SHOWWINDOW); } else { SetWindowPos(p, p2, x, y, yiquanw, yiquany, SWP_SHOWWINDOW); } }
public bool PanDuan_QidongLurenzhanghao(int dqinx, myDm dm, int jubing) { int x1 = -1; int y1 = -1; if (jubing <= 0) { WriteLog.WriteLogFile(dqinx + "", "游戏判断启动,句柄绑定错误"); return(false); } Entity.FuHeSanDian tysd = null; int w = -1, h = -1; getWindowSize(dqinx, jubing, out w, out h); //WriteLog.WriteLogFile(dqinx + "", w + " " + h); int a = 0; if (w == 489 && h == 840) { a = 1; tysd = fuzhu.TongYong_SanDian.GetObject().findFuHeSandianByName("雷电首页截图-路人"); } if (w == 1318 && h == 758) { a = 1; tysd = fuzhu.TongYong_SanDian.GetObject().findFuHeSandianByName("雷电首页截图-平板"); } if (a == 1 && dm.mohuByLeiBool_duokai(tysd.Sd)) { WriteLog.WriteLogFile(dqinx + "", "游戏启动不成功,界面有雷电游戏 " + x1 + " " + y1); return(false); } return(true); }
public static void MyRestore(int index, string backname, string a_b) { WriteLog.WriteLogFile(index + "", "准备关闭并备份"); Thread.Sleep(10000); string dizhi = null; string path = null; string seed = null; myqiehuancd(a_b, out dizhi, out path, out seed); if (backname.Length > 0) { myQuit(index, dizhi); Thread.Sleep(2000); zaiciguanbi(); WriteLog.WriteLogFile(index + "", "值得备份的" + backname); Thread.Sleep(20000); MyLdcmd.myBackup(index, @"c:\mypic_save\" + backname, dizhi); Thread.Sleep(30000); } else { myQuit(index, dizhi); Thread.Sleep(2000); zaiciguanbi(); } }
/// <summary> /// 新建模拟器并得到新建模拟器的index /// </summary> public static int addSimulator() { int res = -1; MyLdcmd myldcmd = MyLdcmd.GetObject(); lock (obj) { int[] dq = getDqmoniqiIndex(); foreach (int a in dq) { //WriteLog.WriteLogFile("", a+"号模拟器"); } ld.AddSimulator(); int[] dq2 = getDqmoniqiIndex(); foreach (int a in dq2) { //WriteLog.WriteLogFile("", "新增后,"+a + "号模拟器"); } foreach (int a in dq2) { if (!dq.Contains <int>(a)) { res = a; modifySimulator(res); WriteLog.WriteLogFile("", res + "号模拟器是新增的"); } } } return(res); }
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); }
public string suijizifu(int inx, int weishu) { string uuidN = Guid.NewGuid().ToString("N").Substring(0, weishu); WriteLog.WriteLogFile(inx + "", "生成的随机字符是" + uuidN); return(uuidN); }
public static void BackupAndlunch(int index, string backname, string a_b) { WriteLog.WriteLogFile(index + "", "准备关闭并备份"); Thread.Sleep(10000); string dizhi = null; string path = null; string seed = null; myqiehuancd(a_b, out dizhi, out path, out seed); myQuit(index, dizhi); Thread.Sleep(2000); zaiciguanbi(); if (backname.Length > 0) { WriteLog.WriteLogFile(index + "", "值得备份的" + backname); Thread.Sleep(20000); MyLdcmd.myBackup(index, @"c:\mypic_save\" + backname, dizhi); } Thread.Sleep(30000); try { LogWriteLock.EnterReadLock(); MyLdcmd.myRestore(index, seed, dizhi); } catch { } finally { LogWriteLock.ExitReadLock(); } Thread.Sleep(40000); MyLdcmd.myRename(index, "雷电模拟器-" + index, dizhi); Thread.Sleep(5000); }
/// <summary> /// 得到更新的运行情况 /// </summary> /// <param name="youxi"></param> public List <YunXingQK> getUpdateQk() { //得到运行情况后存入表 WriteLog.WriteLogFile("", "得到运行情况后显示在前台-update"); SqlHelp sqh = SqlHelp.GetInstance(); List <YunXingQK> rs = new List <YunXingQK>(); try { string selsql = "select top 72 a.* from jiankong a order by a.xh desc"; DataTable dt = sqh.getAll(selsql); int a = dt.Rows.Count; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { YunXingQK jqqk = new YunXingQK(); jqqk.Xh = (int)dt.Rows[i][0]; jqqk.Zongxiugai = (int)dt.Rows[i][1]; jqqk.Pcall = (string)dt.Rows[i][2]; jqqk.Zuanshidayu0 = (int)dt.Rows[i][3]; jqqk.Qiangzhedayu0 = (int)dt.Rows[i][4]; jqqk.Xgsj = (DateTime)dt.Rows[i][5]; rs.Add(jqqk); } } } catch (Exception ex) { WriteLog.WriteLogFile("", "得到运行情况失败"); throw ex; } return(rs); }
/// <summary> /// 读取图片文件 /// </summary> /// <param name="path">图片文件路径</param> /// <returns>图片文件</returns> public static Bitmap ReadImageFile(String path) { Bitmap bitmap = null; lock (obj) { try { FileStream fileStream = File.OpenRead(path); Int32 filelength = 0; filelength = (int)fileStream.Length; Byte[] image = new Byte[filelength]; fileStream.Read(image, 0, filelength); System.Drawing.Image result = System.Drawing.Image.FromStream(fileStream); fileStream.Close(); bitmap = new Bitmap(result); } catch (Exception ex) { // 异常输出 WriteLog.WriteLogFile("", ex.Message); } } return(bitmap); }
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); }
public void shutdown(string ip) { ConnectionOptions options = new ConnectionOptions(); options.Username = "******"; options.Password = ""; ManagementScope scope = new ManagementScope("\\\\" + ip + "\\root\\cimv2", options); try { //用给定管理者用户名和口令连接远程的计算机 scope.Connect(); ObjectQuery oq = new ObjectQuery("select * from win32_OperatingSystem"); ManagementObjectSearcher query1 = new ManagementObjectSearcher(scope, oq); ManagementObjectCollection queryCollection1 = query1.Get(); foreach (ManagementObject mo in queryCollection1) { string[] ss = { "" }; mo.InvokeMethod("Reboot", ss); WriteLog.WriteLogFile("", "连接" + ip + "出错"); } } catch (Exception er) { WriteLog.WriteLogFile("", "连接" + ip + "出错,出错信息为:" + er.Message); } }
public void update(string sql) { WriteLog.WriteLogFile("", sql); lock (obj){ SqlConnection conn = getConn(); if (conn.State == ConnectionState.Open) { conn.Close(); } try { conn.Open(); SqlCommand sqlCmd = new SqlCommand(sql, conn); sqlCmd.ExecuteNonQuery(); } catch (Exception ex) { WriteLog.WriteLogFile("", ex.Message); throw new Exception(ex.Message); } finally { //close(conn); } } }
public Dictionary <string, string> getZhanghaoXinxiForDaochu(string youxi, string zhanghao) { //服务器上有登录账号后置为登陆中 SqlHelp sqh = SqlHelp.GetInstance(); Dictionary <string, string> rs = new Dictionary <string, string>(); try { DataTable dt = sqh.getAll("select zhanghao,pwd,youxi,isnull(zuanshi,-1),isnull(qiangzhequan,-1),isnull(xuanqu,-1) from zhanghao where name='" + zhanghao + "'and youxi='" + youxi + "' and yxbz='Y' and yimai='N'") ; if (dt.Rows.Count > 0) { rs.Add("youxi", youxi); rs.Add("zhanghao", zhanghao); rs.Add("pwd", (string)dt.Rows[0][2]); rs.Add("zuanshi", (int)dt.Rows[0][3] + ""); rs.Add("qiangzhequan", (int)dt.Rows[0][4] + ""); rs.Add("xuanqu", (int)dt.Rows[0][5] + ""); WriteLog.WriteLogFile("", "找到需要上架的账号" + zhanghao + " "); } } catch (Exception ex) { WriteLog.WriteLogFile("", "取得账号信息失败"); throw ex; } return(rs); }
/// <summary> /// 启动应用 /// </summary> /// <param name="index">模拟器序号</param> /// <param name="value">包名/Activity类名</param> /// <returns></returns> public static string StartApp(int index, string value) { MyLdcmd md = MyLdcmd.GetObject(); string a = md.ImplementCmd(string.Format("{0}ld -s {1} am start -n {2}", md.SimulatorPath, index, value)); WriteLog.WriteLogFile(index + "", string.Format("{0}ld -s {1} am start -n {2}", md.SimulatorPath, index, value)); return(a); }
public static void myClearAppData(string dizhi, int dqinx, string apkname) { MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi); myldcmd.SimulatorPath = ld.SimulatorPath; string a = ld.ClearAppData(dqinx, apkname); WriteLog.WriteLogFile("", a); }
public static void myLaunch(string dizhi, int dqinx, string apkname) { MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi); myldcmd.SimulatorPath = ld.SimulatorPath; string a = myldcmd.Launch(dqinx); WriteLog.WriteLogFile("", a); }
public bool panDuanChongQi(string pcname) { SqlHelp sqh = SqlHelp.GetInstance(); lock (obj) { try { string pn = ""; switch (pcname) { case "1HAO": pn = "hao1chanchu"; break; case "2HAO": pn = "hao2xiugai"; break; case "3HAO": pn = "hao3xiugai"; break; case "WLZHONGKONG": pn = "zkxiugai"; break; default: break; } if (pn == null || pn.Equals("")) { return(false); } string sqlsel = "select a1.cc-a2.cc from (select xh," + pn + " cc from yunxingqk where xh in( " + "select max(xh) zd from yunxingqk)) a1,(select xh," + pn + " cc from yunxingqk " + " where xh in(select max(xh)-1 cd from yunxingqk)) a2"; DataTable dt = sqh.getAll(sqlsel); if (dt.Rows.Count > 0) { int a = (int)dt.Rows[0][0]; WriteLog.WriteLogFile("", "更新运行情况差异值 " + a); if (a == 0) { return(true); } } return(false); } catch (Exception ex) { throw ex; } } }
/// <summary> /// 修改模拟器默认属性设置 /// </summary> public static void modifySimulator(int index) { MyLdcmd myldcmd = MyLdcmd.GetObject(); lock (obj) { myldcmd.ImplementCmd(string.Format("{0}dnconsole modify --index {1} --resolution 540,960,240 --cpu 1 --memory 1024 --imei auto", myldcmd.SimulatorPath, index)); WriteLog.WriteLogFile(index + "", string.Format("{0}dnconsole modify --index {1} --resolution 540,960,240 --cpu 1 --memory 1024 --imei auto", myldcmd.SimulatorPath, index)); } }
public static void duokaiqiRemoveAll() { zaiciguanbi(); WriteLog.WriteLogFile("", "打开模拟器,删除所有模拟器"); int[] moniqiIndex = MyLdcmd.getDqmoniqiIndex(); if (moniqiIndex.Length <= 1) { WriteLog.WriteLogFile("", "模拟器只有一个,不用删除"); return; } lock (obj) { myDm dm = new myDm(); int jb = dm.FindWindowEx(0, "", "雷电多开器"); if (jb <= 0) { WriteLog.WriteLogFile("", "多开器未找到"); return; } int res = dm.bindWindow(jb); if (res > 0) { dm.mytap_duokai(jb, 24, 631); Thread.Sleep(2000); 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, 127, 300); Thread.Sleep(1000 * 3); } int jb3 = dm.FindWindowEx(0, "MessageBoxWindow", ""); if (jb3 <= 0) { WriteLog.WriteLogFile("", "是否删除所有盘未找到"); return; } myDm dm3 = new myDm(); int res3 = dm3.bindWindow(jb3); if (res3 > 0) { dm3.click(279, 176, 300); Thread.Sleep(1000 * 6); } } } }
private int panduankasiqudian(int dqinx, myDm mf, int jubing, out string yiqudian) { WriteLog.WriteLogFile(dqinx + "", "进入已取点-开始判断"); StringBuilder rt = new StringBuilder(); int res = 0; for (int i = 0; i < 10; i++) { foreach (Entity.FuHeSanDian f in fuzhu.YiQuan_SanDian.List_yqfhsandian) { if (mf.mohuByLeiBool(f.Sd)) { WriteLog.WriteLogFile(dqinx + "", f.Name + "模糊取到"); //mf.mytap(this._jubing, fh.Zhidingx, fh.Zhidingy); mf.mydelay(1000, 2000); rt.Append(f.Name); res++; } if (res > 0) { break; } } foreach (Entity.FuHeSanDian f in fuzhu.YiQuanZhiTuo_SanDian.List_yqfhsandian) { if (mf.mohuByLeiBool(f.Sd)) { WriteLog.WriteLogFile(dqinx + "", f.Name + "Zhituo模糊取到"); //mf.mytap(this._jubing, fh.Zhidingx, fh.Zhidingy); mf.mydelay(1000, 2000); rt.Append(f.Name); res++; } if (res > 0) { break; } } if (res > 0) { break; } mf.mydelay(10, 200); } string rr = ""; if (rt != null && rt.Length > 0) { rr = rt.ToString(); } yiqudian = rr; WriteLog.WriteLogFile(dqinx + "", "进入已取点-结束"); return(res); }