Exemplo n.º 1
0
        protected static void SetNodeConfigs(TreeNode node, Dictionary <string, WebSiteCrawlConfig> configs)
        {
            WebSiteCrawller crawller = node.Tag as WebSiteCrawller;

            if (crawller != null && !string.IsNullOrEmpty(crawller.Key))
            {
                if (configs.ContainsKey(crawller.Key))
                {
                    WebSiteCrawlConfig config = configs[crawller.Key];
                    if (config != null && !string.IsNullOrEmpty(config.Key))
                    {
                        crawller.Config = config;
                        UpdateNodeConfigs(node, false);
                    }
                }
            }
            if (node.Nodes.Count > 0)
            {
                foreach (TreeNode child in node.Nodes)
                {
                    SetNodeConfigs(child, configs);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 默认构造方法,初始化部分默认值
 /// </summary>
 /// <param name="config">抓取程序配置项</param>
 public WebSiteCrawller(WebSiteCrawlConfig config)
     : this()
 {
     this.Config = config;
 }