41 lines
1.5 KiB
C#
41 lines
1.5 KiB
C#
using CursorLang.Core.Models;
|
|
|
|
namespace CursorLang.Core.Services;
|
|
|
|
/// <summary>
|
|
/// Checking for and installing new versions of the application.
|
|
/// </summary>
|
|
public interface IUpdateService
|
|
{
|
|
/// <summary>
|
|
/// It makes sense for this installation to update itself.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// An application installed from the Store is updated by the Store itself:
|
|
/// offering a package from elsewhere on top of it will not do — Windows would
|
|
/// not accept it anyway.
|
|
/// </remarks>
|
|
bool IsSupported { get; }
|
|
|
|
/// <summary>The version of the running application.</summary>
|
|
Version CurrentVersion { get; }
|
|
|
|
/// <summary>
|
|
/// Looks for a release newer than the installed one. <c>null</c> means the latest
|
|
/// version is installed or there is no suitable release in the repository.
|
|
/// </summary>
|
|
Task<ReleaseInfo?> CheckAsync(CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Downloads the release package and returns the path to it.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <c>progress</c> receives the downloaded fraction from 0 to 1. While the file
|
|
/// size is unknown — not every hosting reports it — there will be no calls at all.
|
|
/// </remarks>
|
|
Task<string> DownloadAsync(ReleaseInfo release, IProgress<double>? progress, CancellationToken cancellationToken);
|
|
|
|
/// <summary>Hands the downloaded package over to the Windows app installer.</summary>
|
|
void Install(string packagePath);
|
|
}
|