Esempio n. 1
0
 public static XElement SerializeConfiguration(CrawlingConfig config)
 {
     return(new XElement("CrawlingConfig",
                         new XAttribute("Guid", config.Guid),
                         new XAttribute("Name", config.Name),
                         new XAttribute("Description", config.Description),
                         new XElement("Buckets", config.Buckets.Select(SerializeBucket)),
                         new XElement("Rules", config.Rules.Select(SerializeRule)),
                         new XElement("StartingUrls", config.StartingUrls.Select(SerializeStartingUrl))));
 }
Esempio n. 2
0
        public static CrawlingConfig DeserializeConfiguration(XElement element)
        {
            CrawlingConfig config = new CrawlingConfig
            {
                Guid        = (Guid)element.Attribute("Guid"),
                Name        = (string)element.Attribute("Name"),
                Description = (string)element.Attribute("Description"),
            };

            config.Buckets.AddRange(element.Elements("Buckets").Elements().Select(DeserializeBucket));
            config.Rules.AddRange(element.Elements("Rules").Elements().Select(x => DeserializeRule(x, config.Buckets)));
            config.StartingUrls.AddRange(element.Elements("StartingUrls").Elements().Select(DeserializeStartingUrl));
            return(config);
        }
Esempio n. 3
0
 public static CrawlingConfig Clone(CrawlingConfig config)
 {
     return(DeserializeConfiguration(SerializeConfiguration(config)));
 }