C# Класс BiliRanking.Core.Download.HttpDownloadClient

Наследование: IDownloader
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
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.

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

Метод Описание
OnDownloadCompleted ( DownloadCompletedEventArgs e ) : void

The method will be called by the OnStatusChanged method.

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

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

Метод Описание
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.

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

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

Start to download using ThreadPool.
public BeginDownload ( ) : void
Результат void

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

Resume the download using ThreadPool.
public BeginResume ( ) : void
Результат void

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

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

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

Check the Uri to find its size, and whether it supports "Pause".
public CheckUrl ( string &fileName ) : void
fileName string
Результат void

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

Start to download.
public Download ( ) : void
Результат void

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

Download the whole file.
public HttpDownloadClient ( string url ) : System
url string
Результат System

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

Download the file from a start point to the end.
public HttpDownloadClient ( string url, long startPoint ) : System
url string
startPoint long
Результат System

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

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
Результат System

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

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
Результат System

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

The method will be called by the OnStatusChanged method.
protected OnDownloadCompleted ( DownloadCompletedEventArgs e ) : void
e DownloadCompletedEventArgs
Результат void

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

protected OnDownloadProgressChanged ( DownloadProgressChangedEventArgs e ) : void
e DownloadProgressChangedEventArgs
Результат void

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

protected OnStatusChanged ( EventArgs e ) : void
e System.EventArgs
Результат void

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

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

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

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