private void method_5() { try { this.tInfo.RuleFile = this.comboBox_0.Text; if (this.radioButton_0.Checked) { this.tInfo.RadioBy = "GetListUrl"; } if (this.radioButton_1.Checked) { this.tInfo.RadioBy = "GetSinceId"; } TaskConfigInfo taskConfigInfo = this.tInfo; string str = this.textBox_3.Text.Trim().Replace("\r\n", "♂"); char[] chrArray = new char[] { '\u2642' }; taskConfigInfo.GetListUrl = str.Split(chrArray); TaskConfigInfo taskConfigInfo1 = this.tInfo; string text = this.textBox_4.Text; chrArray = new char[] { ',' }; taskConfigInfo1.GetSinceId = text.Split(chrArray); } catch (Exception exception1) { Exception exception = exception1; MessageForm messageForm = new MessageForm() { Text = Localization.Get("错误提示") }; messageForm.MessageText.Text = exception.Message; messageForm.ShowDialog(); } }
public HelpUpdateNovel() { Class19.Q77LubhzKM3NS(); this.rInfo = new RuleConfigInfo(); this.tInfo = new TaskConfigInfo(); this.InitializeComponent(); }
private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { gvDetail.CloseEditor(); labelControl1.Focus(); if (!Valid()) { return; } TaskConfigInfo CurrTaskConfig = bsConfig.Current as TaskConfigInfo; IList <TaskConfigDetail> AllTaskConfigDetail = bsDetail.List as IList <TaskConfigDetail>; if (CurrTaskConfig != null && AllTaskConfigDetail != null && AllTaskConfigDetail.Count > 0) { if (CurrTaskConfig.IsNew && AllTaskConfigs.Where(p => p.TaskConditonCode == CurrTaskConfig.TaskConditonCode).Count() > 0) { MsgBox.ShowWarn("任务条件配置编号已存在!"); return; } CurrTaskConfig.TaskConfigDetail = AllTaskConfigDetail; OperateReturnInfo opr = AGVDAccess.AGVClientDAccess.SaveTaskConfig(CurrTaskConfig); MsgBox.Show(opr); this.DialogResult = DialogResult.OK; } } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
/// <summary> /// 记录任务最后一次执行的时间 /// </summary> /// <param name="taskType"></param> /// <param name="time"></param> private static void RecordExecuteTime(string taskType, DateTime time) { try { TaskConfigInfo task = TaskConfigs.Instance().GetConfig().FindConfig(taskType); //设置最后一次执行时间 /*if (task.Timetype == TaskTimeType.Day) * { * * task.LastExecuteTime = task.LastExecuteTime.AddDays(task.Interval); * } * else * { * * task.LastExecuteTime = DateTime.Now; * }*/ task.LastExecuteTime = DateTime.Now; TaskConfigs.Instance().Save(TaskConfigs.Instance().GetConfig()); } catch (Exception ex) { //Log4Helper.Error(ex.Message); } }
public TaskForm() { Class19.Q77LubhzKM3NS(); this.string_2 = ""; this.string_1 = ""; this.bool_0 = false; this.rInfo = new RuleConfigInfo(); this.tInfo = new TaskConfigInfo(); this.dateTime_0 = DateTime.Now; this.InitializeComponent(); }
public FrmTaskConfigDetail(IList <TaskConfigInfo> AllTaskConfig, TaskConfigInfo NewTaskConfig) { InitializeComponent(); if (AllTaskConfigs != null) { AllTaskConfigs = AllTaskConfig; } if (NewTaskConfigs != null) { NewTaskConfigs = NewTaskConfig; } }
public RuleForm() { Class19.Q77LubhzKM3NS(); this.hashtable_0 = new Hashtable(); this.int_0 = -1; this.ruleConfigInfo_0 = new RuleConfigInfo(); this.ruleTestForm_0 = new RuleTestForm(); this.taskConfigInfo_0 = new TaskConfigInfo(); this.InitializeComponent(); this.hashtable_0.Add("RuleVersion", Localization.Get("规则版本")); this.hashtable_0.Add("RuleID", Localization.Get("规则编号")); this.hashtable_0.Add("GetSiteName", Localization.Get("站点名称")); this.hashtable_0.Add("GetSiteCharset", Localization.Get("站点编码")); this.hashtable_0.Add("GetSiteUrl", Localization.Get("站点地址")); this.hashtable_0.Add("NovelSearchUrl", Localization.Get("站点搜索地址")); this.hashtable_0.Add("NovelSearchData", Localization.Get("搜索提交内容\r\n{SearchKey} 表示搜索提交的内容")); this.hashtable_0.Add("NovelSearch_GetNovelKey", Localization.Get("从搜索结果中获得小说编号\r\n{SearchKey} 表示搜索提交的内容\r\n此获得结果存入{NovelKey}变量")); this.hashtable_0.Add("NovelListUrl", Localization.Get("站点最新列表地址")); this.hashtable_0.Add("NovelList_GetNovelKey", Localization.Get("从最新列表中获得小说编号\r\n此规则中可以同时获得书名以方便手动时查看\r\n此获得结果存入{NovelKey}变量")); this.hashtable_0.Add("NovelUrl", Localization.Get("小说信息页地址 可调用{NovelKey}变量\r\n{NovelKey}一般情况表示小说编号")); this.hashtable_0.Add("NovelErr", Localization.Get("小说信息页错误识别标记")); this.hashtable_0.Add("NovelName", Localization.Get("获得小说名称正则,替换标签♂\r\n支持多模板")); this.hashtable_0.Add("NovelAuthor", Localization.Get("获得小说作者正则,替换标签♂\r\n支持多模板")); this.hashtable_0.Add("LagerSort", Localization.Get("获得小说大类正则,替换标签♂\r\n支持多模板")); this.hashtable_0.Add("SmallSort", Localization.Get("获得小说小类正则,替换标签♂\r\n支持多模板\r\n如果目标站点没有小类,这里就重复输入一次大类规则")); this.hashtable_0.Add("NovelIntro", Localization.Get("获得小说简介正则,替换标签♂\r\n支持多模板")); this.hashtable_0.Add("NovelKeyword", Localization.Get("获得小说主角(关键字)正则,替换标签♂\r\n支持多模板")); this.hashtable_0.Add("NovelDegree", Localization.Get("获得写作进程正则(请把全本小说替换成完成、完结、完本),替换标签♂\r\n支持多模板")); this.hashtable_0.Add("NovelCover", Localization.Get("获得小说封面正则,替换标签♂\r\n支持多模板")); this.hashtable_0.Add("NovelDefaultCoverUrl", Localization.Get("目标站默认封面地址\n遇到这个地址就不采集它的封面")); this.hashtable_0.Add("NovelInfo_GetNovelPubKey", Localization.Get("获得小说公众目录页地址正则\r\n支持多模板")); this.hashtable_0.Add("NovelInfo_GetNovelVipKey", Localization.Get("获得小说VIP目录页地址正则\r\n支持多模板\r\n这个一般无用,可留空")); this.hashtable_0.Add("PubCookies", Localization.Get("访问公众版需要登陆的Cookies\r\n一般无关,小说阅读网需要这个")); this.hashtable_0.Add("PubIndexUrl", Localization.Get("公众目录页地址 可调用{NovelPubKey} {NovelKey}变量")); this.hashtable_0.Add("PubIndexErr", Localization.Get("公众目录页错误识别标记")); this.hashtable_0.Add("PubVolumeContent", Localization.Get("获得目录部分关键HTML,一般可留空,替换标签♂\r\n替换支持{$分类名称$} {$小说名称$} {$小说作者$}变量")); this.hashtable_0.Add("PubVolumeSplit", Localization.Get("分割分卷")); this.hashtable_0.Add("PubVolumeName", Localization.Get("获得分卷名,替换标签♂\r\n支持多模板")); this.hashtable_0.Add("PubChapterName", Localization.Get("获得章节名,替换标签♂\r\n替换支持{$分类名称$} {$小说名称$} {$小说作者$} {$书卷名称$}变量")); this.hashtable_0.Add("PubChapter_GetChapterKey", Localization.Get("获得章节地址(章节编号),所获得的数量必须和章节名相同。记录变量{ChapterKey}")); this.hashtable_0.Add("PubContentUrl", Localization.Get("章节内容页地址 可调用{ChapterKey} {NovelKey}变量")); this.hashtable_0.Add("PubContentErr", Localization.Get("章节内容页错误识别标记")); this.hashtable_0.Add("PubContent_GetTextKey", Localization.Get("内容页中真实内容有JS调用的,获得JS地址 记录变量{TextKey}")); this.hashtable_0.Add("PubTextUrl", Localization.Get("组合真实内容地址")); this.hashtable_0.Add("PubContentText", Localization.Get("获得章节内容的正则,替换标签♂\r\n支持多模板")); this.hashtable_0.Add("PubContentChapterName", Localization.Get("获得章节修正名称的正则,自动修复列表名称,替换标签♂\r\n支持多模板\r\n(此为高级功能,用于防采集列表替换章节名称)")); this.hashtable_0.Add("PubContentChapterNum", Localization.Get("获得章节修正名称的数量(此为高级功能,用于防采集列表替换章节名称的数量,从尾章节向前数)")); this.hashtable_0.Add("PubContentReplace", Localization.Get("章节内容替换规则(替换获取图片后)\r\n每行一个替换,格式如下\r\n需要替换的内容♂替换结果\r\n<div.+?> 这个表示过滤\r\n<div.+?>♂<br> 这个表示替换")); }
private void RuleForm_Load(object sender, EventArgs e) { string[] strArrays = IO.LoadRules(); if ((int)strArrays.Length > 0) { string[] strArrays1 = strArrays; for (int i = 0; i < (int)strArrays1.Length; i++) { object obj = strArrays1[i]; this.comboBox_0.Items.Add(obj); } this.comboBox_0.Text = this.comboBox_0.Items[0].ToString(); } this.taskConfigInfo_0 = (TaskConfigInfo)ConfigFileManager.LoadConfig("TaskConfig.xml", this.taskConfigInfo_0); }
private void button_3_Click(object sender, EventArgs e) { this.tInfo = (TaskConfigInfo)ConfigFileManager.LoadConfig(this.comboBox_4.Text, this.tInfo); this.method_5(); this.label7.Text = Localization.Get("开始生成错误日志..."); this.string_1 = this.comboBox_4.Text; this.tInfo.ID = this.string_2; this.button_3.Enabled = false; DateTime now = DateTime.Now; this.dateTime_0 = now.AddMinutes((double)this.tInfo.Interval); if (!this.backgroundWorker_0.IsBusy) { this.backgroundWorker_0.RunWorkerAsync(); } }
private void HelpUpdateNovel_Load(object sender, EventArgs e) { this.tInfo = (TaskConfigInfo)ConfigFileManager.LoadConfig("TaskConfig.xml", this.tInfo); this.comboBox_0.BeginUpdate(); string[] strArrays = IO.LoadRules(); if ((int)strArrays.Length > 0) { for (int i = 0; i < (int)strArrays.Length; i++) { this.comboBox_0.Items.Add(strArrays[i]); if (strArrays[i] == this.tInfo.RuleFile) { this.comboBox_0.Text = this.tInfo.RuleFile; } } } this.comboBox_0.EndUpdate(); }
private void TaskForm_Load(object sender, EventArgs e) { Guid guid = Guid.NewGuid(); this.string_2 = guid.ToString().ToUpper(); TaskForm taskForm = this; string str = string.Concat(taskForm.Text, " ", this.string_2); taskForm.Text = str; this.tInfo = (TaskConfigInfo)ConfigFileManager.LoadConfig("TaskConfig.xml", this.tInfo); this.comboBox_0.BeginUpdate(); string[] strArrays = IO.LoadRules(); if ((int)strArrays.Length > 0) { for (int i = 0; i < (int)strArrays.Length; i++) { this.comboBox_0.Items.Add(strArrays[i]); if (strArrays[i] == this.tInfo.RuleFile) { this.comboBox_0.Text = this.tInfo.RuleFile; this.rInfo = (RuleConfigInfo)ConfigFileManager.LoadConfig(this.tInfo.RuleFile, this.rInfo); this.textBox_3.Text = this.rInfo.NovelListUrl.Pattern; if (!this.bool_0) { this.Text = string.Concat(this.rInfo.GetSiteName.Pattern, Localization.Get(" 错误生成器")); } } } } this.comboBox_0.EndUpdate(); this.comboBox_4.BeginUpdate(); this.comboBox_4.Items.Add("TaskConfig.xml"); this.comboBox_4.Text = "TaskConfig.xml"; string[] strArrays1 = IO.LoadTasks(); if ((int)strArrays1.Length > 0) { for (int j = 0; j < (int)strArrays1.Length; j++) { this.comboBox_4.Items.Add(strArrays1[j]); } } this.comboBox_4.EndUpdate(); }
/// <summary> /// 初始化 /// </summary> /// <param name="config"></param> internal void Init(TaskConfigInfo config) { if (config == null) { throw new Exception(this.Type + " 任务配置文件失效"); } if (config.TypeName.IndexOf(this.Type) == -1) { throw new Exception(this.Type + " 任务配置文件不匹配"); } this.TaskName = config.TaskName; this._executeTime = config.ExecuteTime; this.Enabled = config.Enabled; this.interval = config.Interval; this.TimeType = config.Timetype; this.LastExecuteTime = config.LastExecuteTime; }
private void btnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { IList <TaskConfigInfo> AllTaskConfig = bsDetail.List as IList <TaskConfigInfo>; TaskConfigInfo NewTaskConfig = new TaskConfigInfo(); NewTaskConfig.IsNew = true; using (FrmTaskConfigDetail frm = new FrmTaskConfigDetail(AllTaskConfig, NewTaskConfig)) { frm.ShowDialog(); if (frm.DialogResult == DialogResult.OK) { bsDetail.DataSource = AGVDAccess.AGVClientDAccess.LoadAllTaskConfig(); bsDetail.ResetBindings(false); } } } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
private void btnDele_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { TaskConfigInfo NewTaskConfig = bsDetail.Current as TaskConfigInfo; if (NewTaskConfig != null) { if (MsgBox.ShowQuestion("确定删除当前项?") == DialogResult.Yes) { OperateReturnInfo opr = AGVDAccess.AGVClientDAccess.DeleTaskConfig(NewTaskConfig); MsgBox.Show(opr); if (opr.ReturnCode == OperateCodeEnum.Success) { bsDetail.DataSource = AGVDAccess.AGVClientDAccess.LoadAllTaskConfig(); bsDetail.ResetBindings(false); } } } } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { gvPass.BeforeLeaveRow -= gvPass_BeforeLeaveRow; gvDetail.CloseEditor(); labelControl1.Focus(); if (!Valid()) { return; } if (gvPass.FocusedRowHandle >= 0) { TaskConfigMustPass CurrConfigPass = baPass[gvPass.FocusedRowHandle] as TaskConfigMustPass; if (CurrConfigPass != null) { if (string.IsNullOrEmpty(CurrConfigPass.MustPassLandCode)) { baPass.RemoveCurrent(); } IList <IOActionInfo> IOActions = bsIOActions.List as List <IOActionInfo>; if (IOActions != null) { CurrConfigPass.MustPassIOAction = DataToObject.CreateDeepCopy <IList <IOActionInfo> >(IOActions); } } } if (gvDetail.FocusedRowHandle >= 0) { TaskConfigDetail CurrDetail = bsDetail[gvDetail.FocusedRowHandle] as TaskConfigDetail; if (CurrDetail != null) { IList <TaskConfigMustPass> ConfigMustPasss = baPass.List as List <TaskConfigMustPass>; if (ConfigMustPasss != null) { CurrDetail.TaskConfigMustPass = DataToObject.CreateDeepCopy <IList <TaskConfigMustPass> >(ConfigMustPasss); } } } TaskConfigInfo CurrTaskConfig = bsConfig.Current as TaskConfigInfo; IList <TaskConfigDetail> AllTaskConfigDetail = bsDetail.List as IList <TaskConfigDetail>; if (CurrTaskConfig != null && AllTaskConfigDetail != null && AllTaskConfigDetail.Count > 0) { if (CurrTaskConfig.IsNew && AllTaskConfigs.Where(p => p.TaskConditonCode == CurrTaskConfig.TaskConditonCode).Count() > 0) { MsgBox.ShowWarn("任务条件配置编号已存在!"); return; } CurrTaskConfig.TaskConfigDetail = DataToObject.CreateDeepCopy <IList <TaskConfigDetail> >(AllTaskConfigDetail); OperateReturnInfo opr = AGVDAccess.AGVClientDAccess.SaveTaskConfig(CurrTaskConfig); MsgBox.Show(opr); if (opr.ReturnCode == OperateCodeEnum.Success) { this.DialogResult = DialogResult.OK; } } } catch (Exception ex) { MsgBox.ShowError(ex.Message); } finally { gvPass.BeforeLeaveRow += gvPass_BeforeLeaveRow; } }