diff options
Diffstat (limited to 'Aggregator/Parser')
-rw-r--r-- | Aggregator/Parser/Parser.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Aggregator/Parser/Parser.cs b/Aggregator/Parser/Parser.cs index c9ad038..9e91a77 100644 --- a/Aggregator/Parser/Parser.cs +++ b/Aggregator/Parser/Parser.cs @@ -17,10 +17,14 @@ namespace Aggregator.Parser { ArticleLink = article[config.ArticleLink].Value, ImageLink = article[config.ImageLink].Attribute("url").Value, PublishDate = DateTime.Parse(article[config.PublishDate].Value) - }).Distinct().ToArray(); + }).Distinct(); } - public static IEnumerable<IEnumerable<Article>> ParseMultiple(string xmls) { - + public static IEnumerable<Article> ParseMultiple(string[] xmls, List<Config> configs) { + if (configs.Count == 0 || xmls.Length == 0 || (xmls.Length != configs.Count)) { + return null; + } else { + return xmls.Select((xml, index) => Parse(xml, configs[index])).SelectMany(i => i); + } } } }
\ No newline at end of file |