Exemplo n.º 1
0
		public static bool DownloadAccessFile(ConsoleX consoleX)
		{
			bool fileDownloaded = false;
			do
			{
				var url = consoleX.WriteClipboardQuery("CORRECT URL");
				url = url.Trim(); // Remove any whitespace that may have been copied by mistake.
				
				if(!AccessFileDownloader.IsUrlCorrect(url))
				{
					consoleX.WriteLine("Sorry, incorrect URL. Please try again.");
				}
				else
				{
					try
					{
						consoleX.WriteLine("Thanks! Downloading file now. Please wait...");
						AccessFileDownloader.DownloadFile(url);
						consoleX.WriteLine("OK, Done.");
						fileDownloaded = true;
					}
					catch(Exception ex)
					{
						ExceptionHelper.HandleException(ex, consoleX);
					}
				}
			}
			while(!fileDownloaded);
			
			return fileDownloaded;
		}