C# Class FileDownloaderApp.FileDownloader

Class for downloading files in the background that supports info about their progress, the total progress, cancellation, pausing, and resuming. The downloads will run on a separate thread so you don't have to worry about multihreading yourself.
Class FileDownloader v1.0.2, by De Dauw Jeroen - April 2009
Inheritance: System.Object, IDisposable
Afficher le fichier Open project: polserver/poltools Class Usage Examples

Méthodes publiques

Méthode Description
CurrentFilePercentage ( ) : Double

Gets the percentage of the current file progress

CurrentFilePercentage ( Int32 decimals ) : Double

Gets the percentage of the current file progress

Dispose ( ) : void
FileDownloader ( ) : System

Create a new instance of a FileDownloader

FileDownloader ( System.Boolean supportsProgress ) : System

Create a new instance of a FileDownloader

FormatSizeBinary ( System.Int64 size ) : string

Format an amount of bytes to a more readible notation with binary notation symbols

FormatSizeBinary ( System.Int64 size, Int32 decimals ) : string

Format an amount of bytes to a more readible notation with binary notation symbols

FormatSizeDecimal ( System.Int64 size ) : string

Format an amount of bytes to a more readible notation with decimal notation symbols

FormatSizeDecimal ( System.Int64 size, Int32 decimals ) : string

Format an amount of bytes to a more readible notation with decimal notation symbols

Pause ( ) : void
Resume ( ) : void
Start ( ) : void
Stop ( ) : void
Stop ( System.Boolean deleteCompletedFiles ) : void
TotalPercentage ( ) : Double

Gets the total download percentage. Only avaible when the FileDownloader suports progress

TotalPercentage ( Int32 decimals ) : Double

Gets the total download percentage. Only avaible when the FileDownloader suports progress

Méthodes protégées

Méthode Description
Dispose ( System.Boolean disposing ) : void

Private Methods

Méthode Description
bgwDownloader_DoWork ( object sender, DoWorkEventArgs e ) : void
bgwDownloader_ProgressChanged ( object sender, ProgressChangedEventArgs e ) : void
bgwDownloader_RunWorkerCompleted ( object sender, RunWorkerCompletedEventArgs e ) : void
calculateFilesSize ( ) : void
cleanUpFiles ( Int32 start, Int32 length ) : void
downloadFile ( Int32 fileNr ) : void
fireEventFromBgw ( Event eventName ) : void
initizalize ( System.Boolean supportsProgress ) : void

Method Details

CurrentFilePercentage() public méthode

Gets the percentage of the current file progress
public CurrentFilePercentage ( ) : Double
Résultat Double

CurrentFilePercentage() public méthode

Gets the percentage of the current file progress
public CurrentFilePercentage ( Int32 decimals ) : Double
decimals System.Int32
Résultat Double

Dispose() public méthode

public Dispose ( ) : void
Résultat void

Dispose() protected méthode

protected Dispose ( System.Boolean disposing ) : void
disposing System.Boolean
Résultat void

FileDownloader() public méthode

Create a new instance of a FileDownloader
public FileDownloader ( ) : System
Résultat System

FileDownloader() public méthode

Create a new instance of a FileDownloader
public FileDownloader ( System.Boolean supportsProgress ) : System
supportsProgress System.Boolean Optional. Boolean. Should the FileDownloader support total progress statistics?
Résultat System

FormatSizeBinary() public static méthode

Format an amount of bytes to a more readible notation with binary notation symbols
public static FormatSizeBinary ( System.Int64 size ) : string
size System.Int64 Required. Int64. The raw amount of bytes
Résultat string

FormatSizeBinary() public static méthode

Format an amount of bytes to a more readible notation with binary notation symbols
public static FormatSizeBinary ( System.Int64 size, Int32 decimals ) : string
size System.Int64 Required. Int64. The raw amount of bytes
decimals System.Int32 Optional. Int32. The amount of decimals you want to have displayed in the notation
Résultat string

FormatSizeDecimal() public static méthode

Format an amount of bytes to a more readible notation with decimal notation symbols
public static FormatSizeDecimal ( System.Int64 size ) : string
size System.Int64 Required. Int64. The raw amount of bytes
Résultat string

FormatSizeDecimal() public static méthode

Format an amount of bytes to a more readible notation with decimal notation symbols
public static FormatSizeDecimal ( System.Int64 size, Int32 decimals ) : string
size System.Int64 Required. Int64. The raw amount of bytes
decimals System.Int32 Optional. Int32. The amount of decimals you want to have displayed in the notation
Résultat string

Pause() public méthode

public Pause ( ) : void
Résultat void

Resume() public méthode

public Resume ( ) : void
Résultat void

Start() public méthode

public Start ( ) : void
Résultat void

Stop() public méthode

public Stop ( ) : void
Résultat void

Stop() public méthode

public Stop ( System.Boolean deleteCompletedFiles ) : void
deleteCompletedFiles System.Boolean
Résultat void

TotalPercentage() public méthode

Gets the total download percentage. Only avaible when the FileDownloader suports progress
public TotalPercentage ( ) : Double
Résultat Double

TotalPercentage() public méthode

Gets the total download percentage. Only avaible when the FileDownloader suports progress
public TotalPercentage ( Int32 decimals ) : Double
decimals System.Int32
Résultat Double