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

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

Public Methods

Method 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

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

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

Start() public method

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

Stop() public method

Instructs the downloader to stop.
public Stop ( ) : void
return void