Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        private static void RunDownloadSync()
        {
            var websites = PrepareData();

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