Example #1
0
        public string actionGet(string[] args)
        {
            string         result     = string.Empty;
            IWebDownloader downloader = new WebDownloader();
            string         webpage    = downloader.download(args [2]);

            if (args.Length >= 4 && args [3] == "-save")
            {
                saveInFile(webpage, args[4]);
            }
            else
            {
                result = webpage;
            }

            return(result);
        }
Example #2
0
        public string getURLMultipleTime(string url, string multiple)
        {
            Stopwatch      timer      = new Stopwatch();
            IWebDownloader downloader = new WebDownloader();
            string         result     = string.Empty;
            int            nb         = 0;
            TimeSpan       compteur   = new TimeSpan();

            while (nb < Int32.Parse(multiple))
            {
                timer.Start();
                downloader.download(url);
                timer.Stop();

                TimeSpan ts = timer.Elapsed;

                result   += ts + Environment.NewLine;
                compteur += ts;
                timer.Reset();
                nb++;
            }

            return(result);
        }