C# Class Nexus.Client.DownloadManagement.FileDownloadTask

Downloads a file.
Inheritance: BackgroundTask, IDisposable
Datei anzeigen Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Public Methods

Method Description
Cancel ( ) : void

Cancels the task.

Dispose ( ) : void

Halts the file download.

After being disposed, that is no guarantee that the task's status will be correct. Further interaction with the object is undefined.

Download ( Uri p_uriURL, string>.Dictionary p_dicCookies, string p_strSavePath, bool p_booUseDefaultFileName ) : void

Downloads the speificed file to the specified location.

This method starts the download, and waits for it to end. If the given p_strSavePath already exists, an attempt will be made to resume the download. If the pre-existing file is not a partial download, or the download cannot be resumed, the file will be overwritten.

DownloadAsync ( List p_uriURL, string>.Dictionary p_dicCookies, string p_strSavePath, bool p_booUseDefaultFileName ) : void

Downloads the speificed file to the specified location.

This method starts the download and returns. If the given p_strSavePath already exists, an attempt will be made to resume the download. If the pre-existing file is not a partial download, or the download cannot be resumed, the file will be overwritten.

DownloadAsync ( Uri p_uriURL, string>.Dictionary p_dicCookies, string p_strSavePath, bool p_booUseDefaultFileName ) : void

Downloads the speificed file to the specified location.

This method starts the download and returns. If the given p_strSavePath already exists, an attempt will be made to resume the download. If the pre-existing file is not a partial download, or the download cannot be resumed, the file will be overwritten.

FileDownloadTask ( IModRepository p_mmrModRepository, Int32 p_intMaxConnections, Int32 p_intMinBlockSize, string p_strUserAgent ) : System

A simple constructor that initializes the object with the given values.

Pause ( ) : void

Pauses the task.

Queue ( ) : void

Queues the task.

Resume ( ) : void

Resumes the task.

Private Methods

Method Description
Downloader_DownloadComplete ( object sender, CompletedDownloadEventArgs e ) : void

Handles the FileDownloader.DownloadComplete event of the file downloader.

This stops the updating of the progress properties.

Updater_Elapsed ( object sender, System.Timers.ElapsedEventArgs e ) : void

Handles the System.Timers.Timer.Elapsed event of the time that controls the updating of the progress properties.

This updates the progress properties.

Method Details

Cancel() public method

Cancels the task.
public Cancel ( ) : void
return void

Dispose() public method

Halts the file download.
After being disposed, that is no guarantee that the task's status will be correct. Further interaction with the object is undefined.
public Dispose ( ) : void
return void

Download() public method

Downloads the speificed file to the specified location.
This method starts the download, and waits for it to end. If the given p_strSavePath already exists, an attempt will be made to resume the download. If the pre-existing file is not a partial download, or the download cannot be resumed, the file will be overwritten.
public Download ( Uri p_uriURL, string>.Dictionary p_dicCookies, string p_strSavePath, bool p_booUseDefaultFileName ) : void
p_uriURL System.Uri The URL of the file to download.
p_dicCookies string>.Dictionary A list of cookies that should be sent in the request to download the file.
p_strSavePath string The path to which to save the file. /// If is false, this value should be a complete /// path, including filename. If is true, /// this value should be the directory in which to save the file.
p_booUseDefaultFileName bool Whether to use the file name suggested by the server.
return void

DownloadAsync() public method

Downloads the speificed file to the specified location.
This method starts the download and returns. If the given p_strSavePath already exists, an attempt will be made to resume the download. If the pre-existing file is not a partial download, or the download cannot be resumed, the file will be overwritten.
public DownloadAsync ( List p_uriURL, string>.Dictionary p_dicCookies, string p_strSavePath, bool p_booUseDefaultFileName ) : void
p_uriURL List The URL list of the file to download.
p_dicCookies string>.Dictionary A list of cookies that should be sent in the request to download the file.
p_strSavePath string The path to which to save the file. /// If is false, this value should be a complete /// path, including filename. If is true, /// this value should be the directory in which to save the file.
p_booUseDefaultFileName bool Whether to use the file name suggested by the server.
return void

DownloadAsync() public method

Downloads the speificed file to the specified location.
This method starts the download and returns. If the given p_strSavePath already exists, an attempt will be made to resume the download. If the pre-existing file is not a partial download, or the download cannot be resumed, the file will be overwritten.
public DownloadAsync ( Uri p_uriURL, string>.Dictionary p_dicCookies, string p_strSavePath, bool p_booUseDefaultFileName ) : void
p_uriURL System.Uri The URL of the file to download.
p_dicCookies string>.Dictionary A list of cookies that should be sent in the request to download the file.
p_strSavePath string The path to which to save the file. /// If is false, this value should be a complete /// path, including filename. If is true, /// this value should be the directory in which to save the file.
p_booUseDefaultFileName bool Whether to use the file name suggested by the server.
return void

FileDownloadTask() public method

A simple constructor that initializes the object with the given values.
public FileDownloadTask ( IModRepository p_mmrModRepository, Int32 p_intMaxConnections, Int32 p_intMinBlockSize, string p_strUserAgent ) : System
p_mmrModRepository IModRepository
p_intMaxConnections System.Int32 The maximum number of connections to use to download the file.
p_intMinBlockSize System.Int32 The minimum block size that should be downloaded at once. This should /// ideally be some mulitple of the available bandwidth.
p_strUserAgent string The current User Agent.
return System

Pause() public method

Pauses the task.
Thrown if the task does not support pausing.
public Pause ( ) : void
return void

Queue() public method

Queues the task.
Thrown if the task does not support queuing.
public Queue ( ) : void
return void

Resume() public method

Resumes the task.
Thrown if the task is not paused.
public Resume ( ) : void
return void