C# Class Nexus.Client.Util.Downloader.FileDownloader.BlockDownloader

Downloads pieces of a file until the entire file is downloaded, or instructed to stop.
Afficher le fichier Open project: NexusMods/NexusModManager-4.5

Méthodes publiques

Méthode Description
BlockDownloader ( FileDownloader p_fdrFileDownloader, FileMetadata p_fmdInfo, FileWriter p_fwrWriter, Int32 p_intBufferSize, string p_strUserAgent ) : System

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

Start ( ) : void

Starts the file download.

After a block has finished downloading, a new block will be requested for download. this will continue until no blocks are left, or told to stop.

Stop ( ) : void

Instructs the downloader to stop.

Private Methods

Méthode Description
DoStart ( ) : void

This method gets the next block to download, and downloads it. This loops until there are no more blocks, or we are told to stop.

This method is run on a thread.

DownloadBlock ( Range p_rngBlockToDownload ) : void

Downloads the specified block.

FileWriter_UnableToWrite ( object sender, EventArgs e ) : void

Handles the FileWriter.UnableToWrite events of the FileWriters being used.

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

Method Details

BlockDownloader() public méthode

A simple constructor that initializes the object with the given values.
public BlockDownloader ( FileDownloader p_fdrFileDownloader, FileMetadata p_fmdInfo, FileWriter p_fwrWriter, Int32 p_intBufferSize, string p_strUserAgent ) : System
p_fdrFileDownloader FileDownloader The from which to retrieve the block this /// downloader will download.
p_fmdInfo FileMetadata The metadata of the to be downloaded.
p_fwrWriter FileWriter The writer to use to write the file to the disk.
p_intBufferSize System.Int32 The size of the buffer to send to the file writer.
p_strUserAgent string The current User Agent.
Résultat System

Start() public méthode

Starts the file download.
After a block has finished downloading, a new block will be requested for download. this will continue until no blocks are left, or told to stop.
public Start ( ) : void
Résultat void

Stop() public méthode

Instructs the downloader to stop.
public Stop ( ) : void
Résultat void