internal void RefreshStatistics(object sender, EventArgs e) { AppEventArgs arg = e as AppEventArgs; switch (arg.message_task.taskAcion) { case eTaskAcion.Add: { AddTask(arg.message_task); arg.message_task.taskAcion = eTaskAcion.Change; } break; case eTaskAcion.Change: { ChangeTask(arg.message_task); } break; case eTaskAcion.Delete: { DeleteTask(arg.message_task); } break; default: break; } }
internal void ChangeTask(object sender, EventArgs e) { AppEventArgs arg = e as AppEventArgs; currentTask = arg.message_task; SetTask(currentTask); }
internal void StopSearch(object sender, EventArgs e) { AppEventArgs arg = e as AppEventArgs; //ShowTaskStatus(string.Format("空闲")); StopTaskEvent(sender, e); this.panel.Hide(); }
internal void StartSearch(object sender, EventArgs e) { AppEventArgs arg = e as AppEventArgs; this.panel.Show(); SetForegroundWindow(); SetWindowPos(); ShowTaskStatus(string.Format("开始执行任务{0}", arg.message_task.nID)); StartSearchEvent(this, e); }
internal void RefreshStatistics(object sender, EventArgs e) { //RefreshStatisticsEvent(this, new AppEventArgs() { message = tmp }); AppEventArgs arg = e as AppEventArgs; switch (arg.message_task.taskAcion) { case eTaskAcion.Add: { RefreshStatisticsEvent(this, e); } break; case eTaskAcion.Change: { RefreshStatisticsEvent(this, e); tabControlTop.SelectedIndex = 0; } break; case eTaskAcion.CancelChange: { tabControlTop.SelectedIndex = 0; } break; case eTaskAcion.Delete: { RefreshStatisticsEvent(this, e); tabControlTop.SelectedIndex = 0; } break; case eTaskAcion.Reset: { RefreshStatisticsEvent(this, e); tabControlTop.SelectedIndex = 0; } break; default: break; } }
internal void EndTask(object sender, EventArgs e) { AppEventArgs arg = e as AppEventArgs; for (int i = 0; i < Appinfo.listTask.Count; i++) { if (arg.message_task.nID == Appinfo.listTask[i].nID) { switch (arg.message_task.webState) { case EWebbrowserState.Start: { } break; case EWebbrowserState.Search: { } break; case EWebbrowserState.SearchSite: { Appinfo.listTask[i].nCountExcuteToday += 1; AddExcuteCount(Appinfo.listTask[i]); if (arg.message_bool) { Appinfo.listTask[i].nCountVaildToday += 1; } else { Appinfo.listTask[i].nCountInvaildToday += 1; ShowTaskEvent(this, new AppEventArgs() { message_string = string.Format("未在搜索引擎找到符合的标题或链接,结束该任务,任务{0}", Appinfo.listTask[i].nID) }); } Appinfo.listTask[i].nCountTotal += 1; Appinfo.UpdateIP(NetworkUtils.GetIpAddress()); bExecuteTask = false; } break; case EWebbrowserState.AccessSite: { Appinfo.listTask[i].nCountExcuteToday += 1; Appinfo.listTask[i].nCountVaildToday += 1; AddExcuteCount(Appinfo.listTask[i]); Appinfo.listTask[i].nCountTotal += 1; Appinfo.UpdateIP(NetworkUtils.GetIpAddress()); bExecuteTask = false; } break; case EWebbrowserState.AccessPage: { Appinfo.listTask[i].nCountExcuteToday += 1; Appinfo.listTask[i].nCountVaildToday += 1; Appinfo.listTask[i].nCountTotal += 1; if (arg.message_task.pageAccessType == ePageAccessType.None) { } else { if (arg.message_bool) { Appinfo.listTask[i].nCountPageVaildToday += 1; ShowTaskEvent(this, new AppEventArgs() { message_string = string.Format("访问内页成功,结束该任务,任务{0}", Appinfo.listTask[i].nID) }); Appinfo.listTask[i].nCountPageTotal += 1; } else { Appinfo.listTask[i].nCountPageInvaildToday += 1; Appinfo.listTask[i].nCountPageTotal += 1; ShowTaskEvent(this, new AppEventArgs() { message_string = string.Format("未找到符合的内页,结束该任务,任务{0}", Appinfo.listTask[i].nID) }); } } bExecuteTask = false; } break; default: break; } Appinfo.CountTask(Appinfo.listTask[i]); //执行完成一个任务关闭程序 System.Environment.Exit(0); break; } } }
internal void ShowTaskStatus(object sender, EventArgs e) { AppEventArgs arg = e as AppEventArgs; ShowTaskStatus(arg.message_string); }
internal void StartSearch(object sender, EventArgs e) { //webBrowser.ShowDevTools(); AppEventArgs arg = e as AppEventArgs; InitWebBrowser(); currentTask = arg.message_task; //清除缓存 var cookieManager = CefSharp.Cef.GetGlobalCookieManager(); cookieManager.DeleteCookies(); ShowTaskEvent(this, new AppEventArgs() { message_string = string.Format("开始清除缓存,任务{0}", currentTask.nID) }); currentTask.webState = EWebbrowserState.Start; strPageurl = ""; nPageIndex = 0; if (currentTask.engine == eEngines.Sm) { if (currentTask.webBrowser == eWebBrowser.IE_mobile || currentTask.webBrowser == eWebBrowser.Chrome_mobile || currentTask.webBrowser == eWebBrowser.Qihu_mobile || currentTask.webBrowser == eWebBrowser.Sogou_mobile || currentTask.webBrowser == eWebBrowser.QQ_mobile || currentTask.webBrowser == eWebBrowser.maxthon_mobile || currentTask.webBrowser == eWebBrowser.theworld_mobile ) { currentTask.webBrowser += 1; } } switch (currentTask.webBrowser) { case eWebBrowser.IE: { Appinfo.strUserAgent = "Mozilla / 4.0(compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident / 7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)"; } break; case eWebBrowser.IE_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; SM-G9350 Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.17 Mobile Safari/537.36 MicroMessenger/6.7.2.1340(0x260702A3) NetType/WIFI Language/zh_CN"; } break; case eWebBrowser.Chrome: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.Chrome_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.Qihu: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.Qihu_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.QQ: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.QQ_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.Sogou: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.Sogou_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.maxthon: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.maxthon_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.theworld: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.theworld_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; } switch (currentTask.engine) { case eEngines.Baidu: { webBrowser.Load("www.baidu.com"); } break; case eEngines.Qihu: { webBrowser.Load("www.so.com"); } break; case eEngines.Sogou: { webBrowser.Load("www.sogou.com"); } break; case eEngines.Sm: { webBrowser.Load("www.m.sm.cn"); } break; default: break; } }
public void EndTask(AppEventArgs arg) { EndTaskEvent(this, arg); }
public void ShowTask(AppEventArgs arg) { //ShowTaskEvent(this, new AppEventArgs() { message_string = str }); ShowTaskEvent(this, arg); }
internal void StartSearch(object sender, EventArgs e) { //webBrowser.ShowDevTools(); AppEventArgs arg = e as AppEventArgs; InitWebBrowser(); currentTask = arg.message_task; currentTask.webState = EWebbrowserState.Start; if (currentTask.engine == eEngines.Sm) { if (currentTask.webBrowser == eWebBrowser.IE_mobile || currentTask.webBrowser == eWebBrowser.Chrome_mobile || currentTask.webBrowser == eWebBrowser.Qihu_mobile || currentTask.webBrowser == eWebBrowser.Sogou_mobile || currentTask.webBrowser == eWebBrowser.QQ_mobile || currentTask.webBrowser == eWebBrowser.maxthon_mobile || currentTask.webBrowser == eWebBrowser.theworld_mobile ) { currentTask.webBrowser += 1; } } switch (currentTask.webBrowser) { case eWebBrowser.IE: { Appinfo.strUserAgent = "Mozilla / 4.0(compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident / 7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)"; } break; case eWebBrowser.IE_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; SM-G9350 Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.17 Mobile Safari/537.36 MicroMessenger/6.7.2.1340(0x260702A3) NetType/WIFI Language/zh_CN"; } break; case eWebBrowser.Chrome: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.Chrome_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.Qihu: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.Qihu_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.QQ: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.QQ_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.Sogou: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.Sogou_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.maxthon: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.maxthon_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; case eWebBrowser.theworld: { Appinfo.strUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"; } break; case eWebBrowser.theworld_mobile: { Appinfo.strUserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 HuaweiBrowser/9.0.1.319 Mobile Safari/537.36"; } break; } switch (currentTask.engine) { case eEngines.Baidu: { if (currentTask.searchType == eSearchType.OnSite) { webBase = new Baidu(this, "", ""); } else { webBase = new Baidu_Inside(this, "", ""); } } break; case eEngines.Qihu: { webBase = new Qihu(this, "", ""); } break; case eEngines.Sogou: { webBase = new Sogou(this, "", ""); } break; case eEngines.Sm: { webBase = new Sm(this, "", ""); } break; default: break; } }