Esempio n. 1
0
 private static void DownloadFile(string input, string[] data)
 {
     try
     {
         if (data.Length == 2)
         {
             string    remoteAddress = data[1];
             string    fileName      = Path.GetFileName(remoteAddress);
             WebClient myWebClient   = new WebClient();
             myWebClient.DownloadFile(remoteAddress, fileName);
             string path = AppDomain.CurrentDomain.BaseDirectory;
             OutputWriter.DisplayNotification($"The file was downloaded here: {path}");
         }
         else
         {
             DisplayInvalidCommandMessage(input);
         }
     }
     catch (WebException)
     {
         OutputWriter.DisplayException(ExceptionMessages.ForbiddenSymbolsInURL);
     }
 }