diff options
author | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-04 00:09:04 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-04 00:09:04 +0000 |
commit | 2f2bdf7ea0f6ac23f39e0d867e93a90374cc21ae (patch) | |
tree | 65fc07f6c80083d1e4c14d9727cb722a75578670 /Aggregator/Parser/Parser.cs | |
parent | 47e8e85487d02bd3ce85d016eb251df48436b159 (diff) | |
download | newsaggregator-2f2bdf7ea0f6ac23f39e0d867e93a90374cc21ae.tar.gz newsaggregator-2f2bdf7ea0f6ac23f39e0d867e93a90374cc21ae.tar.bz2 newsaggregator-2f2bdf7ea0f6ac23f39e0d867e93a90374cc21ae.zip |
Finished ParseMultiple method
Diffstat (limited to 'Aggregator/Parser/Parser.cs')
-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 |