public static bool CountTask(tagTask task) { for (int i = 0; i < Appinfo.listTask.Count; i++) { if (Appinfo.listTask[i].nID == task.nID) { Appinfo.listTask[i].nCountVaildToday = task.nCountVaildToday; Appinfo.listTask[i].nCountInvaildToday = task.nCountInvaildToday; Appinfo.listTask[i].nCountTotal = task.nCountTotal; Appinfo.listTask[i].nCountExcuteToday = task.nCountExcuteToday; Appinfo.listTask[i].nCountPageVaildToday = task.nCountPageVaildToday; Appinfo.listTask[i].nCountPageInvaildToday = task.nCountPageInvaildToday; Appinfo.listTask[i].nCountPageTotal = task.nCountPageTotal; using (var db = new TaskDB(Appinfo.dbPath)) { try { int count = db.Update(Appinfo.listTask[i]); Logger.Info($"{DateTime.Now}, 统计1条记录,{Appinfo.listTask[i].nID}"); } catch (Exception e) { throw; } } return(true); } } return(false); }
private void listView_statistics_DoubleClick(object sender, EventArgs e) { ListView listView = sender as ListView; if (listView.SelectedItems.Count > 0) //判断listview有被选中项 { int nIndex = listView.SelectedItems[0].Index; //取当前选中项的index,SelectedItems[0]这必须为0 string strID = listView.Items[nIndex].SubItems[1].Text; //用我们刚取到的index取被选中的某一列的值从0开始 tagTask task = Appinfo.QueryTask(int.Parse(strID)); if (task != null) { task.taskAcion = eTaskAcion.Change; ChangeTaskEvent(this, new AppEventArgs() { message_task = task }); } else { MessageBox.Show("打开任务失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("选择一项任务", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
internal void ChangeTask(object sender, EventArgs e) { AppEventArgs arg = e as AppEventArgs; currentTask = arg.message_task; SetTask(currentTask); }
void DeleteTask(tagTask task) { bool bFind = false; for (int i = 0; i < this.listView_statistics.Items.Count; i++) { string strID = this.listView_statistics.Items[i].SubItems[1].Text; //用我们刚取到的index取被选中的某一列的值从0开始 if (strID == task.nID.ToString()) { this.listView_statistics.Items[i].Remove(); bFind = true; break; } } }
void AddTask(tagTask task) { //ListViewItem[] item = new ListViewItem[1]; //item[0] = new string[] { "", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" }; //this.listView_statistics.Items.AddRange(item); string[] arrayTask = new string[23]; string strCheck = task.bCheck ? "启用" : "未启用"; arrayTask = new string[] { strCheck, //0 task.nID.ToString(), //1 task.strKeyword, //2 task.strTitle, //3 task.strSiteUrl, //4 define.GetEnumName(task.engine), //5 task.nEngineTime.ToString(), //6 define.GetEnumName(task.pageAccessType), //7 task.nCountPage.ToString(), //8 define.GetEnumName(task.webBrowser), //9 task.nCountVaildToday.ToString(), //10 task.nCountInvaildToday.ToString(), //11 task.nCountTotal.ToString(), //12 task.nCountExcuteToday.ToString(), //13 task.nCountLimit.ToString(), //14 task.nSiteTime.ToString(), //15 task.tViewSiteLastTime.ToString(), //16 task.nCountPageVaildToday.ToString(), //17 task.nCountInvaildToday.ToString(), //18 task.nCountPageTotal.ToString(), //19 task.nPageTime.ToString(), //20 "21", //21 "22" //22 }; ListViewItem item = new ListViewItem(arrayTask); this.listView_statistics.Items.Add(item); for (int i = 0; i < this.listView_statistics.CheckedItems.Count; i++) { this.listView_statistics.CheckedItems[i].Checked = true; //this.listView_statistics.CheckedItems[i].Selected = false; } }
void CountTask(tagTask task) { for (int i = 0; i < this.listView_statistics.Items.Count; i++) { string strID = this.listView_statistics.Items[i].SubItems[1].Text; //用我们刚取到的index取被选中的某一列的值从0开始 if (strID == task.nID.ToString()) { this.listView_statistics.Items[i].SubItems[10].Text = task.nCountVaildToday.ToString(); this.listView_statistics.Items[i].SubItems[11].Text = task.nCountInvaildToday.ToString(); this.listView_statistics.Items[i].SubItems[12].Text = task.nCountTotal.ToString(); this.listView_statistics.Items[i].SubItems[13].Text = task.nCountExcuteToday.ToString(); this.listView_statistics.Items[i].SubItems[17].Text = task.nCountPageVaildToday.ToString(); this.listView_statistics.Items[i].SubItems[18].Text = task.nCountPageInvaildToday.ToString(); this.listView_statistics.Items[i].SubItems[19].Text = task.nCountPageTotal.ToString(); break; } } }
public static void AddTask(tagTask task) { //int nID = 0; //for (int i = Appinfo.listTask.Count-1; i >= 0; i--) //{ // nID = Appinfo.listTask[i].nID + 1; // break; //} //task.nID = nID; Appinfo.listTask.Add(task); using (var db = new TaskDB(Appinfo.dbPath)) { try { int count = db.Insert(task); Logger.Info($"{DateTime.Now}, 插入{count}条记录"); } catch (Exception e) { throw; } } Appinfo.LoadTask(); task.tagtempleTime.nID = Appinfo.listTask[Appinfo.listTask.Count - 1].nID; using (var db = new TempleTimeDB(Appinfo.dbPath)) { try { int count = db.Insert(task.tagtempleTime); } catch (Exception e) { throw; } } Appinfo.LoadTask(); task = Appinfo.listTask[Appinfo.listTask.Count - 1]; }
private bool CheckVaild(tagTask task) { if (task.strKeyword.Trim().Equals("")) { MessageBox.Show("请输入关键词", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox_keyword.Focus(); return(false); } if (task.strTitle.Trim().Equals("") && task.strSiteUrl.Trim().Equals("")) { MessageBox.Show("请输入网站标题或链接", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox_Title.Focus(); return(false); } if (task.nCountPage < 0 || task.nCountPage > 999) { MessageBox.Show("请输入正确的搜索页码0~999", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox_CountPage.Focus(); return(false); } if (task.nCountLimit < 0 || task.nCountLimit > 999) { MessageBox.Show("请输入正确的每天点击量0~999", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox_CountLimit.Focus(); return(false); } if (task.pageAccessType == ePageAccessType.Appoint) { if (task.strPageUrl.Trim().Equals("")) { MessageBox.Show("请输入指定访问链接", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox_pageUrl.Focus(); return(false); } } return(true); }
//添加任务 private void button_Add_Click(object sender, EventArgs e) { currentTask = new tagTask(); GetTask(currentTask); if (!CheckVaild(currentTask)) { return; } currentTask.taskAcion = eTaskAcion.Add; Appinfo.AddTask(currentTask); //MainForm mainForm = (MainForm)this.Parent; RefreshStatisticsEvent(this, new AppEventArgs() { message_task = currentTask }); string strInfo; strInfo = string.Format("添加一个新任务完毕,编号{0}", currentTask.nID); Logger.Info(strInfo); MessageBox.Show(strInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); InitData(); }
void ChangeTask(tagTask task) { for (int i = 0; i < this.listView_statistics.Items.Count; i++) { string strID = this.listView_statistics.Items[i].SubItems[1].Text; //用我们刚取到的index取被选中的某一列的值从0开始 if (strID == task.nID.ToString()) { string strCheck = task.bCheck ? "启用" : "未启用"; this.listView_statistics.Items[i].SubItems[0].Text = strCheck; this.listView_statistics.Items[i].SubItems[2].Text = task.strKeyword; this.listView_statistics.Items[i].SubItems[3].Text = task.strTitle; this.listView_statistics.Items[i].SubItems[4].Text = task.strSiteUrl; this.listView_statistics.Items[i].SubItems[5].Text = define.GetEnumName(task.engine); this.listView_statistics.Items[i].SubItems[7].Text = define.GetEnumName(task.pageAccessType); this.listView_statistics.Items[i].SubItems[8].Text = task.nCountPage.ToString(); this.listView_statistics.Items[i].SubItems[9].Text = define.GetEnumName(task.webBrowser); this.listView_statistics.Items[i].SubItems[13].Text = task.nCountExcuteToday.ToString(); this.listView_statistics.Items[i].SubItems[14].Text = task.nCountLimit.ToString(); break; } } }
public static bool DeleteTask(tagTask task) { for (int i = 0; i < Appinfo.listTask.Count; i++) { if (Appinfo.listTask[i].nID == task.nID) { Appinfo.listTask.Remove(Appinfo.listTask[i]); using (var db = new TaskDB(Appinfo.dbPath)) { try { int count = db.Delete(task); Logger.Info($"{DateTime.Now}, 删除{count}条记录,{task.nID}"); } catch (Exception e) { throw; } } using (var db = new TempleTimeDB(Appinfo.dbPath)) { try { int count = db.Delete(task.tagtempleTime); } catch (Exception e) { throw; } } return(true); } } return(false); }
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; } }
internal void StopSearch(object sender, EventArgs e) { currentTask = null; webBrowser_new.Stop(); }
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; } }
void SetTask(tagTask task) { checkBox_check.Checked = task.bCheck; comboBox_Engines.SelectedIndex = (int)task.engine; comboBox_searchType.SelectedIndex = (int)task.searchType; textBox_onSiteUrl.Text = task.strOnSiteUrl; textBox_keyword.Text = task.strKeyword; textBox_Title.Text = task.strTitle; textBox_siteUrl.Text = task.strSiteUrl; textBox_EngineTime.Text = task.nEngineTime.ToString(); textBox_CountPage.Text = task.nCountPage.ToString(); comboBox_webBrowser.SelectedIndex = (int)task.webBrowser; textBox_CountLimit.Text = task.nCountLimit.ToString(); textBox_siteTime.Text = task.nSiteTime.ToString(); comboBox_PageAccessType.SelectedIndex = (int)task.pageAccessType; textBox_pageUrl.Text = task.strPageUrl.ToString(); textBox_pageTime.Text = task.nPageTime.ToString(); comboBox_templeTime.SelectedIndex = (int)task.templeTime; comboBox_templeTime_SelectedIndexChanged(comboBox_templeTime, new EventArgs()); checkBox_00.Checked = task.tagtempleTime.bCheck00; checkBox_01.Checked = task.tagtempleTime.bCheck01; checkBox_02.Checked = task.tagtempleTime.bCheck02; checkBox_03.Checked = task.tagtempleTime.bCheck03; checkBox_04.Checked = task.tagtempleTime.bCheck04; checkBox_05.Checked = task.tagtempleTime.bCheck05; checkBox_06.Checked = task.tagtempleTime.bCheck06; checkBox_07.Checked = task.tagtempleTime.bCheck07; checkBox_08.Checked = task.tagtempleTime.bCheck08; checkBox_09.Checked = task.tagtempleTime.bCheck09; checkBox_10.Checked = task.tagtempleTime.bCheck10; checkBox_11.Checked = task.tagtempleTime.bCheck11; checkBox_12.Checked = task.tagtempleTime.bCheck12; checkBox_13.Checked = task.tagtempleTime.bCheck13; checkBox_14.Checked = task.tagtempleTime.bCheck14; checkBox_15.Checked = task.tagtempleTime.bCheck15; checkBox_16.Checked = task.tagtempleTime.bCheck16; checkBox_17.Checked = task.tagtempleTime.bCheck17; checkBox_18.Checked = task.tagtempleTime.bCheck18; checkBox_19.Checked = task.tagtempleTime.bCheck19; checkBox_20.Checked = task.tagtempleTime.bCheck20; checkBox_21.Checked = task.tagtempleTime.bCheck21; checkBox_22.Checked = task.tagtempleTime.bCheck22; checkBox_23.Checked = task.tagtempleTime.bCheck23; textBox_00.Text = task.tagtempleTime.nCount00.ToString(); textBox_01.Text = task.tagtempleTime.nCount01.ToString(); textBox_02.Text = task.tagtempleTime.nCount02.ToString(); textBox_03.Text = task.tagtempleTime.nCount03.ToString(); textBox_04.Text = task.tagtempleTime.nCount04.ToString(); textBox_05.Text = task.tagtempleTime.nCount05.ToString(); textBox_06.Text = task.tagtempleTime.nCount06.ToString(); textBox_07.Text = task.tagtempleTime.nCount07.ToString(); textBox_08.Text = task.tagtempleTime.nCount08.ToString(); textBox_09.Text = task.tagtempleTime.nCount09.ToString(); textBox_10.Text = task.tagtempleTime.nCount10.ToString(); textBox_11.Text = task.tagtempleTime.nCount11.ToString(); textBox_12.Text = task.tagtempleTime.nCount12.ToString(); textBox_13.Text = task.tagtempleTime.nCount13.ToString(); textBox_14.Text = task.tagtempleTime.nCount14.ToString(); textBox_15.Text = task.tagtempleTime.nCount15.ToString(); textBox_16.Text = task.tagtempleTime.nCount16.ToString(); textBox_17.Text = task.tagtempleTime.nCount17.ToString(); textBox_18.Text = task.tagtempleTime.nCount18.ToString(); textBox_19.Text = task.tagtempleTime.nCount19.ToString(); textBox_20.Text = task.tagtempleTime.nCount20.ToString(); textBox_21.Text = task.tagtempleTime.nCount21.ToString(); textBox_22.Text = task.tagtempleTime.nCount22.ToString(); textBox_23.Text = task.tagtempleTime.nCount23.ToString(); switch (task.taskAcion) { case eTaskAcion.Add: { button_batchAdd.Enabled = true; button_Add.Enabled = true; button_Change.Enabled = false; button_Cancel.Enabled = false; button_Reset.Enabled = false; button_Delete.Enabled = false; } break; case eTaskAcion.Change: case eTaskAcion.Delete: { button_batchAdd.Enabled = false; button_Add.Enabled = false; button_Change.Enabled = true; button_Cancel.Enabled = true; button_Reset.Enabled = true; button_Delete.Enabled = true; } break; default: break; } }
void InitData() { tagTask newTask = new tagTask(); SetTask(newTask); }
internal void StopSearch(object sender, EventArgs e) { currentTask = null; webBrowser.GetBrowser().StopLoad(); }
public static bool ChangeTask(tagTask task) { for (int i = 0; i < Appinfo.listTask.Count; i++) { if (Appinfo.listTask[i].nID == task.nID) { Appinfo.listTask[i].engine = task.engine; Appinfo.listTask[i].searchType = task.searchType; Appinfo.listTask[i].strKeyword = task.strKeyword; Appinfo.listTask[i].strTitle = task.strTitle; Appinfo.listTask[i].strSiteUrl = task.strSiteUrl; Appinfo.listTask[i].nEngineTime = task.nEngineTime; Appinfo.listTask[i].nCountPage = task.nCountPage; Appinfo.listTask[i].webBrowser = task.webBrowser; Appinfo.listTask[i].nCountLimit = task.nCountLimit; Appinfo.listTask[i].nSiteTime = task.nSiteTime; Appinfo.listTask[i].pageAccessType = task.pageAccessType; Appinfo.listTask[i].strPageUrl = task.strPageUrl; Appinfo.listTask[i].nPageTime = task.nPageTime; Appinfo.listTask[i].tagtempleTime.bCheck00 = task.tagtempleTime.bCheck00; Appinfo.listTask[i].tagtempleTime.bCheck01 = task.tagtempleTime.bCheck01; Appinfo.listTask[i].tagtempleTime.bCheck02 = task.tagtempleTime.bCheck02; Appinfo.listTask[i].tagtempleTime.bCheck03 = task.tagtempleTime.bCheck03; Appinfo.listTask[i].tagtempleTime.bCheck04 = task.tagtempleTime.bCheck04; Appinfo.listTask[i].tagtempleTime.bCheck05 = task.tagtempleTime.bCheck05; Appinfo.listTask[i].tagtempleTime.bCheck06 = task.tagtempleTime.bCheck06; Appinfo.listTask[i].tagtempleTime.bCheck07 = task.tagtempleTime.bCheck07; Appinfo.listTask[i].tagtempleTime.bCheck08 = task.tagtempleTime.bCheck08; Appinfo.listTask[i].tagtempleTime.bCheck09 = task.tagtempleTime.bCheck09; Appinfo.listTask[i].tagtempleTime.bCheck10 = task.tagtempleTime.bCheck10; Appinfo.listTask[i].tagtempleTime.bCheck11 = task.tagtempleTime.bCheck11; Appinfo.listTask[i].tagtempleTime.bCheck12 = task.tagtempleTime.bCheck12; Appinfo.listTask[i].tagtempleTime.bCheck13 = task.tagtempleTime.bCheck13; Appinfo.listTask[i].tagtempleTime.bCheck14 = task.tagtempleTime.bCheck14; Appinfo.listTask[i].tagtempleTime.bCheck15 = task.tagtempleTime.bCheck15; Appinfo.listTask[i].tagtempleTime.bCheck16 = task.tagtempleTime.bCheck16; Appinfo.listTask[i].tagtempleTime.bCheck17 = task.tagtempleTime.bCheck17; Appinfo.listTask[i].tagtempleTime.bCheck18 = task.tagtempleTime.bCheck18; Appinfo.listTask[i].tagtempleTime.bCheck19 = task.tagtempleTime.bCheck19; Appinfo.listTask[i].tagtempleTime.bCheck20 = task.tagtempleTime.bCheck20; Appinfo.listTask[i].tagtempleTime.bCheck21 = task.tagtempleTime.bCheck21; Appinfo.listTask[i].tagtempleTime.bCheck22 = task.tagtempleTime.bCheck22; Appinfo.listTask[i].tagtempleTime.bCheck23 = task.tagtempleTime.bCheck23; Appinfo.listTask[i].tagtempleTime.nCount00 = task.tagtempleTime.nCount00; Appinfo.listTask[i].tagtempleTime.nCount01 = task.tagtempleTime.nCount01; Appinfo.listTask[i].tagtempleTime.nCount02 = task.tagtempleTime.nCount02; Appinfo.listTask[i].tagtempleTime.nCount03 = task.tagtempleTime.nCount03; Appinfo.listTask[i].tagtempleTime.nCount04 = task.tagtempleTime.nCount04; Appinfo.listTask[i].tagtempleTime.nCount05 = task.tagtempleTime.nCount05; Appinfo.listTask[i].tagtempleTime.nCount06 = task.tagtempleTime.nCount06; Appinfo.listTask[i].tagtempleTime.nCount07 = task.tagtempleTime.nCount07; Appinfo.listTask[i].tagtempleTime.nCount08 = task.tagtempleTime.nCount08; Appinfo.listTask[i].tagtempleTime.nCount09 = task.tagtempleTime.nCount09; Appinfo.listTask[i].tagtempleTime.nCount10 = task.tagtempleTime.nCount10; Appinfo.listTask[i].tagtempleTime.nCount11 = task.tagtempleTime.nCount11; Appinfo.listTask[i].tagtempleTime.nCount12 = task.tagtempleTime.nCount12; Appinfo.listTask[i].tagtempleTime.nCount13 = task.tagtempleTime.nCount13; Appinfo.listTask[i].tagtempleTime.nCount14 = task.tagtempleTime.nCount14; Appinfo.listTask[i].tagtempleTime.nCount15 = task.tagtempleTime.nCount15; Appinfo.listTask[i].tagtempleTime.nCount16 = task.tagtempleTime.nCount16; Appinfo.listTask[i].tagtempleTime.nCount17 = task.tagtempleTime.nCount17; Appinfo.listTask[i].tagtempleTime.nCount18 = task.tagtempleTime.nCount18; Appinfo.listTask[i].tagtempleTime.nCount19 = task.tagtempleTime.nCount19; Appinfo.listTask[i].tagtempleTime.nCount20 = task.tagtempleTime.nCount20; Appinfo.listTask[i].tagtempleTime.nCount21 = task.tagtempleTime.nCount21; Appinfo.listTask[i].tagtempleTime.nCount22 = task.tagtempleTime.nCount22; Appinfo.listTask[i].tagtempleTime.nCount23 = task.tagtempleTime.nCount23; Appinfo.listTask[i].templeTime = task.templeTime; using (var db = new TaskDB(Appinfo.dbPath)) { try { int count = db.Update(Appinfo.listTask[i]); Logger.Info($"{DateTime.Now}, 修改1条记录,{Appinfo.listTask[i].nID}"); } catch (Exception e) { throw; } } using (var db = new TempleTimeDB(Appinfo.dbPath)) { try { int count = db.Update(Appinfo.listTask[i].tagtempleTime); } catch (Exception e) { throw; } } return(true); } } return(false); }
internal void AddExcuteCount(tagTask task) { switch (DateTime.Now.Hour) { case 0: { task.tagtempleTime.nCount00 += 1; } break; case 1: { task.tagtempleTime.nCount01 += 1; } break; case 2: { task.tagtempleTime.nCount02 += 1; } break; case 3: { task.tagtempleTime.nCount03 += 1; } break; case 4: { task.tagtempleTime.nCount04 += 1; } break; case 5: { task.tagtempleTime.nCount05 += 1; } break; case 6: { task.tagtempleTime.nCount06 += 1; } break; case 7: { task.tagtempleTime.nCount07 += 1; } break; case 8: { task.tagtempleTime.nCount08 += 1; } break; case 9: { task.tagtempleTime.nCount09 += 1; } break; case 10: { task.tagtempleTime.nCount10 += 1; } break; case 11: { task.tagtempleTime.nCount11 += 1; } break; case 12: { task.tagtempleTime.nCount12 += 1; } break; case 13: { task.tagtempleTime.nCount13 += 1; } break; case 14: { task.tagtempleTime.nCount14 += 1; } break; case 15: { task.tagtempleTime.nCount15 += 1; } break; case 16: { task.tagtempleTime.nCount16 += 1; } break; case 17: { task.tagtempleTime.nCount17 += 1; } break; case 18: { task.tagtempleTime.nCount18 += 1; } break; case 19: { task.tagtempleTime.nCount19 += 1; } break; case 20: { task.tagtempleTime.nCount20 += 1; } break; case 21: { task.tagtempleTime.nCount21 += 1; } break; case 22: { task.tagtempleTime.nCount22 += 1; } break; case 23: { task.tagtempleTime.nCount23 += 1; } break; default: break; } }
tagTask GetTask(tagTask task) { task.bCheck = checkBox_check.Checked; task.engine = (eEngines)comboBox_Engines.SelectedIndex; task.searchType = (eSearchType)comboBox_searchType.SelectedIndex; task.strOnSiteUrl = textBox_onSiteUrl.Text; task.strKeyword = textBox_keyword.Text; task.strTitle = textBox_Title.Text; task.strSiteUrl = textBox_siteUrl.Text; task.nEngineTime = int.Parse(textBox_EngineTime.Text); task.nCountPage = int.Parse(textBox_CountPage.Text); task.webBrowser = (eWebBrowser)comboBox_webBrowser.SelectedIndex; task.nCountLimit = int.Parse(textBox_CountLimit.Text); task.nSiteTime = int.Parse(textBox_siteTime.Text); task.pageAccessType = (ePageAccessType)comboBox_PageAccessType.SelectedIndex; task.strPageUrl = textBox_pageUrl.Text; task.nPageTime = int.Parse(textBox_pageTime.Text); task.tagtempleTime.bCheck00 = checkBox_00.Checked; task.tagtempleTime.bCheck01 = checkBox_01.Checked; task.tagtempleTime.bCheck02 = checkBox_02.Checked; task.tagtempleTime.bCheck03 = checkBox_03.Checked; task.tagtempleTime.bCheck04 = checkBox_04.Checked; task.tagtempleTime.bCheck05 = checkBox_05.Checked; task.tagtempleTime.bCheck06 = checkBox_06.Checked; task.tagtempleTime.bCheck07 = checkBox_07.Checked; task.tagtempleTime.bCheck08 = checkBox_08.Checked; task.tagtempleTime.bCheck09 = checkBox_09.Checked; task.tagtempleTime.bCheck10 = checkBox_10.Checked; task.tagtempleTime.bCheck11 = checkBox_11.Checked; task.tagtempleTime.bCheck12 = checkBox_12.Checked; task.tagtempleTime.bCheck13 = checkBox_13.Checked; task.tagtempleTime.bCheck14 = checkBox_14.Checked; task.tagtempleTime.bCheck15 = checkBox_15.Checked; task.tagtempleTime.bCheck16 = checkBox_16.Checked; task.tagtempleTime.bCheck17 = checkBox_17.Checked; task.tagtempleTime.bCheck18 = checkBox_18.Checked; task.tagtempleTime.bCheck19 = checkBox_19.Checked; task.tagtempleTime.bCheck20 = checkBox_20.Checked; task.tagtempleTime.bCheck21 = checkBox_21.Checked; task.tagtempleTime.bCheck22 = checkBox_22.Checked; task.tagtempleTime.bCheck23 = checkBox_23.Checked; task.tagtempleTime.nCount00 = int.Parse(textBox_00.Text); task.tagtempleTime.nCount01 = int.Parse(textBox_01.Text); task.tagtempleTime.nCount02 = int.Parse(textBox_02.Text); task.tagtempleTime.nCount03 = int.Parse(textBox_03.Text); task.tagtempleTime.nCount04 = int.Parse(textBox_04.Text); task.tagtempleTime.nCount05 = int.Parse(textBox_05.Text); task.tagtempleTime.nCount06 = int.Parse(textBox_06.Text); task.tagtempleTime.nCount07 = int.Parse(textBox_07.Text); task.tagtempleTime.nCount08 = int.Parse(textBox_08.Text); task.tagtempleTime.nCount09 = int.Parse(textBox_09.Text); task.tagtempleTime.nCount10 = int.Parse(textBox_10.Text); task.tagtempleTime.nCount11 = int.Parse(textBox_11.Text); task.tagtempleTime.nCount12 = int.Parse(textBox_12.Text); task.tagtempleTime.nCount13 = int.Parse(textBox_13.Text); task.tagtempleTime.nCount14 = int.Parse(textBox_14.Text); task.tagtempleTime.nCount15 = int.Parse(textBox_15.Text); task.tagtempleTime.nCount16 = int.Parse(textBox_16.Text); task.tagtempleTime.nCount17 = int.Parse(textBox_17.Text); task.tagtempleTime.nCount18 = int.Parse(textBox_18.Text); task.tagtempleTime.nCount19 = int.Parse(textBox_19.Text); task.tagtempleTime.nCount20 = int.Parse(textBox_20.Text); task.tagtempleTime.nCount21 = int.Parse(textBox_21.Text); task.tagtempleTime.nCount22 = int.Parse(textBox_22.Text); task.tagtempleTime.nCount23 = int.Parse(textBox_23.Text); task.templeTime = (eTempleTime)comboBox_templeTime.SelectedIndex; return(task); }