C# Class BiliRanking.Core.Download.MultiThreadedWebDownloader

Inheritance: IDownloader
Exibir arquivo Open project: SkiTiSu/BiliRanking

Public Methods

Method 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.

Protected Methods

Method 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

Method 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 method

Start to download.
public BeginDownload ( ) : void
return void

BeginResume() public method

Resume the download.
public BeginResume ( ) : void
return void

Cancel() public method

Cancel the download
public Cancel ( ) : void
return void

CheckUrl() public method

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

CheckUrlAndFile() public method

public CheckUrlAndFile ( string &fileName ) : void
fileName string
return void

Download() public method

Start to download.
public Download ( ) : void
return void

MultiThreadedWebDownloader() public method

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
return System

MultiThreadedWebDownloader() public method

public MultiThreadedWebDownloader ( string url, int bufferSize, int cacheSize, int bufferCountPerNotification, int maxThreadCount ) : System
url string
bufferSize int
cacheSize int
bufferCountPerNotification int
maxThreadCount int
return System

OnDownloadCompleted() protected method

Raise DownloadCompleted event.
protected OnDownloadCompleted ( DownloadCompletedEventArgs e ) : void
e DownloadCompletedEventArgs
return void

OnDownloadProgressChanged() protected method

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

OnStatusChanged() protected method

Raise StatusChanged event.
protected OnStatusChanged ( EventArgs e ) : void
e System.EventArgs
return void

Pause() public method

Pause the download.
public Pause ( ) : void
return void

Resume() public method

Resume the download.
public Resume ( ) : void
return void