public static void StopAndUpload() { IntPtr hwnd = HwndUtil.FindWindow("WTWindow", null); if (hwnd != IntPtr.Zero) { hwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "SysTabControl32", ""); hwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", ""); hwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "结束投票"); HwndUtil.clickHwnd(hwnd); int s = 0; IntPtr hwndEx = IntPtr.Zero; do { Thread.Sleep(500); hwnd = HwndUtil.FindWindow("WTWindow", null); hwndEx = HwndUtil.FindWindow("#32770", "信息:"); if (s % 10 == 0 && hwnd != IntPtr.Zero) { IntPtr hwnd0 = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "SysTabControl32", ""); hwnd0 = HwndUtil.FindWindowEx(hwnd0, IntPtr.Zero, "Button", ""); hwnd0 = HwndUtil.FindWindowEx(hwnd0, IntPtr.Zero, "Button", "结束投票"); HwndUtil.clickHwnd(hwnd0); } if (hwndEx != IntPtr.Zero) { HwndUtil.closeHwnd(hwndEx); s = 90; } s++; } while (hwnd != IntPtr.Zero && s < 90); } }
//九天到票检测 public static bool OverCheck(ref int s) { IntPtr hwnd = HwndUtil.FindWindow("WTWindow", null); if (hwnd == IntPtr.Zero) { s++; } else { s = 0; } if (s > 5) { if (MonitorCore.GetTaskCore().IsAutoVote) { AutoVote.AddVoteProjectNameDropedTemp(); } ConfigCore.WriteOver(); return(true); } return(false); }
private static void HanderNat() { IntPtr hwnd = HwndUtil.FindWindow("#32770", "Windows - 系统错误"); if (hwnd != IntPtr.Zero) { HwndUtil.closeHwnd(hwnd); } }
private static void HanderModem() { IntPtr hwnd = HwndUtil.FindWindow("#32770", "Windows - 没有软盘"); if (hwnd != IntPtr.Zero) { IntPtr hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "继续(&C)"); HwndThread.createHwndThread(hwndEx); } }
//HY到票检测 public static bool OverCheck() { IntPtr hwnd = HwndUtil.FindWindow("#32770", "信息:"); if (hwnd != IntPtr.Zero) { HwndUtil.closeHwnd(hwnd); ConfigCore.WriteOver(); return(true); } return(false); }
//JZ到票检测 public static bool OverCheck() { IntPtr hwnd = HwndUtil.FindWindow("TMessageForm", null); if (hwnd != IntPtr.Zero) { HwndUtil.closeHwnd(hwnd); ConfigCore.WriteOver(); return(true); } return(false); }
//MM启动 public static void Start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_MM; IntPtr hwnd = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("WTWindow", null); Thread.Sleep(500); } while (hwnd == IntPtr.Zero); //设置拨号延迟 IntPtr ButtonHwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "设置"); IntPtr hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, IntPtr.Zero, "Edit", "2"); if (hwndEx == IntPtr.Zero) { hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, IntPtr.Zero, "Edit", "3"); } if (hwndEx == IntPtr.Zero) { hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, IntPtr.Zero, "Edit", "4"); } HwndUtil.setText(hwndEx, (ConfigCore.Delay / 1000).ToString()); //设置工号 if (ConfigCore.InputId.Equals("1")) { ButtonHwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "会员"); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, IntPtr.Zero, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); HwndUtil.setText(hwndEx, ConfigCore.Id); } //开始投票 hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, null, "自动投票"); HwndThread.createHwndThread(hwndEx); taskCore.FinishStart(); }
public static void StopAndUpload() { IntPtr hwnd = HwndUtil.FindWindow("WTWindow", null); if (hwnd != IntPtr.Zero) { IntPtr hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "停止"); while (!Net.IsOnline()) { Thread.Sleep(500); } HwndThread.createHwndThread(hwndEx); Thread.Sleep(5000); } }
private static void ErrReconnect() { IntPtr adslErr = HwndUtil.FindWindow("#32770", "连接到 " + ConfigCore.AdslName + " 时出错"); if (adslErr != IntPtr.Zero) { IntPtr hwndEx = HwndUtil.FindWindowEx(adslErr, IntPtr.Zero, "Button", null); string title = HwndUtil.GetControlText(hwndEx); if (title.IndexOf("重拨") != -1) { LogCore.Write($"{ConfigCore.AdslName}拨号出错,重播"); HwndUtil.clickHwnd(hwndEx); } } }
public static bool ExcpCheck() { IntPtr hwnd = HwndUtil.FindWindow("#32770", "信息:"); if (hwnd != IntPtr.Zero) { if (MonitorCore.GetTaskCore().IsAutoVote) { AutoVote.AddVoteProjectNameDroped(false); } HwndUtil.closeHwnd(hwnd); return(true); } return(false); }
public static void StopAndUpload() { IntPtr hwnd = HwndUtil.FindWindow("ThunderRT6FormDC", null); if (hwnd != IntPtr.Zero) { IntPtr hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, null, "停止投票"); while (!Net.IsOnline()) { Thread.Sleep(500); } HwndThread.createHwndThread(hwndEx); Thread.Sleep(5000); } }
public static void StopAndUpload() { IntPtr hwnd = HwndUtil.FindWindow("TMainForm", null); if (hwnd != IntPtr.Zero) { IntPtr hwndTGroupBox = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "当前状态"); IntPtr hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, IntPtr.Zero, "TButton", "停 止"); while (!Net.IsOnline()) { Thread.Sleep(500); } HwndThread.createHwndThread(hwndEx); Thread.Sleep(5000); } }
//MM到票检测 public static bool OverCheck() { IntPtr hwnd = HwndUtil.FindWindow(null, "投票软件提示"); if (hwnd != IntPtr.Zero) { if (MonitorCore.GetTaskCore().IsAutoVote) { AutoVote.AddVoteProjectNameDropedTemp(); } HwndUtil.closeHwnd(hwnd); ConfigCore.WriteOver(); return(true); } return(false); }
//获取圆球成功数 public static int GetSucc() { IntPtr hwnd = HwndUtil.FindWindow("TForm1", null); IntPtr hwndTGroupBox = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "状态"); IntPtr hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, IntPtr.Zero, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); try { return(int.Parse(HwndUtil.GetControlText(hwndEx))); } catch (Exception) { LogCore.Write("获取圆球成功失败!"); } return(0); }
//九天禁止虚拟机检测 public static bool VmBanCheck() { IntPtr hwnd = HwndUtil.FindWindow("#32770", "信息:"); IntPtr hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Static", "本任务禁止在虚拟机内运行"); if (hwndEx != IntPtr.Zero) { TaskCore taskCore = MonitorCore.GetTaskCore(); if (taskCore.IsAutoVote) { taskCore.AddVoteProjectNameDroped(false); } HwndUtil.closeHwnd(hwnd); return(true); } return(false); }
public static bool ErrCheck() { IntPtr hwnd = HwndUtil.FindWindow("#32770", null); if (hwnd != IntPtr.Zero) { string txt = HwndUtil.GetControlText(hwnd); if (txt.IndexOf("错误") != -1) { if (MonitorCore.GetTaskCore().IsAutoVote) { AutoVote.AddVoteProjectNameDroped(false); } HwndUtil.closeHwnd(hwnd); return(true); } } return(false); }
//获取MM成功数 public static int GetSucc() { IntPtr hwnd = HwndUtil.FindWindow("WTWindow", null); IntPtr ButtonHwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "统计"); IntPtr hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, IntPtr.Zero, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); hwndEx = HwndUtil.FindWindowEx(ButtonHwnd, hwndEx, "Edit", null); try { return(int.Parse(HwndUtil.GetControlText(hwndEx))); } catch (Exception) { LogCore.Write("获取mm成功失败!"); } return(0); }
public static void CloseException() { IntPtr adslExcp = HwndUtil.FindWindow("#32770", "网络连接"); if (adslExcp != IntPtr.Zero) { IntPtr hwndEx = HwndUtil.FindWindowEx(adslExcp, IntPtr.Zero, "Button", null); if (hwndEx != IntPtr.Zero) { string title = HwndUtil.GetControlText(hwndEx); if (title.IndexOf("重拨") != -1 || title == "确定") { HwndUtil.clickHwnd(hwndEx); } } } ErrReconnect(); }
//获取九天成功数 public static int GetSucc() { IntPtr hwnd = HwndUtil.FindWindow("WTWindow", null); IntPtr hwndSysTabControl32 = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "SysTabControl32", ""); IntPtr hwndStat = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "投票统计"); IntPtr hwndEx = HwndUtil.FindWindowEx(hwndStat, IntPtr.Zero, jiutianCode, "超时票数"); hwndEx = HwndUtil.FindWindowEx(hwndStat, hwndEx, jiutianCode, null); try { hwndEx = HwndUtil.FindWindowEx(hwndStat, hwndEx, jiutianCode, null); hwndEx = HwndUtil.FindWindowEx(hwndStat, hwndEx, jiutianCode, null); return(int.Parse(HwndUtil.GetControlText(hwndEx))); } catch (Exception) { LogCore.Write("获取九天成功失败!"); } return(0); }
//九天验证码输入检测 public static bool IsIdentifyCode() { if (MonitorCore.GetTaskCore().IsAutoVote&& ConfigCore.IsAdsl) { return(false); } IntPtr hwnd = HwndUtil.FindWindow("WTWindow", null); IntPtr hwndSysTabControl32 = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "SysTabControl32", ""); IntPtr testHwnd = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "输入验证码后回车,看不清直接回车切换"); if (testHwnd != IntPtr.Zero) { if (MonitorCore.GetTaskCore().IsAutoVote) { AutoVote.AddVoteProjectNameDroped(false); } ProgressCore.KillProcess(false); return(true); } return(false); }
//JZ启动 public static void start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_JZ; IntPtr hwnd = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("TMainForm", null); Thread.Sleep(500); } while (hwnd == IntPtr.Zero); //设置拨号延迟 IntPtr hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwnd, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwnd, hwndEx, "TEdit", null); HwndUtil.setText(hwndEx, (ConfigCore.Delay / 1000).ToString()); //设置工号 if (ConfigCore.InputId.Equals("1")) { IntPtr hwndTGroupBox0 = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "会员选项"); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox0, IntPtr.Zero, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox0, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox0, hwndEx, "TEdit", null); HwndUtil.setText(hwndEx, ConfigCore.Id); } //开始投票 IntPtr hwndTGroupBox = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "当前状态"); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, IntPtr.Zero, "TButton", "开 始"); HwndThread.createHwndThread(hwndEx); taskCore.FinishStart(); }
public static void StopAndUpload() { IntPtr hwnd = HwndUtil.FindWindow("WTWindow", null); if (hwnd != IntPtr.Zero) { IntPtr hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, null, "停止投票"); while (!Net.IsOnline()) { Thread.Sleep(500); } HwndThread.createHwndThread(hwndEx); int s = 0; IntPtr hwndTip; do { s++; hwndTip = HwndUtil.FindWindow(null, "投票软件提示"); Thread.Sleep(500); } while (hwndTip == IntPtr.Zero && s < 60); } }
//JT启动 public static void start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_JT; IntPtr hwnd = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("ThunderRT6FormDC", null); Thread.Sleep(500); } while (hwnd == IntPtr.Zero); //设置拨号延迟 IntPtr ThunderRT6Frame = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "ThunderRT6Frame", "设置"); IntPtr hwndEx = HwndUtil.FindWindowEx(ThunderRT6Frame, IntPtr.Zero, "ThunderRT6TextBox", null); hwndEx = HwndUtil.FindWindowEx(ThunderRT6Frame, hwndEx, "ThunderRT6TextBox", null); HwndUtil.setText(hwndEx, (ConfigCore.Delay / 1000).ToString()); //设置工号 if (ConfigCore.InputId.Equals("1")) { ThunderRT6Frame = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "ThunderRT6Frame", "会员"); hwndEx = HwndUtil.FindWindowEx(ThunderRT6Frame, IntPtr.Zero, "ThunderRT6TextBox", null); HwndUtil.setText(hwndEx, ConfigCore.Id); } //开始投票 hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, null, "自动投票"); HwndThread.createHwndThread(hwndEx); taskCore.FinishStart(); }
//圆球启动 public static void Start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_YUANQIU; IntPtr hwnd = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("TForm1", null); Thread.Sleep(1000); } while (hwnd == IntPtr.Zero); Thread.Sleep(1000); //设置拨号延迟 IntPtr hwndTGroupBox = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "设置"); IntPtr hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, IntPtr.Zero, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); HwndUtil.setText(hwndEx, (ConfigCore.Delay / 1000).ToString()); //设置工号 //if (ConfigCore.InputId.Equals("1")) //{ // hwndTGroupBox = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TGroupBox", "会员"); // hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, IntPtr.Zero, "TEdit", null); // HwndUtil.setText(hwndEx, ConfigCore.Id); // hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); // HwndUtil.setText(hwndEx, ConfigCore.Id); // hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); // HwndUtil.setText(hwndEx, ConfigCore.Id); // hwndEx = HwndUtil.FindWindowEx(hwndTGroupBox, hwndEx, "TEdit", null); // HwndUtil.setText(hwndEx, ConfigCore.Id); //} //开始投票 int count = 0; do { hwndEx = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "TButton", "开始"); Thread.Sleep(1000); if (count > 0) { LogCore.Write($"等待圆球启动{count}秒"); } count++; } while (hwndEx == IntPtr.Zero && count < 10); HwndThread.createHwndThread(hwndEx); taskCore.FinishStart(); }
//九天启动 public static void Start() { TaskCore taskCore = MonitorCore.GetTaskCore(); taskCore.ProjectName = TaskCore.TASK_VOTE_JIUTIAN; IntPtr hwnd = IntPtr.Zero; IntPtr hwndSysTabControl32 = IntPtr.Zero; IntPtr workCondition = IntPtr.Zero; IntPtr preparedCheck = IntPtr.Zero; IntPtr startButton = IntPtr.Zero; do { if (!taskCore.NameCheck()) { return; } hwnd = HwndUtil.FindWindow("WTWindow", null); hwndSysTabControl32 = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "SysTabControl32", ""); workCondition = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "工作情况"); jiutianCode = "Afx:400000:b:10011:1900015:0"; preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, jiutianCode, "加载成功 可开始投票"); if (preparedCheck == IntPtr.Zero) { //不换 preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, "_EL_Label", "加载成功 可开始投票"); jiutianCode = "_EL_Label"; } if (preparedCheck == IntPtr.Zero) { //WIN7 jiutianCode = "Afx:400000:b:10003:1900015:0"; preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, jiutianCode, "加载成功 可开始投票"); } if (preparedCheck == IntPtr.Zero) { //WIN10 jiutianCode = "Afx:400000:b:10003:900015:0"; preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, jiutianCode, "加载成功 可开始投票"); } startButton = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", ""); startButton = HwndUtil.FindWindowEx(startButton, IntPtr.Zero, "Button", "开始投票"); Thread.Sleep(500); } while (preparedCheck == IntPtr.Zero || startButton == IntPtr.Zero); //设置拨号延迟 IntPtr hwndEx = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "拨号设置"); hwndEx = HwndUtil.FindWindowEx(hwndEx, IntPtr.Zero, "SysTabControl32", ""); hwndEx = HwndUtil.FindWindowEx(hwndEx, IntPtr.Zero, "Edit", null); HwndUtil.setText(hwndEx, ConfigCore.Delay.ToString()); //设置工号 if (ConfigCore.InputId.Equals("1")) { hwndEx = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "请输入工号"); hwndEx = HwndUtil.FindWindowEx(hwndEx, IntPtr.Zero, "Edit", null); HwndUtil.setText(hwndEx, ConfigCore.Id); } HwndUtil.clickHwnd(startButton); Thread.Sleep(500); taskCore.FinishStart(); }
//切换任务 private void ChangeTask() { if (TaskChange.Equals("1")) { overTimeCount = 0; ConfigCore.InitWorker(""); CustomPath = ConfigCore.GetCustomPath(); if (CustomPath != "") { LogCore.Write($"切换任务:{CustomPath}"); } if (IsVoteTask() && IsAutoVote) { string projectName = ConfigCore.GetAutoVote("ProjectName"); string drop = ""; try { drop = IniReadWriter.ReadIniKeys("Command", "drop", "./handler.ini"); } catch (Exception) { } if (drop != projectName) { IniReadWriter.WriteIniKeys("Command", "drop", "", "./handler.ini"); } } } if (TaskName.Equals(TASK_SYS_WAIT_ORDER)) //待命 { NetCore.DisConnect(); TaskName = ConfigCore.GetTaskName(); if (TaskName.Equals(TASK_SYS_WAIT_ORDER)) { WaitOrder(); } } else if (TaskName.Equals(TASK_SYS_NET_TEST)) //网络TEST { NetCore.NetCheck(); if (Net.IsOnline()) { NetCore.DisConnect(); WaitOrder(); } } else if (TaskName.Equals(TASK_SYS_SHUTDOWN)) //关机 { WaitOrder(); Process.Start("shutdown.exe", "-s -t 0"); Form1.MainClose(); } else if (TaskName.Equals(TASK_SYS_RESTART)) //重启 { string computerRename = ConfigCore.GetComputerRename(); if (!StringUtil.isEmpty(computerRename)) { Computer.apiSetComputerNameEx(5, computerRename + "-" + ConfigCore.Sort); } WaitOrder(); Process.Start("shutdown.exe", "-r -t 0"); Form1.MainClose(); } else if (TaskName.Equals(TASK_SYS_UPDATE)) //升级 { WaitOrder(); Upgrade.Update(); Form1.MainClose(); } else if (TaskName.Equals(TASK_SYS_CLEAN)) //清理 { WaitOrder(); FileUtil.DeleteFolder(PathCore.WorkingPath + "\\投票项目"); } else if (IsVoteTask()) //投票 { NetCore.NetCheck(); if (CustomPath.Equals("")) { WaitOrder(); TaskChangeProcess(); return; } if (TaskChange.Equals("1")) { if (CustomPath.LastIndexOf("\\") + 1 <= CustomPath.Length && CustomPath.Substring(CustomPath.LastIndexOf("\\") + 1) == "vote.exe") { ProgressCore.StartProcess(CustomPath.Substring(0, CustomPath.Length - 9) + @"\启动九天.bat"); TaskName = TASK_VOTE_JIUTIAN; } else { IniReadWriter.WriteIniKeys("setsoft", "ghid", ConfigCore.Id, "c:\\gonghao.ini"); ProgressCore.StartProcess(CustomPath); TaskName = TASK_VOTE_PROJECT; IntPtr hwnd0, hwnd1, hwnd2, hwnd3, hwnd4; do { hwnd0 = HwndUtil.FindWindow("WTWindow", null); hwnd1 = HwndUtil.FindWindow("TForm1", null); hwnd2 = HwndUtil.FindWindow("ThunderRT6FormDC", null); hwnd3 = HwndUtil.FindWindow("obj_Form", null); hwnd4 = HwndUtil.FindWindow("TMainForm", null); if (hwnd0 != IntPtr.Zero) { string title = HwndUtil.GetControlText(hwnd0); if (title.Length >= 6 && title.Substring(0, 6) == "自动投票工具") { TaskName = TASK_VOTE_MM; } else if (title.Length >= 8 && title.Substring(0, 8) == "VOTE2016") { TaskName = TASK_VOTE_ML; } else if (title.IndexOf("自动投票软件") != -1) { TaskName = TASK_VOTE_HY; } } else if (hwnd1 != IntPtr.Zero) { TaskName = TASK_VOTE_YUANQIU; } else if (hwnd2 != IntPtr.Zero) { TaskName = TASK_VOTE_JT; } else if (hwnd3 != IntPtr.Zero) { TaskName = TASK_VOTE_DM; } else if (hwnd4 != IntPtr.Zero) { TaskName = TASK_VOTE_JZ; } Thread.Sleep(500); } while (TaskName.Trim().Equals(TASK_VOTE_PROJECT)); } bool safeWrite = false; Thread.Sleep(ConfigCore.Sort % 10 * 50); do { try { ConfigCore.WriteTaskName(TaskName); Thread.Sleep(200); string taskNameCheck = ConfigCore.GetTaskName(); if (StringUtil.isEmpty(taskNameCheck) || !taskNameCheck.Equals(TaskName)) { LogCore.Write("TaskName Write Error!"); ConfigCore.WriteTaskName(TaskName); throw new Exception(); } safeWrite = true; } catch (Exception) { Thread.Sleep(ConfigCore.Sort % 10 * 50); } } while (!safeWrite); } if (TaskName.Equals(TASK_VOTE_JIUTIAN)) { if (!TaskChange.Equals("1")) { ProgressCore.StartProcess(CustomPath.Substring(0, CustomPath.Length - 9) + @"\启动九天.bat"); Thread.Sleep(500); } JiuTian.Start(); } else { if (!TaskChange.Equals("1")) { ProgressCore.StartProcess(CustomPath); Thread.Sleep(500); } if (TaskName.Equals(TASK_VOTE_MM)) { MM.Start(); } else if (TaskName.Equals(TASK_VOTE_ML)) { //ML开始程序 } else if (TaskName.Equals(TASK_VOTE_YUANQIU)) { YuanQiu.Start(); } else if (TaskName.Equals(TASK_VOTE_JT)) { JT.start(); } else if (TaskName.Equals(TASK_VOTE_DM)) { //DM开始程序 } else if (TaskName.Equals(TASK_VOTE_JZ)) { JZ.start(); } else if (TaskName.Equals(TASK_VOTE_HY)) { HY.Start(); } } TaskPath = CustomPath; } else { TaskName = TASK_SYS_WAIT_ORDER; } }
//处理句柄操作线程 private static void clickHwndByThread() { HwndUtil.clickHwnd(inHwnd); }