Example #1
0
        private static WebsiteDataModel DownloadWebsite(string site)
        {
            var output = new WebsiteDataModel();
            var client = new WebClient();

            output.WebsiteUrl  = site;
            output.WebsiteData = client.DownloadString(site);

            return(output);
        }
Example #2
0
        private static async Task <WebsiteDataModel> DownloadWebsiteAsync(string site)
        {
            var output = new WebsiteDataModel();
            var client = new WebClient();

            output.WebsiteUrl  = site;
            output.WebsiteData = await client.DownloadStringTaskAsync(site);

            return(output);
        }
Example #3
0
        private static void RunDownloadSync()
        {
            var websites = PrepareData();

            foreach (var site in websites)
            {
                WebsiteDataModel results = DownloadWebsite(site);
                ReportwebsiteInfo(results);
            }
        }
Example #4
0
 private static void ReportwebsiteInfo(WebsiteDataModel data)
 {
     WriteLine($"{data.WebsiteUrl} downloaded: {data.WebsiteData.Length} characters long.");
 }