Table of Contents

Class Updater

Namespace
CarinaStudio.AutoUpdate
Assembly
CarinaStudio.AppBase.AutoUpdate.dll

Core object to perform auto/self update.

public class Updater : BaseDisposableApplicationObject, IApplicationObject, IThreadDependent, ISynchronizable, IDisposable, INotifyPropertyChanged
Inheritance
Updater
Implements
Inherited Members
Extension Methods

Constructors

Updater(IApplication)

Initialize new Updater instance.

public Updater(IApplication app)

Parameters

app IApplication

Application.

Properties

ApplicationDirectoryPath

Get or set path of application directory to update.

public string? ApplicationDirectoryPath { get; set; }

Property Value

string

BackUpApplicationCompletely

Get or set whether application should be backed-up completely before installation or not.

public bool BackUpApplicationCompletely { get; set; }

Property Value

bool

DownloadedPackageSize

Get size of downloaded package in bytes.

public long DownloadedPackageSize { get; }

Property Value

long

Exception

Get latest exception occurred while updating.

public Exception? Exception { get; }

Property Value

Exception

IsCancellable

Check whether updating process is cancellable or not.

public bool IsCancellable { get; }

Property Value

bool

IsCancelling

Check whether updating process is cancelling or not.

public bool IsCancelling { get; }

Property Value

bool

IsUpdating

Check whether updating process is on-going or not.

public bool IsUpdating { get; }

Property Value

bool

PackageInstaller

Get or set IPackageInstaller to install downloaded package.

public IPackageInstaller? PackageInstaller { get; set; }

Property Value

IPackageInstaller

PackageRequestHeaders

Get collection of custom headers for requesting package download.

public IDictionary<string, string> PackageRequestHeaders { get; }

Property Value

IDictionary<string, string>

PackageResolver

Get or set IPackageResolver to resolve package to download.

public IPackageResolver? PackageResolver { get; set; }

Property Value

IPackageResolver

Remarks

You need to setup Source before calling Start().

PackageSize

Get size of package in bytes.

public long? PackageSize { get; }

Property Value

long?

Progress

Get current progress of updating. Range is [0.0, 1.0] or NaN if progress is unavailable.

public double Progress { get; }

Property Value

double

State

Get current state.

public UpdaterState State { get; }

Property Value

UpdaterState

Methods

Cancel()

Cancel updating process.

public bool Cancel()

Returns

bool

True if cancellation has been accepted.

Dispose(bool)

Dispose instance.

protected override void Dispose(bool disposing)

Parameters

disposing bool

True to dispose managed resources.

OnPropertyChanged(string)

Raise PropertyChanged event.

protected virtual void OnPropertyChanged(string propertyName)

Parameters

propertyName string

Name of changed property.

Start()

Start updating application.

public bool Start()

Returns

bool

True if updating process has been started successfully.

StartAndWaitAsync(CancellationToken)

Start updating application and wait for completion asynchronously.

public Task<bool> StartAndWaitAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

True if updating process has been started successfully.

Events

PropertyChanged

Raise when property changed.

public event PropertyChangedEventHandler? PropertyChanged

Event Type

PropertyChangedEventHandler