Class AutoUpdater
Updates applications in-place. Delta-based updates are built in a temporary directory, then launched to install themselves over the original program.
public class AutoUpdater
- Inheritance
-
AutoUpdater
- Inherited Members
Constructors
AutoUpdater(IHttpClientFactory, ILogger<AutoUpdater>, UpdateOptions?)
public AutoUpdater(IHttpClientFactory clientFactory, ILogger<AutoUpdater> logger, UpdateOptions? options = null)
Parameters
clientFactoryIHttpClientFactoryAn instance of IHttpClientFactory, with a BaseAddress set to the URL of an API server running MapTheFramework()
loggerILogger<AutoUpdater>Required logger - debugging failed updates without logs is not something you want to do.
optionsUpdateOptionsUpdate process configuration
AutoUpdater(IHttpClientFactory, string, ILogger<AutoUpdater>, UpdateOptions?)
public AutoUpdater(IHttpClientFactory clientFactory, string address, ILogger<AutoUpdater> logger, UpdateOptions? options = null)
Parameters
clientFactoryIHttpClientFactoryAn instance of IHttpClientFactory.
addressstringURL of an API server running MapTheFramework(), relative to the BaseAddress of factory-created HttpClients or absolute if they have no base.
loggerILogger<AutoUpdater>Required logger - debugging failed updates without logs is not something you want to do.
optionsUpdateOptionsUpdate process configuration
AutoUpdater(IHttpClientFactory, Uri, ILogger<AutoUpdater>, UpdateOptions?)
public AutoUpdater(IHttpClientFactory clientFactory, Uri address, ILogger<AutoUpdater> logger, UpdateOptions? options = null)
Parameters
clientFactoryIHttpClientFactoryAn instance of IHttpClientFactory.
addressUriURL of an API server running MapTheFramework(), relative to the BaseAddress of factory-created HttpClients or absolute if they have no base.
loggerILogger<AutoUpdater>Required logger - debugging failed updates without logs is not something you want to do.
optionsUpdateOptionsUpdate process configuration
AutoUpdater(string, ILogger<AutoUpdater>, UpdateOptions?)
public AutoUpdater(string address, ILogger<AutoUpdater> logger, UpdateOptions? options = null)
Parameters
addressstringURL of an API server running MapTheFramework(). Must be absolute.
loggerILogger<AutoUpdater>Required logger - debugging failed updates without logs is not something you want to do.
optionsUpdateOptionsUpdate process configuration
AutoUpdater(Uri, ILogger<AutoUpdater>, UpdateOptions?)
public AutoUpdater(Uri address, ILogger<AutoUpdater> logger, UpdateOptions? options = null)
Parameters
addressUriURL of an API server running MapTheFramework(). Must be absolute.
loggerILogger<AutoUpdater>Required logger - debugging failed updates without logs is not something you want to do.
optionsUpdateOptionsUpdate process configuration
Methods
CheckForUpdate(string, IProgress<string>?, CancellationToken)
returns an updated version if one is found - this may be an upgrade or a downgrade, it's up to the server
public Task<Optional<Deployment>> CheckForUpdate(string currentVersion, IProgress<string>? progress = null, CancellationToken cancellationToken = default)
Parameters
currentVersionstringprogressIProgress<string>cancellationTokenCancellationToken
Returns
DefaultHttpConfig(HttpClient)
public static void DefaultHttpConfig(HttpClient client)
Parameters
clientHttpClient
DownloadOrInstall(IProgress<string>?, CancellationToken)
checks for an update to download or, if one has already been downloaded, installs it
public Task DownloadOrInstall(IProgress<string>? progress = null, CancellationToken cancellationToken = default)
Parameters
progressIProgress<string>cancellationTokenCancellationToken
Returns
DownloadUpdate(Deployment, string, IProgress<string>?, CancellationToken)
download and extract a specified update
public Task<string?> DownloadUpdate(Deployment updateInfo, string currentExe, IProgress<string>? progress = null, CancellationToken cancellationToken = default)
Parameters
updateInfoDeploymentcurrentExestringprogressIProgress<string>cancellationTokenCancellationToken
Returns
InstallSelfAsUpdate(string, int?, IProgress<string>?, CancellationToken)
runs in the new client to replace the old version
public Task InstallSelfAsUpdate(string originalDirectory, int? oldProcessId, IProgress<string>? progress = null, CancellationToken cancellationToken = default)
Parameters
originalDirectorystringoldProcessIdint?progressIProgress<string>cancellationTokenCancellationToken