From 9e5cd91ede18789e43eee4393d4b69e7ae7a46e8 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 2 Feb 2019 13:49:23 +0000 Subject: Added function to download asynchronously, useful for server usage --- Aggregator/Parser/Download.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Aggregator') diff --git a/Aggregator/Parser/Download.cs b/Aggregator/Parser/Download.cs index 30a2881..c90dc0a 100644 --- a/Aggregator/Parser/Download.cs +++ b/Aggregator/Parser/Download.cs @@ -1,11 +1,18 @@ using System.Net; +using System.Threading.Tasks; namespace Parser { public static class Download { - public static string DownloadXML(string site) { + public static string DownloadXMLSync(string site) { using (var client = new WebClient()) { return client.DownloadString(site); } } + + public static Task DownloadXML(string site) { + using (var client = new WebClient()) { + return client.DownloadStringTaskAsync(site); + } + } } } -- cgit v1.2.3-13-gbd6f