23 行
873 B
C#
23 行
873 B
C#
using YukkuriMovieMaker.Plugin.Update;
|
|
|
|
namespace GitHubUpdateNotifier;
|
|
|
|
public sealed record UpdateCheckResult
|
|
{
|
|
public required UpdateStatus Status { get; init; }
|
|
public UpdateInfo? Update { get; init; }
|
|
public PluginVersion? LatestVersion { get; init; }
|
|
public Exception? Error { get; init; }
|
|
|
|
public bool HasUpdate => Status is UpdateStatus.UpdateAvailable && Update is not null;
|
|
|
|
internal static UpdateCheckResult UpToDate(PluginVersion latestVersion)
|
|
=> new() { Status = UpdateStatus.UpToDate, LatestVersion = latestVersion };
|
|
|
|
internal static UpdateCheckResult Available(UpdateInfo update)
|
|
=> new() { Status = UpdateStatus.UpdateAvailable, Update = update, LatestVersion = update.Version };
|
|
|
|
internal static UpdateCheckResult Failed(Exception error)
|
|
=> new() { Status = UpdateStatus.Failed, Error = error };
|
|
}
|