public bool DownloadInstaller(string customerName, string installerName)
        {
            try
            {
                _fileDownLoader.DownloadFile(
                    string.Format("http://example.com/{0}/{1}",
                                  customerName,
                                  installerName),
                    _setupDestinationFile);

                return(true);
            }
            catch (WebException)
            {
                return(false);
            }

            //var client = new WebClient();
            //try
            //{
            //    client.DownloadFile(
            //       string.Format("http://example.com/{0}/{1}",
            //           customerName,
            //           installerName),
            //        _setupDestinationFile);

            //    return true;
            //}
            //catch (WebException)
            //{
            //    return false;
            //}
        }
示例#2
0
 public bool DownloadInstaller(string customerName, string installerName)
 {
     try
     {
         _fileDownloader.DownloadFile(string.Format("http://example.com/{0}/{1}", customerName, installerName), _setupDestionationFile);
         return(true);
     }
     catch (WebException)
     {
         return(false);
     }
 }
示例#3
0
        public bool DownloadInstaller(string customerName, string installerName)
        {
            try
            {
                _fileDownloader.DownloadFile($"https://example.com/{customerName}/{installerName}", _setupDestinationFile);

                return(true);
            }
            catch (WebException)
            {
                return(false);
            }
        }
示例#4
0
        public bool DownloadInstaller(string customerName, string installerName)
        {
            var client = new WebClient();

            try
            {
                var url = string.Format("http://example.com/{0}/{1}", customerName, installerName);
                _fileDownloader.DownloadFile(url, _setupDestinationFile);
                return(true);
            }
            catch (WebException)
            {
                return(false);
            }
        }
示例#5
0
        public bool DownloadInstaller(string customerName, string installerName)
        {
            const string baseURL = "http://example.com";

            try
            {
                _fileDownloader.DownloadFile(
                    string.Format("{0}/{1}/{2}",
                                  baseURL,
                                  customerName,
                                  installerName),
                    _setupDestinationFile);

                return(true);
            }
            // Only catch possible expected exceptions
            // Other exceptions should propogate into a global exception tracker
            catch (WebException)
            {
                // Log stuff
                return(false);
            }
        }