public object Clone() { MyTask task = new MyTask(); if (this._taskItems != null) { task._taskItems = new ArrayList(); for (int i = 0; i < this._taskItems.Count; i++) { TaskInfo info2 = (TaskInfo) this._taskItems[i]; TaskInfo info = new TaskInfo(info2._param1, info2._param2, info2._param3, info2._param4, info2._param5); task._taskItems.Add(info); } } task._isRun = this._isRun; task._completeTotalCount = this._completeTotalCount; task._failTotalCount = this._failTotalCount; task._completedCount = this._completedCount; task._id = this._id; if (this._HourClicks != null) { task._HourClicks = new ArrayList(this._HourClicks); } if (this._AreaClicks != null) { task._AreaClicks = new ArrayList(this._AreaClicks); } task._totalDayClicks = this._totalDayClicks; return task; }
public void Insert(TaskInfo task, int index = -1) { if (index == -1) { this._taskItems.Add(task); } else { this._taskItems.Insert(index, task); } }
public int GetTaskInfo(ref TaskInfo taskItem, ref int taskIndex, ref bool startLoop, ref bool loop, ref int loopTime) { if (startLoop && loop) { taskIndex--; loopTime++; } else { startLoop = false; loop = false; loopTime = 0; } if (taskIndex >= this._taskItems.Count) { return -1; } taskItem = (TaskInfo) this._taskItems[taskIndex++]; switch (WindowUtil.StringToInt(taskItem._param1)) { case 5: case 7: case 13: case 15: case 0x11: case 0x17: case 0x19: case 0x13: case 0x15: case 0x1b: startLoop = loop = true; break; default: startLoop = loop = false; break; } return 0; }
private void TestTask() { this._task = new MyTask(); TaskInfo task = new TaskInfo("6", "255", "", "", ""); this._task.Insert(task, -1); task = new TaskInfo("4", "www.taobao.com", "", "", ""); this._task.Insert(task, -1); task = new TaskInfo("1", "q", "小米手机", "", ""); this._task.Insert(task, -1); task = new TaskInfo("2", "btn-search", "3", "", ""); this._task.Insert(task, -1); task = new TaskInfo("2", "搜 索", "2", "", ""); this._task.Insert(task, -1); task = new TaskInfo("7", "小米手机M红米2 1.5G四核4.7HD屏800W像素双卡双待 红米手机现货 手机", "下一页", "3", ""); this._task.Insert(task, -1); task = new TaskInfo("3", "小米手机M红米2 1.5G四核4.7HD屏800W像素双卡双待 红米手机现货 手机", "", "2", ""); this._task.Insert(task, -1); task = new TaskInfo("5", "10", "10", "http://detail.tmall.com/item.htm", ""); this._task.Insert(task, -1); task = new TaskInfo("0", "10", "", "", ""); this._task.Insert(task, -1); this.StartTaskThread(this._task); }
private void ProcessRunTask(string xmlDoc) { if (this._task == null) { try { XmlDocument document = new XmlDocument(); XmlNode node = null; document.LoadXml(xmlDoc); foreach (XmlNode node2 in document.SelectSingleNode("root").ChildNodes) { if (node2.Name.Equals("tasks")) { foreach (XmlNode node3 in node2.ChildNodes) { if (node3.Name.Equals("task")) { MyTask task = new MyTask(); foreach (XmlNode node4 in node3.ChildNodes) { if (node4.Name.Equals("taskinfo")) { string s = string.Empty; string innerText = string.Empty; string str3 = string.Empty; string str4 = string.Empty; string str5 = string.Empty; foreach (XmlNode node5 in node4) { if (node5.Name.Equals("param1")) { s = node5.InnerText; } else { if (node5.Name.Equals("param2")) { innerText = node5.InnerText; continue; } if (node5.Name.Equals("param3")) { str3 = node5.InnerText; continue; } if (node5.Name.Equals("param4")) { str4 = node5.InnerText; continue; } if (node5.Name.Equals("param5")) { str5 = node5.InnerText; } } } if ((WindowUtil.StringToInt(s) > -1) && (WindowUtil.StringToInt(s) < 0x1d)) { TaskInfo info = new TaskInfo(s, innerText, str3, str4, str5); task.Insert(info, -1); } continue; } if (node4.Name.Equals("params")) { foreach (XmlNode node6 in node4) { XmlElement element = (XmlElement) node6; if (element.Name.Equals("taskid")) { task._id = WindowUtil.StringToInt(element.InnerText); } if (element.Name.Equals("ClickIntervalTime")) { task._clickIntervalTime = WindowUtil.StringToInt(element.InnerText); } else { if (element.Name.Equals("ClickCountPerIP")) { task._clickCountPerIP = WindowUtil.StringToInt(element.InnerText); continue; } if (element.Name.Equals("ClickRate")) { task._clickRate = WindowUtil.StringToInt(element.InnerText); continue; } if (element.Name.Equals("AllowScrollWhileWaiting")) { task._allowScrollWhileWaiting = Convert.ToBoolean(element.InnerText); continue; } if (element.Name.Equals("vipmode")) { task.VipMode = Convert.ToBoolean(element.InnerText); } } } continue; } } if (task._taskItems.Count > 0) { this._task = task; } task = null; } } continue; } if (node2.Name.Equals("setting")) { foreach (XmlNode node7 in node2.ChildNodes) { if (node7.Name.Equals("waitFindTime")) { this._waitFindTime = WindowUtil.StringToInt(node7.InnerText); } else if (node7.Name.Equals("waitDocCompleteTime")) { this._waitDocCompleteTime = WindowUtil.StringToInt(node7.InnerText); } if (node7.Name.Equals("curAddress")) { this.ShowTip1(node7.InnerText); } } continue; } } node = null; document = null; if (this._task != null) { this.StartTaskThread(this._task); } } catch (Exception exception) { Logger.Error(exception); } } }
private void ProcessRunTask(string xmlDoc) { if (this._task == null) { try { XmlDocument document = new XmlDocument(); XmlNode node = null; document.LoadXml(xmlDoc); foreach (XmlNode node2 in document.SelectSingleNode("root").ChildNodes) { if (node2.Name.Equals("tasks")) { foreach (XmlNode node3 in node2.ChildNodes) { if (node3.Name.Equals("task")) { MyTask task = new MyTask(); foreach (XmlNode node4 in node3.ChildNodes) { if (node4.Name.Equals("taskinfo")) { string s = string.Empty; string innerText = string.Empty; string str3 = string.Empty; string str4 = string.Empty; string str5 = string.Empty; foreach (XmlNode node5 in node4) { if (node5.Name.Equals("param1")) { s = node5.InnerText; } else { if (node5.Name.Equals("param2")) { innerText = node5.InnerText; continue; } if (node5.Name.Equals("param3")) { str3 = node5.InnerText; continue; } if (node5.Name.Equals("param4")) { str4 = node5.InnerText; continue; } if (node5.Name.Equals("param5")) { str5 = node5.InnerText; } } } if ((WindowUtil.StringToInt(s) > -1) && (WindowUtil.StringToInt(s) < 0x1d)) { TaskInfo info = new TaskInfo(s, innerText, str3, str4, str5); task.Insert(info, -1); } continue; } if (node4.Name.Equals("params")) { foreach (XmlNode node6 in node4) { XmlElement element = (XmlElement)node6; if (element.Name.Equals("taskid")) { task._id = WindowUtil.StringToInt(element.InnerText); } if (element.Name.Equals("ClickIntervalTime")) { task._clickIntervalTime = WindowUtil.StringToInt(element.InnerText); } else { if (element.Name.Equals("ClickCountPerIP")) { task._clickCountPerIP = WindowUtil.StringToInt(element.InnerText); continue; } if (element.Name.Equals("ClickRate")) { task._clickRate = WindowUtil.StringToInt(element.InnerText); continue; } if (element.Name.Equals("AllowScrollWhileWaiting")) { task._allowScrollWhileWaiting = Convert.ToBoolean(element.InnerText); continue; } if (element.Name.Equals("vipmode")) { task.VipMode = Convert.ToBoolean(element.InnerText); } } } continue; } } if (task._taskItems.Count > 0) { this._task = task; } task = null; } } continue; } if (node2.Name.Equals("setting")) { foreach (XmlNode node7 in node2.ChildNodes) { if (node7.Name.Equals("waitFindTime")) { this._waitFindTime = WindowUtil.StringToInt(node7.InnerText); } else if (node7.Name.Equals("waitDocCompleteTime")) { this._waitDocCompleteTime = WindowUtil.StringToInt(node7.InnerText); } if (node7.Name.Equals("curAddress")) { this.ShowTip1(node7.InnerText); } } continue; } } node = null; document = null; if (this._task != null) { this.StartTaskThread(this._task); } } catch (Exception exception) { Logger.Error(exception); } } }