Daniel's XL Toolbox NG
Bovender.Versioning.Updater Class Referenceabstract

Fetches version information from the internet and raises an UpdateAvailable event if a new version is available for download. More...

Inheritance diagram for Bovender.Versioning.Updater:

Public Member Functions

void CheckForUpdate ()
 Downloads the current version information file asynchronously from the project home page. More...
 
void CancelCheckForUpdate ()
 
void DownloadUpdate ()
 Downloads the current release from the internet. More...
 
void CancelDownload ()
 
void InstallUpdate ()
 Verifies the Sha1 checksum of the file on disk again and executes the file if it is valid. Does nothing if no update is available. More...
 
void CheckForUpdate ()
 Downloads the current version information file asynchronously from the project home page. More...
 
void CancelCheckForUpdate ()
 
void DownloadUpdate ()
 Downloads the current release from the internet. More...
 
void CancelDownload ()
 
void InstallUpdate ()
 Verifies the Sha1 checksum of the file on disk again and executes the file if it is valid. Does nothing if no update is available. More...
 

Protected Member Functions

abstract Uri GetVersionInfoUri ()
 Returns the URI for the file that provides current version information. More...
 
abstract SemanticVersion GetCurrentVersion ()
 Returns the version number of the current program. More...
 
virtual void DoDownload ()
 
virtual void ConfirmDownload ()
 Performs the actual download once the user has confirmed the download destination. More...
 
virtual bool CanDownload ()
 
virtual void OnDownloadUpdateFinished ()
 
virtual void OnCheckForUpdateFinished ()
 
virtual string BuildDestinationFileName ()
 Builds the destination file name from the download URI and the destination folder (which is stored in a public property and could be set by a view that subscribes to this view model). More...
 
virtual void DoInstallUpdate ()
 Executes the update file. This method is called by InstallUpdate() only if the Sha1 checksum of the file meets the expectation. More...
 
virtual string GetInstallerCommand ()
 Returns the command to execute in the shell to install the update. More...
 
virtual string GetInstallerParameters ()
 Returns commandline parameters for the update installer. More...
 
abstract Uri GetVersionInfoUri ()
 Returns the URI for the file that provides current version information. More...
 
abstract SemanticVersion GetCurrentVersion ()
 Returns the version number of the current program. More...
 
virtual void DoDownload ()
 
virtual void ConfirmDownload ()
 Performs the actual download once the user has confirmed the download destination. More...
 
virtual bool CanDownload ()
 
virtual void OnDownloadUpdateFinished ()
 
virtual void OnCheckForUpdateFinished ()
 
virtual string BuildDestinationFileName ()
 Builds the destination file name from the download URI and the destination folder (which is stored in a public property and could be set by a view that subscribes to this view model). More...
 
virtual void DoInstallUpdate ()
 Executes the update file. This method is called by InstallUpdate() only if the Sha1 checksum of the file meets the expectation. More...
 
virtual string GetInstallerCommand ()
 Returns the command to execute in the shell to install the update. More...
 
virtual string GetInstallerParameters ()
 Returns commandline parameters for the update installer. More...
 

Properties

string DestinationFolder [get, set]
 
SemanticVersion NewVersion [get, protected set]
 
SemanticVersion CurrentVersion [get]
 
bool IsUpdateAvailable [get, protected set]
 If true, an updated version is available for download. More...
 
bool IsUpdatePending [get, protected set]
 Indicates whether an update has been downloaded and could be installed. More...
 
Uri DownloadUri [get, protected set]
 The URI of the remote file. More...
 
bool IsVerifiedDownload [get, protected set]
 Returns true if the Sha1 of the downloaded file matches the one in the version information file. More...
 
string UpdateChecksum [get, protected set]
 The Sha1 hash of the remote file as reported in the version info file. More...
 
string UpdateSummary [get, protected set]
 Summary of changes as reported in the version info file. More...
 
virtual bool IsAuthorized [get]
 Determines whether the current user is authorized to write to the folder where the addin files are stored. If the user does not have write permissions, he/she cannot update the addin by herself/hisself. More...
 
Exception DownloadException [get, protected set]
 

Events

EventHandler< EventArgs > CheckForUpdateFinished
 Signals that the current version information has been refreshed. More...
 
EventHandler< DownloadProgressChangedEventArgs > DownloadProgressChanged
 Signals a change in the download process of the executable file. This event is chained from WebClient's event with the same name. More...
 
EventHandler< EventArgs > DownloadUpdateFinished
 Signals that an update has been downloaded. Subscribers need to check if the update is actually installable. More...
 

Detailed Description

Fetches version information from the internet and raises an UpdateAvailable event if a new version is available for download.

The current version information resides in a simple text file which contains four lines: e.g. 1) Current version 7.0.0-alpha.1 2) Download URL http://sourceforge.net/projects/xltoolbox/files/XL_Toolbox_7.0.0-alpha.1.exe 3) Sha1 of executable 1234abcd... 4) Version description This is the first release of the next generation Toolbox

Member Function Documentation

◆ BuildDestinationFileName() [1/2]

virtual string Bovender.Versioning.Updater.BuildDestinationFileName ( )
inlineprotectedvirtual

Builds the destination file name from the download URI and the destination folder (which is stored in a public property and could be set by a view that subscribes to this view model).

Derived classes will typically want to override this, as the base method uses a simple generic file name that contains the version number.

Returns
Complete path of the destination file.

◆ BuildDestinationFileName() [2/2]

virtual string Bovender.Versioning.Updater.BuildDestinationFileName ( )
inlineprotectedvirtual

Builds the destination file name from the download URI and the destination folder (which is stored in a public property and could be set by a view that subscribes to this view model).

Derived classes will typically want to override this, as the base method uses a simple generic file name that contains the version number.

Returns
Complete path of the destination file.

◆ CancelCheckForUpdate() [1/2]

void Bovender.Versioning.Updater.CancelCheckForUpdate ( )
inline

◆ CancelCheckForUpdate() [2/2]

void Bovender.Versioning.Updater.CancelCheckForUpdate ( )
inline

◆ CancelDownload() [1/2]

void Bovender.Versioning.Updater.CancelDownload ( )
inline

◆ CancelDownload() [2/2]

void Bovender.Versioning.Updater.CancelDownload ( )
inline

◆ CanDownload() [1/2]

virtual bool Bovender.Versioning.Updater.CanDownload ( )
inlineprotectedvirtual

◆ CanDownload() [2/2]

virtual bool Bovender.Versioning.Updater.CanDownload ( )
inlineprotectedvirtual

◆ CheckForUpdate() [1/2]

void Bovender.Versioning.Updater.CheckForUpdate ( )
inline

Downloads the current version information file asynchronously from the project home page.

Eventually triggers the UpdateAvailable or NoUpdateAvailable events if the current version information was downloaded successfully; and triggers the FetchingVersionFailed event if the version information could not be downloaded.

◆ CheckForUpdate() [2/2]

void Bovender.Versioning.Updater.CheckForUpdate ( )
inline

Downloads the current version information file asynchronously from the project home page.

Eventually triggers the UpdateAvailable or NoUpdateAvailable events if the current version information was downloaded successfully; and triggers the FetchingVersionFailed event if the version information could not be downloaded.

◆ ConfirmDownload() [1/2]

virtual void Bovender.Versioning.Updater.ConfirmDownload ( )
inlineprotectedvirtual

Performs the actual download once the user has confirmed the download destination.

◆ ConfirmDownload() [2/2]

virtual void Bovender.Versioning.Updater.ConfirmDownload ( )
inlineprotectedvirtual

Performs the actual download once the user has confirmed the download destination.

◆ DoDownload() [1/2]

virtual void Bovender.Versioning.Updater.DoDownload ( )
inlineprotectedvirtual

◆ DoDownload() [2/2]

virtual void Bovender.Versioning.Updater.DoDownload ( )
inlineprotectedvirtual

◆ DoInstallUpdate() [1/2]

virtual void Bovender.Versioning.Updater.DoInstallUpdate ( )
inlineprotectedvirtual

Executes the update file. This method is called by InstallUpdate() only if the Sha1 checksum of the file meets the expectation.

The path of the downloaded file is stored in _destinationFileName. Implementations of this class may want to override this method if updating is not simply a matter of executing this file. The base method executes the file with an "/UPDATE" command line parameter.

◆ DoInstallUpdate() [2/2]

virtual void Bovender.Versioning.Updater.DoInstallUpdate ( )
inlineprotectedvirtual

Executes the update file. This method is called by InstallUpdate() only if the Sha1 checksum of the file meets the expectation.

The path of the downloaded file is stored in _destinationFileName. Implementations of this class may want to override this method if updating is not simply a matter of executing this file. The base method executes the file with an "/UPDATE" command line parameter.

◆ DownloadUpdate() [1/2]

void Bovender.Versioning.Updater.DownloadUpdate ( )
inline

Downloads the current release from the internet.

◆ DownloadUpdate() [2/2]

void Bovender.Versioning.Updater.DownloadUpdate ( )
inline

Downloads the current release from the internet.

◆ GetCurrentVersion() [1/2]

abstract SemanticVersion Bovender.Versioning.Updater.GetCurrentVersion ( )
protectedpure virtual

Returns the version number of the current program.

Returns
Instance of SemanticVersion representing the current version number.

◆ GetCurrentVersion() [2/2]

abstract SemanticVersion Bovender.Versioning.Updater.GetCurrentVersion ( )
protectedpure virtual

Returns the version number of the current program.

Returns
Instance of SemanticVersion representing the current version number.

◆ GetInstallerCommand() [1/2]

virtual string Bovender.Versioning.Updater.GetInstallerCommand ( )
inlineprotectedvirtual

Returns the command to execute in the shell to install the update.

Returns
Command to execute.

◆ GetInstallerCommand() [2/2]

virtual string Bovender.Versioning.Updater.GetInstallerCommand ( )
inlineprotectedvirtual

Returns the command to execute in the shell to install the update.

Returns
Command to execute.

◆ GetInstallerParameters() [1/2]

virtual string Bovender.Versioning.Updater.GetInstallerParameters ( )
inlineprotectedvirtual

Returns commandline parameters for the update installer.

◆ GetInstallerParameters() [2/2]

virtual string Bovender.Versioning.Updater.GetInstallerParameters ( )
inlineprotectedvirtual

Returns commandline parameters for the update installer.

◆ GetVersionInfoUri() [1/2]

abstract Uri Bovender.Versioning.Updater.GetVersionInfoUri ( )
protectedpure virtual

Returns the URI for the file that provides current version information.

Returns
URI for version info file.

◆ GetVersionInfoUri() [2/2]

abstract Uri Bovender.Versioning.Updater.GetVersionInfoUri ( )
protectedpure virtual

Returns the URI for the file that provides current version information.

Returns
URI for version info file.

◆ InstallUpdate() [1/2]

void Bovender.Versioning.Updater.InstallUpdate ( )
inline

Verifies the Sha1 checksum of the file on disk again and executes the file if it is valid. Does nothing if no update is available.

Exceptions
DownloadCorruptExceptionif the Sha1 is unexpected

◆ InstallUpdate() [2/2]

void Bovender.Versioning.Updater.InstallUpdate ( )
inline

Verifies the Sha1 checksum of the file on disk again and executes the file if it is valid. Does nothing if no update is available.

Exceptions
DownloadCorruptExceptionif the Sha1 is unexpected

◆ OnCheckForUpdateFinished() [1/2]

virtual void Bovender.Versioning.Updater.OnCheckForUpdateFinished ( )
inlineprotectedvirtual

◆ OnCheckForUpdateFinished() [2/2]

virtual void Bovender.Versioning.Updater.OnCheckForUpdateFinished ( )
inlineprotectedvirtual

◆ OnDownloadUpdateFinished() [1/2]

virtual void Bovender.Versioning.Updater.OnDownloadUpdateFinished ( )
inlineprotectedvirtual

◆ OnDownloadUpdateFinished() [2/2]

virtual void Bovender.Versioning.Updater.OnDownloadUpdateFinished ( )
inlineprotectedvirtual

Property Documentation

◆ CurrentVersion

SemanticVersion Bovender.Versioning.Updater.CurrentVersion
get

◆ DestinationFolder

string Bovender.Versioning.Updater.DestinationFolder
getset

◆ DownloadException

Exception Bovender.Versioning.Updater.DownloadException
getprotected set

◆ DownloadUri

Uri Bovender.Versioning.Updater.DownloadUri
getprotected set

The URI of the remote file.

◆ IsAuthorized

bool Bovender.Versioning.Updater.IsAuthorized
get

Determines whether the current user is authorized to write to the folder where the addin files are stored. If the user does not have write permissions, he/she cannot update the addin by herself/hisself.

◆ IsUpdateAvailable

bool Bovender.Versioning.Updater.IsUpdateAvailable
getprotected set

If true, an updated version is available for download.

◆ IsUpdatePending

bool Bovender.Versioning.Updater.IsUpdatePending
getprotected set

Indicates whether an update has been downloaded and could be installed.

◆ IsVerifiedDownload

bool Bovender.Versioning.Updater.IsVerifiedDownload
getprotected set

Returns true if the Sha1 of the downloaded file matches the one in the version information file.

◆ NewVersion

SemanticVersion Bovender.Versioning.Updater.NewVersion
getprotected set

◆ UpdateChecksum

string Bovender.Versioning.Updater.UpdateChecksum
getprotected set

The Sha1 hash of the remote file as reported in the version info file.

◆ UpdateSummary

string Bovender.Versioning.Updater.UpdateSummary
getprotected set

Summary of changes as reported in the version info file.

Event Documentation

◆ CheckForUpdateFinished

EventHandler< EventArgs > Bovender.Versioning.Updater.CheckForUpdateFinished

Signals that the current version information has been refreshed.

◆ DownloadProgressChanged

EventHandler< DownloadProgressChangedEventArgs > Bovender.Versioning.Updater.DownloadProgressChanged

Signals a change in the download process of the executable file. This event is chained from WebClient's event with the same name.

◆ DownloadUpdateFinished

EventHandler< EventArgs > Bovender.Versioning.Updater.DownloadUpdateFinished

Signals that an update has been downloaded. Subscribers need to check if the update is actually installable.


The documentation for this class was generated from the following file: