Downloads a file.
Inheritance: BackgroundTask, IDisposable
Ejemplo n.º 1
0
		/// <summary>
		/// Downloads the given files.
		/// </summary>
		/// <param name="p_lstFiles">The files to download.</param>
		protected void DownloadFiles(List<Uri> p_lstFiles, bool p_booQueued)
		{
			Trace.TraceInformation(String.Format("[{0}] Downloading Files.", Descriptor.SourceUri.ToString()));
			Trace.TraceInformation(String.Format("[{0}] Launching downloading of {1}.", Descriptor.SourceUri.ToString(), p_lstFiles[0].ToString()));
			Dictionary<string, string> dicAuthenticationTokens = m_eifEnvironmentInfo.Settings.RepositoryAuthenticationTokens[m_mrpModRepository.Id];
			Int32 intConnections = m_eifEnvironmentInfo.Settings.UseMultithreadedDownloads ? m_mrpModRepository.AllowedConnections : 1;

			FileDownloadTask fdtDownloader = new FileDownloadTask(m_mrpModRepository, intConnections, 1024 * 500, m_mrpModRepository.UserAgent);
			fdtDownloader.TaskEnded += new EventHandler<TaskEndedEventArgs>(Downloader_TaskEnded);
			fdtDownloader.PropertyChanged += new PropertyChangedEventHandler(Downloader_PropertyChanged);

			m_lstRunningTasks.Add(fdtDownloader);
			fdtDownloader.DownloadAsync(p_lstFiles, dicAuthenticationTokens, Path.GetDirectoryName(Descriptor.DefaultSourcePath), true);
		}
Ejemplo n.º 2
0
			/// <summary>
			/// A simple constructor that initializes teh object with the given values.
			/// </summary>
			/// <param name="p_fdtTask">The download task for which to store the progress state.</param>
			public DownloadProgressState(FileDownloadTask p_fdtTask)
			{
				Update(p_fdtTask);
			}
Ejemplo n.º 3
0
			/// <summary>
			/// Updates the stored state to reflect the current progress of the given download.
			/// </summary>
			/// <param name="p_fdtTask">The download task for which to store the progress state.</param>
			public void Update(FileDownloadTask p_fdtTask)
			{
				OverallProgress = p_fdtTask.OverallProgress;
				OverallProgressMinimum = p_fdtTask.OverallProgressMinimum;
				OverallProgressMaximum = p_fdtTask.OverallProgressMaximum;
				DownloadSpeed = p_fdtTask.DownloadSpeed;
				TimeRemaining = p_fdtTask.TimeRemaining;
			}