WIP Restart

This commit is contained in:
Caelan Sayler
2023-12-22 08:41:11 +00:00
parent 42a9ea5b26
commit 79bf338efd
2 changed files with 21 additions and 0 deletions

View File

@@ -345,6 +345,7 @@ namespace Squirrel
/// <param name="path">The path of the file system entity to delete.</param>
/// <param name="throwOnFailure">Whether this function should throw if the delete fails.</param>
/// <param name="renameFirst">Try to rename this object first before deleting. Can help prevent partial delete of folders.</param>
/// <param name="logger">Logger for diagnostic messages.</param>
/// <returns>True if the file system object was deleted, false otherwise.</returns>
public static bool DeleteFileOrDirectoryHard(string path, bool throwOnFailure = true, bool renameFirst = false, ILogger logger = null)
{

View File

@@ -21,6 +21,15 @@ namespace Squirrel
public virtual bool IsInstalled => Locator.CurrentlyInstalledVersion != null;
public virtual bool IsPendingRestart {
get {
var latestLocal = Locator.GetLatestLocalPackage();
if (latestLocal != null && latestLocal.Version > CurrentVersion)
return true;
return false;
}
}
public virtual SemanticVersion CurrentVersion => Locator.CurrentlyInstalledVersion;
protected IUpdateSource Source { get; }
@@ -189,11 +198,22 @@ namespace Squirrel
File.Delete(completeFile);
File.Move(incompleteFile, completeFile);
Log.Info("Full release download complete. Package moved to: " + completeFile);
progress(100);
} finally {
CleanIncompleteAndDeltaPackages();
}
}
public void ExitAndApplyUpdates()
{
}
public void WaitForExitAndApplyUpdates(bool restart, string[] arguments = null)
{
var updateArgs = new string[]{ "--update" };
}
protected virtual async Task DownloadAndApplyDeltaUpdates(string extractedBasePackage, UpdateInfo updates, Action<int> progress)
{
var packagesDirectory = Locator.PackagesDir;