C# Класс Nexus.Client.Util.Downloader.FileDownloader

Downloads a file.
This downloader uses multiple connections to download the file. It also supports resuming interrupted downloads.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Cleanup ( ) : void

Cleans up the meta files used while downloading.

FileDownloader ( Uri p_uriURL, string>.Dictionary p_dicCookies, string p_strSavePath, bool p_booUseDefaultFileName, Int32 p_intMaxConnections, Int32 p_intMinBlockSize, string p_strUserAgent ) : System

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

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.

StartDownload ( ) : void

Starts the file download.

Stop ( ) : void

Stops the file download.

Защищенные методы

Метод Описание
GetMetadata ( ) : FileMetadata

Gets the file's metadata.

GetNextBlock ( ) : Range

Gets the next block in the file that needs to be downloaded.

OnDownloadComplete ( CompletedDownloadEventArgs e ) : void

Raises the DownloadComplete event.

A completed download does not mean the entire file has been downloaded; the download may have been interrupted.

OnDownloadComplete ( bool p_booGotEntireFile, string p_strSavedFileName ) : void

Raises the DownloadComplete event.

A completed download does not mean the entire file has been downloaded; the download may have been interrupted.

Приватные методы

Метод Описание
Downloader_FinishedDownloading ( object sender, EventArgs e ) : void

Handles the BlockDownloader.FinishedDownloading events of the BlockDownloaders being used.

This stops the file download once all the BlockDownloaders have finished.

Initialize ( string p_strSavePath, bool p_booUseDefaultFileName ) : void

Sets up the initial values of the downloader.

Описание методов

Cleanup() публичный Метод

Cleans up the meta files used while downloading.
public Cleanup ( ) : void
Результат void

FileDownloader() публичный Метод

A simple constructor that initializes the object with the given values.
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 FileDownloader ( Uri p_uriURL, string>.Dictionary p_dicCookies, string p_strSavePath, bool p_booUseDefaultFileName, Int32 p_intMaxConnections, Int32 p_intMinBlockSize, string p_strUserAgent ) : System
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.
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.
Результат System

GetMetadata() защищенный Метод

Gets the file's metadata.
protected GetMetadata ( ) : FileMetadata
Результат FileMetadata

GetNextBlock() защищенный Метод

Gets the next block in the file that needs to be downloaded.
protected GetNextBlock ( ) : Range
Результат Range

OnDownloadComplete() защищенный Метод

Raises the DownloadComplete event.
A completed download does not mean the entire file has been downloaded; the download may have been interrupted.
protected OnDownloadComplete ( CompletedDownloadEventArgs e ) : void
e CompletedDownloadEventArgs A describing the event arguments.
Результат void

OnDownloadComplete() защищенный Метод

Raises the DownloadComplete event.
A completed download does not mean the entire file has been downloaded; the download may have been interrupted.
protected OnDownloadComplete ( bool p_booGotEntireFile, string p_strSavedFileName ) : void
p_booGotEntireFile bool Whether the entire file has been downloaded.
p_strSavedFileName string The path to the downloaded file.
Результат void

StartDownload() публичный Метод

Starts the file download.
public StartDownload ( ) : void
Результат void

Stop() публичный Метод

Stops the file download.
public Stop ( ) : void
Результат void