Table of Contents

Class PluginSelfUpdateBase

Namespace
Hi3Helper.Plugin.Core.Update
Assembly
Hi3Helper.Plugin.Core.dll

A plugin self-updater instance which is used to perform update check and update download.

[GeneratedComClass]
[ComExposedClass<ComClassInformation>]
public abstract class PluginSelfUpdateBase : IPluginSelfUpdate, IFree
Inheritance
PluginSelfUpdateBase
Implements
Inherited Members

Properties

BaseCdnUrlSpan

A Span/Array of the CDN URL to use for getting the update.

protected abstract ReadOnlySpan<string> BaseCdnUrlSpan { get; }

Property Value

ReadOnlySpan<string>

UpdateHttpClient

An HttpClient client to be used to perform download for update operations.

protected abstract HttpClient UpdateHttpClient { get; }

Property Value

HttpClient

Methods

Dispose()

public void Dispose()

Free()

Free the resources associated by an instance.

public void Free()

TryGetAvailableCdn(CancellationToken)

Try to get the available CDN for the update routine to use.

protected virtual Task<(PluginManifest? Info, string? BaseUrl)> TryGetAvailableCdn(CancellationToken token)

Parameters

token CancellationToken

The cancellation token for the asynchronous operation.

Returns

Task<(PluginManifest Info, string BaseUrl)>

A ValueTuple of Info PluginManifest and BaseUrl string

Remarks

Both Info PluginManifest and BaseUrl string will return null if no CDN is available.

TryPerformUpdateAsync(string?, bool, InstallProgressDelegate?, in Guid, out nint)

Asynchronously perform update on the plugin.

public void TryPerformUpdateAsync(string? outputDir, bool checkForUpdatesOnly, InstallProgressDelegate? progressDelegate, in Guid cancelToken, out nint result)

Parameters

outputDir string

An output directory which the new version of library will be downloaded to.

checkForUpdatesOnly bool

Whether to perform the check only or also to perform the update at the same time.

progressDelegate InstallProgressDelegate

A delegate which pass InstallProgress to indicate update progress into the callback.

cancelToken Guid

Guid instance for cancellation token.

result nint

A pointer to ComAsyncResult.

Remarks

This method returns a pointer to ComAsyncResult via result. This method has a return value of the pointer of SelfUpdateReturnInfo.
Please use AsTask<T>(nint) to get the return value.

While checkForUpdatesOnly is set to true, the status will only contain UpdateIsAvailable or NoAvailableUpdate inside of ReturnCode and the update won't be performed.

TryPerformUpdateAsync(string?, bool, InstallProgressDelegate?, CancellationToken)

Asynchronously perform update on the plugin.

protected virtual Task<nint> TryPerformUpdateAsync(string? outputDir, bool checkForUpdatesOnly, InstallProgressDelegate? progressDelegate, CancellationToken token)

Parameters

outputDir string

An output directory which the new version of library will be downloaded to.

checkForUpdatesOnly bool

Whether to perform the check only or also to perform the update at the same time.

progressDelegate InstallProgressDelegate

A delegate which pass InstallProgress to indicate update progress into the callback.

token CancellationToken

A token for cancelling asynchronous update operation

Returns

Task<nint>