Exemple #1
0
        public void RunDownloadSync()
        {
            List <string> websites = Ultility.PrepData();

            foreach (var site in websites)
            {
                WebsiteDataModel result = Ultility.DownloadWebsite(site);
                result.Report();
            }
        }
        public string RunDownloadSync()
        {
            List <string> websites = Ultility.PrepData();

            foreach (var site in websites)
            {
                WebsiteDataModel result = Ultility.DownloadWebsite(site);
                result.Report();
            }
            return($"RunDownloadSync - Done - Thread {Thread.CurrentThread.ManagedThreadId}");
        }
Exemple #3
0
        public static WebsiteDataModel DownloadWebsite(string websiteURL)
        {
            WebsiteDataModel output = new WebsiteDataModel();
            WebClient        client = new WebClient();

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

            Console.WriteLine($"Getting {websiteURL} - Thread {Thread.CurrentThread.ManagedThreadId}");
            return(output);
        }
Exemple #4
0
        public string RunDownload()
        {
            List <string> websites = Ultility.PrepData();

            foreach (var site in websites)
            {
                WebsiteDataModel result = new WebsiteDataModel();
                Thread           thread = new Thread(() => { result = Ultility.DownloadWebsite(site); });
                thread.Start();
                //thread.Join();
                result.Report();
            }
            return($"RunDownloadSync - Done - Thread {Thread.CurrentThread.ManagedThreadId}");
        }