/// <summary> /// 构造函数 /// </summary> /// <param name="rule">导航规则</param> /// <param name="index">层析编号</param> public NavigationRuleItem(NavigationRule rule, int index) { this.SubItems.Clear(); this.rule = rule; this.Text = index.ToString(); this.ImageKey = "taskmin.png"; this.SubItems.Add(new ListViewSubItem(this, rule.Name)); //层次名称 this.SubItems.Add(new ListViewSubItem(this, rule.Terminal.ToString())); //最终页面 this.SubItems.Add(new ListViewSubItem(this, rule.PickNextLayerUrls.ToString())); //提取下一层网址 this.SubItems.Add(new ListViewSubItem(this, rule.NextLayerUrlPattern)); //下一层网址模板 this.SubItems.Add(new ListViewSubItem(this, rule.PickNextPageUrl.ToString())); //提取下一页 }
/// <summary> /// 获取导航规则对象 /// </summary> /// <returns>导航规则</returns> private NavigationRule GetNavigation() { NavigationRule n = new NavigationRule(); n.ContentEncoding = this.cbxContentEncoding.Text; //内容编码 n.ExtractionEndFlag = this.txtExtractionEndFlag.Text; //内容采集范围结束标志 n.ExtractionStartFlag = this.txtExtractionStartFlag.Text; //内容采集范围开始标志 n.HistoryUrlEnabled = false; //是否允许历史网址重复 n.HistoryUrlOptimization = this.chbHistoryUrlOptimization.Checked; //是否优化历史网址记录 n.IterationFlag = txtIterationFlag.Text; //循环标志 n.JsDecoding = chbJsDecoding.Checked; //对源文件进行JS解密 n.Name = cbxLayerName.Text; //层次名称 n.NextLayerUrlEncoded = chbNextLayerUrlEncoded.Checked; //下一层网址已编码 n.NextLayerUrlPattern = txtNextLayerUrlPattern.Text; //下一层网址模板 n.NextLayerUrlReferer = txtNextLayerUrlReferer.Text; //下一次呢过网址的referer n.NextPageLargest = Convert.ToInt32(nudNextPageLargest.Value); //最大页数 n.NextPageUrlPattern = txtProccessScripts.Text; //下一页网址模板 n.PickingEndFlag = txtPickingEndFlag.Text; //网址提取范围结束标志 n.PickingStartFlag = txtPickingStartFlag.Text; //网址提取范围开始标志 n.PickNextLayerUrls = false; //是否提取下一层的网址 n.PickNextPageUrl = false; //是否提取下一页的网址 n.ProccessScripts = chbProccessScripts.Checked; //是否开启下一页网址提取标记 n.RestInterval = Convert.ToInt32(nudRestInterval.Value); //访问休息间隔(秒) n.SkipToIfPickingFailed = cbxSkipToIfPickingFailed.Text; //下一层网址提取失败跳转到层? n.Terminal = rdoTerminal.Checked; //终端页面 n.UsePluginOfPickNextLayerUrls = chbUsePluginOfPickNextLayerUrls.Checked; //使用插件提取下一层网址 n.UsePluginOfPickNextPageUrl = chbUsePluginOfPickNextPageUrl.Checked; //使用插件提取下一页网址 n.UsePluginOfVisit = chbUsePluginOfVisit.Checked; //使用插件访问本层Url n.UseRegularExpression = chbUseRegularExpression.Checked; //使用正则表达式 //源文件替换 foreach (Utility.NavigationRuleItem item in livNavigationRule.SelectedItems) { n.Replacements = item.rule.Replacements; } return(n); }
public int RemoveRules(string pattern, NavigationRule rule) { throw new NotImplementedException(); }
public CollectionChangeAction AddRule(string pattern, NavigationRule rule) { throw new NotImplementedException(); }
/// <summary> /// 获取导航规则对象 /// </summary> /// <returns>导航规则</returns> private NavigationRule GetNavigation() { NavigationRule n = new NavigationRule(); n.ContentEncoding = this.cbxContentEncoding.Text; //内容编码 n.ExtractionEndFlag = this.txtExtractionEndFlag.Text; //内容采集范围结束标志 n.ExtractionStartFlag = this.txtExtractionStartFlag.Text; //内容采集范围开始标志 n.HistoryUrlEnabled = false; //是否允许历史网址重复 n.HistoryUrlOptimization = this.chbHistoryUrlOptimization.Checked; //是否优化历史网址记录 n.IterationFlag = txtIterationFlag.Text; //循环标志 n.JsDecoding = chbJsDecoding.Checked; //对源文件进行JS解密 n.Name = cbxLayerName.Text; //层次名称 n.NextLayerUrlEncoded = chbNextLayerUrlEncoded.Checked; //下一层网址已编码 n.NextLayerUrlPattern = txtNextLayerUrlPattern.Text; //下一层网址模板 n.NextLayerUrlReferer = txtNextLayerUrlReferer.Text; //下一次呢过网址的referer n.NextPageLargest = Convert.ToInt32(nudNextPageLargest.Value); //最大页数 n.NextPageUrlPattern = txtProccessScripts.Text; //下一页网址模板 n.PickingEndFlag = txtPickingEndFlag.Text; //网址提取范围结束标志 n.PickingStartFlag = txtPickingStartFlag.Text; //网址提取范围开始标志 n.PickNextLayerUrls = false; //是否提取下一层的网址 n.PickNextPageUrl = false; //是否提取下一页的网址 n.ProccessScripts = chbProccessScripts.Checked; //是否开启下一页网址提取标记 n.RestInterval = Convert.ToInt32(nudRestInterval.Value); //访问休息间隔(秒) n.SkipToIfPickingFailed = cbxSkipToIfPickingFailed.Text; //下一层网址提取失败跳转到层? n.Terminal = rdoTerminal.Checked; //终端页面 n.UsePluginOfPickNextLayerUrls = chbUsePluginOfPickNextLayerUrls.Checked; //使用插件提取下一层网址 n.UsePluginOfPickNextPageUrl = chbUsePluginOfPickNextPageUrl.Checked; //使用插件提取下一页网址 n.UsePluginOfVisit = chbUsePluginOfVisit.Checked; //使用插件访问本层Url n.UseRegularExpression = chbUseRegularExpression.Checked; //使用正则表达式 //源文件替换 foreach (Utility.NavigationRuleItem item in livNavigationRule.SelectedItems) { n.Replacements = item.rule.Replacements; } return n; }