C# Class SDownload.Framework.Streams.BaseStream

Base stream that defines the flow the program follows for downloading a stream. This class can be overridden to provide specific functionality for a certain type of stream.
Mostra file Open project: brkastner/SDownload

Protected Properties

Property Type Description
Extras List
MainResource DownloadItem
View InfoReportProxy

Public Methods

Method Description
Download ( bool ignoreExtras = false ) : Task

Downloads the Sound representation and any extra files that accompany it If true, extra files will not be downloaded. (Useful for retrying the main download) A boolean value representing if the download was successful or not

Finish ( bool close = true ) : bool

Called once the whole process is finished. Clears any log data and closes the connection to the view. If this method is overridden, base.Finish() should be called AT THE END of the function.

Validate ( ) : Task

Validates the download. The base stream does not do any validation.

Protected Methods

Method Description
BaseStream ( String url, InfoReportProxy view ) : System

Creates a base stream that downloads from a remote url

GenerateRandomString ( int size ) : String

Generate a random string of a given length

GetCleanFileName ( string value ) : string

Get the clean filename for a title

Private Methods

Method Description
DownloadExtra ( DownloadItem item ) : System.Threading.Tasks.Task

Asynchronous method for downloading an item that does not track progress

Method Details

BaseStream() protected method

Creates a base stream that downloads from a remote url
protected BaseStream ( String url, InfoReportProxy view ) : System
url String The url to process
view InfoReportProxy The view to report information back to
return System

Download() public method

Downloads the Sound representation and any extra files that accompany it If true, extra files will not be downloaded. (Useful for retrying the main download) A boolean value representing if the download was successful or not
public Download ( bool ignoreExtras = false ) : Task
ignoreExtras bool
return Task

Finish() public method

Called once the whole process is finished. Clears any log data and closes the connection to the view. If this method is overridden, base.Finish() should be called AT THE END of the function.
public Finish ( bool close = true ) : bool
close bool
return bool

GenerateRandomString() protected static method

Generate a random string of a given length
protected static GenerateRandomString ( int size ) : String
size int Length of the string
return String

GetCleanFileName() protected static method

Get the clean filename for a title
protected static GetCleanFileName ( string value ) : string
value string The title of the song
return string

Validate() public method

Validates the download. The base stream does not do any validation.
public Validate ( ) : Task
return Task

Property Details

Extras protected_oe property

A list of extras that need to be downloaded with the main resource
protected List Extras
return List

MainResource protected_oe property

The main resource that needs to be downloaded
protected DownloadItem MainResource
return DownloadItem

View protected_oe property

The view to report progress back to
protected InfoReportProxy View
return InfoReportProxy