コード例 #1
0
 public bool Download(string fileName, string destination)
 {
     if (!_parent.IsConnected())
     {
         return(false);
     }
     try
     {
         using (var client = new WebClient())
         {
             var credentials = _parent.GetCredentials();
             if (credentials != null)
             {
                 client.Credentials = credentials;
             }
             client.DownloadFile(_parent.GetDownloadPath(fileName), destination);
         }
         _parent.Log("DOWNLOAD : " + fileName);
         return(true);
     }
     catch (WebException e)
     {
         _parent.Log("ERROR - DOWNLOAD : " + _parent.GetDownloadPath(fileName) + " " + e.Message);
     }
     return(false);
 }