bovender framework
C# framework that implements MVVM and more
Bovender.Versioning.Updater Class Reference

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:
Bovender.Mvvm.Models.ProcessModel Bovender.Mvvm.Models.IProcessModel

Public Member Functions

bool Install ()
 
 Updater (IReleaseInfo releaseInfo)
 
void Dispose ()
 
override bool Execute ()
 This method may be called by a ProcessViewModelBase-derived class in a worker task that wraps this method in a try...catch structure. More...
 
- Public Member Functions inherited from Bovender.Mvvm.Models.ProcessModel
void Cancel ()
 Cancels the current process More...
 

Protected Member Functions

void Dispose (bool disposing)
 
virtual string GetDestinationFileName ()
 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 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...
 
virtual bool CheckAuthorization ()
 Determines whether the current user is authorized to write to the folder where the addin files are stored. More...
 
virtual bool Verify ()
 Compares the actual and expected checksum hashes and sets the IsVerifiedDownload property accordingly. More...
 
override void OnCancelling ()
 

Properties

UpdaterStatus Status [get, protected set]
 
Exception Exception [get, protected set]
 
IReleaseInfo ReleaseInfo [get, set]
 
string DestinationFolder [get, set]
 
SemanticVersion CurrentVersion [get, set]
 
int PercentDownloaded [get, protected set]
 
long DownloadBytesTotal [get, protected set]
 
long DownloadBytesReceived [get, protected set]
 
- Properties inherited from Bovender.Mvvm.Models.ProcessModel
ProcessModel Dependent [get, set]
 
bool IsCancellationRequested [get, set]
 This property is set to true by the Cancel() method. More...
 

Additional Inherited Members

- Events inherited from Bovender.Mvvm.Models.ProcessModel
EventHandler< ProcessModelEventArgsCancelling
 

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

Definition at line 41 of file Updater.cs.

Member Function Documentation

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

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.

Definition at line 261 of file Updater.cs.

override bool Bovender.Versioning.Updater.Execute ( )
inlinevirtual

This method may be called by a ProcessViewModelBase-derived class in a worker task that wraps this method in a try...catch structure.

The implementation does not need to and should not handle tasks or threads itself.

Returns
True if successful, false if failed or cancelled.

Implements Bovender.Mvvm.Models.ProcessModel.

Definition at line 158 of file Updater.cs.

virtual string Bovender.Versioning.Updater.GetDestinationFileName ( )
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.

Definition at line 210 of file Updater.cs.

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

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

Returns
Command to execute.

Definition at line 242 of file Updater.cs.

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

Returns commandline parameters for the update installer.

Definition at line 250 of file Updater.cs.

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

Compares the actual and expected checksum hashes and sets the IsVerifiedDownload property accordingly.

Automatically switches between SHA-256 and the obsolete SHA-1 algorithms.

Definition at line 291 of file Updater.cs.


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