Return asset from pending restart check

This commit is contained in:
Caelan
2024-09-20 22:57:28 -06:00
parent bc8e05bf84
commit 139013c35f

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@@ -27,13 +28,18 @@ namespace Velopack
/// <inheritdoc cref="IVelopackLocator.IsPortable" /> /// <inheritdoc cref="IVelopackLocator.IsPortable" />
public virtual bool IsPortable => Locator.IsPortable; public virtual bool IsPortable => Locator.IsPortable;
/// <summary> True if there is a local update prepared that requires a call to <see cref="ApplyUpdatesAndRestart(VelopackAsset, string[])"/> to be applied. </summary> /// <summary> OBSOLETE: Use <see cref="UpdatePendingRestart"/> instead. </summary>
public virtual bool IsUpdatePendingRestart { [EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use UpdatePendingRestart instead.")]
public virtual bool IsUpdatePendingRestart => UpdatePendingRestart != null;
/// <summary> Returns a VelopackAsset if there is a local update prepared that requires a call to <see cref="ApplyUpdatesAndRestart(VelopackAsset, string[])"/> to be applied. </summary>
public virtual VelopackAsset? UpdatePendingRestart {
get { get {
var latestLocal = Locator.GetLatestLocalFullPackage(); var latestLocal = Locator.GetLatestLocalFullPackage();
if (latestLocal != null && CurrentVersion != null && latestLocal.Version > CurrentVersion) if (latestLocal != null && CurrentVersion != null && latestLocal.Version > CurrentVersion)
return true; return latestLocal;
return false; return null;
} }
} }