Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 public IEItem(TaskForm parent, MyTask task, int totalWaitFindTime, int totalWaitDocCompleteTime)
 {
     this._startTaskTime = this._now = DateTime.Now;
     this._totalWaitFindTime = totalWaitFindTime;
     this._totalWaitDocCompleteTime = totalWaitDocCompleteTime;
     this._task = task;
     this._threadRun = true;
     this._taskInfoIndex = 0;
     this._startLoop = false;
     this._loop = false;
     this.ResetBrowserComplete();
     this.SetDocCompleted(false);
     parent.ShowTip1("任务ID:" + task._id);
 }
Exemplo n.º 3
0
 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);
         }
     }
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
0
 public void StartTaskThread(MyTask task)
 {
     this.StopTaskThread();
     this._taskThreadRun = true;
     if (this._ieItem == null)
     {
         this._ieItem = new TaskBrowser.IEItem(this, task, this._waitFindTime, this._waitDocCompleteTime);
         this.New(true, this._ieItem);
     }
 }