C# Class BiliRanking.Core.Download.HttpDownloadClient

Inheritance: IDownloader
Afficher le fichier Open project: SkiTiSu/BiliRanking Class Usage Examples

Méthodes publiques

Méthode Description
BeginDownload ( ) : void

Start to download using ThreadPool.

BeginResume ( ) : void

Resume the download using ThreadPool.

Cancel ( ) : void

Cancel the download.

CheckUrl ( string &fileName ) : void

Check the Uri to find its size, and whether it supports "Pause".

Download ( ) : void

Start to download.

HttpDownloadClient ( string url ) : System

Download the whole file.

HttpDownloadClient ( string url, long startPoint ) : System

Download the file from a start point to the end.

HttpDownloadClient ( string url, long startPoint, long endPoint ) : System

Download a block of the file. The default buffer size is 1KB, memory cache is 1MB, and buffer count per notification is 64.

HttpDownloadClient ( string url, long startPoint, long endPoint, int bufferSize, int cacheSize, int bufferCountPerNotification ) : System
Pause ( ) : void

Pause the download.

Resume ( ) : void

Resume the download.

Méthodes protégées

Méthode Description
OnDownloadCompleted ( DownloadCompletedEventArgs e ) : void

The method will be called by the OnStatusChanged method.

OnDownloadProgressChanged ( DownloadProgressChangedEventArgs e ) : void
OnStatusChanged ( EventArgs e ) : void

Private Methods

Méthode Description
CheckFileOrCreateFile ( ) : void

Check whether the destination file exists. If not, create a file with the same size as the file to be downloaded.

CheckUrlAndFile ( string &fileName ) : void
DownloadInternal ( object obj ) : void

Download the data using HttpWebRequest. It will read a buffer of bytes from the response stream, and store the buffer to a MemoryStream cache first. If the cache is full, or the download is paused, canceled or completed, write the data in cache to local file.

EnsurePropertyValid ( ) : void
InternalDownloadProgressChanged ( int cachedSize ) : void

Calculate the download speed and fire the DownloadProgressChanged event.

WriteCacheToFile ( MemoryStream downloadCache, int cachedSize ) : void

Write the data in cache to local file.

Method Details

BeginDownload() public méthode

Start to download using ThreadPool.
public BeginDownload ( ) : void
Résultat void

BeginResume() public méthode

Resume the download using ThreadPool.
public BeginResume ( ) : void
Résultat void

Cancel() public méthode

Cancel the download.
public Cancel ( ) : void
Résultat void

CheckUrl() public méthode

Check the Uri to find its size, and whether it supports "Pause".
public CheckUrl ( string &fileName ) : void
fileName string
Résultat void

Download() public méthode

Start to download.
public Download ( ) : void
Résultat void

HttpDownloadClient() public méthode

Download the whole file.
public HttpDownloadClient ( string url ) : System
url string
Résultat System

HttpDownloadClient() public méthode

Download the file from a start point to the end.
public HttpDownloadClient ( string url, long startPoint ) : System
url string
startPoint long
Résultat System

HttpDownloadClient() public méthode

Download a block of the file. The default buffer size is 1KB, memory cache is 1MB, and buffer count per notification is 64.
public HttpDownloadClient ( string url, long startPoint, long endPoint ) : System
url string
startPoint long
endPoint long
Résultat System

HttpDownloadClient() public méthode

public HttpDownloadClient ( string url, long startPoint, long endPoint, int bufferSize, int cacheSize, int bufferCountPerNotification ) : System
url string
startPoint long
endPoint long
bufferSize int
cacheSize int
bufferCountPerNotification int
Résultat System

OnDownloadCompleted() protected méthode

The method will be called by the OnStatusChanged method.
protected OnDownloadCompleted ( DownloadCompletedEventArgs e ) : void
e DownloadCompletedEventArgs
Résultat void

OnDownloadProgressChanged() protected méthode

protected OnDownloadProgressChanged ( DownloadProgressChangedEventArgs e ) : void
e DownloadProgressChangedEventArgs
Résultat void

OnStatusChanged() protected méthode

protected OnStatusChanged ( EventArgs e ) : void
e System.EventArgs
Résultat void

Pause() public méthode

Pause the download.
public Pause ( ) : void
Résultat void

Resume() public méthode

Resume the download.
public Resume ( ) : void
Résultat void