C# Class BiliRanking.Core.Download.MultiThreadedWebDownloader

Inheritance: IDownloader
Afficher le fichier Open project: SkiTiSu/BiliRanking

Méthodes publiques

Méthode Description
BeginDownload ( ) : void

Start to download.

BeginResume ( ) : void

Resume the download.

Cancel ( ) : void

Cancel the download

CheckUrl ( string &fileName ) : void

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

CheckUrlAndFile ( string &fileName ) : void
Download ( ) : void

Start to download.

MultiThreadedWebDownloader ( string url ) : System

Download the whole file. The default buffer size is 1KB, memory cache is 1MB, buffer count per notification is 64, threads count is the double of logic processors count.

MultiThreadedWebDownloader ( string url, int bufferSize, int cacheSize, int bufferCountPerNotification, int maxThreadCount ) : System
Pause ( ) : void

Pause the download.

Resume ( ) : void

Resume the download.

Méthodes protégées

Méthode Description
OnDownloadCompleted ( DownloadCompletedEventArgs e ) : void

Raise DownloadCompleted event.

OnDownloadProgressChanged ( DownloadProgressChangedEventArgs e ) : void

Raise DownloadProgressChanged event. If the status is Completed, then raise DownloadCompleted event.

OnStatusChanged ( EventArgs e ) : void

Raise StatusChanged event.

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.

DownloadInternal ( object obj ) : void
EnsurePropertyValid ( ) : void
client_DownloadCompleted ( object sender, DownloadCompletedEventArgs e ) : void

Handle the DownloadCompleted event of all the HttpDownloadClients.

client_DownloadProgressChanged ( object sender, DownloadProgressChangedEventArgs e ) : void

Handle the DownloadProgressChanged event of all the HttpDownloadClients, and calculate the download speed.

client_StatusChanged ( object sender, EventArgs e ) : void

Handle the StatusChanged event of all the HttpDownloadClients.

Method Details

BeginDownload() public méthode

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

BeginResume() public méthode

Resume the download.
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

CheckUrlAndFile() public méthode

public CheckUrlAndFile ( string &fileName ) : void
fileName string
Résultat void

Download() public méthode

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

MultiThreadedWebDownloader() public méthode

Download the whole file. The default buffer size is 1KB, memory cache is 1MB, buffer count per notification is 64, threads count is the double of logic processors count.
public MultiThreadedWebDownloader ( string url ) : System
url string
Résultat System

MultiThreadedWebDownloader() public méthode

public MultiThreadedWebDownloader ( string url, int bufferSize, int cacheSize, int bufferCountPerNotification, int maxThreadCount ) : System
url string
bufferSize int
cacheSize int
bufferCountPerNotification int
maxThreadCount int
Résultat System

OnDownloadCompleted() protected méthode

Raise DownloadCompleted event.
protected OnDownloadCompleted ( DownloadCompletedEventArgs e ) : void
e DownloadCompletedEventArgs
Résultat void

OnDownloadProgressChanged() protected méthode

Raise DownloadProgressChanged event. If the status is Completed, then raise DownloadCompleted event.
protected OnDownloadProgressChanged ( DownloadProgressChangedEventArgs e ) : void
e DownloadProgressChangedEventArgs
Résultat void

OnStatusChanged() protected méthode

Raise StatusChanged event.
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