mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Implement silent install
This commit is contained in:
@@ -47,8 +47,9 @@ namespace Squirrel
|
||||
/// <summary>
|
||||
/// Completely Installs a targeted app
|
||||
/// </summary>
|
||||
/// <param name="silentInstall">If true, don't run the app once install completes.</param>
|
||||
/// <returns>Completion</returns>
|
||||
Task FullInstall();
|
||||
Task FullInstall(bool silentInstall);
|
||||
|
||||
/// <summary>
|
||||
/// Completely uninstalls the targeted app
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Squirrel
|
||||
this.rootAppDirectory = rootAppDirectory;
|
||||
}
|
||||
|
||||
public async Task ApplyReleases(UpdateInfo updateInfo, Action<int> progress = null)
|
||||
public async Task ApplyReleases(UpdateInfo updateInfo, bool silentInstall, Action<int> progress = null)
|
||||
{
|
||||
progress = progress ?? (_ => { });
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Squirrel
|
||||
progress(50);
|
||||
|
||||
var newVersion = currentReleases.MaxBy(x => x.Version).First().Version;
|
||||
await invokePostInstall(newVersion, currentReleases.Count == 1);
|
||||
await invokePostInstall(newVersion, currentReleases.Count == 1 && !silentInstall);
|
||||
progress(75);
|
||||
|
||||
await cleanDeadVersions(newVersion);
|
||||
|
||||
@@ -62,14 +62,18 @@ namespace Squirrel
|
||||
var applyReleases = new ApplyReleasesImpl(rootAppDirectory);
|
||||
await acquireUpdateLock();
|
||||
|
||||
await applyReleases.ApplyReleases(updateInfo, progress);
|
||||
await applyReleases.ApplyReleases(updateInfo, false, progress);
|
||||
}
|
||||
|
||||
public async Task FullInstall()
|
||||
public async Task FullInstall(bool silentInstall = false)
|
||||
{
|
||||
var updateInfo = await CheckForUpdate();
|
||||
await DownloadReleases(updateInfo.ReleasesToApply);
|
||||
await ApplyReleases(updateInfo);
|
||||
|
||||
var applyReleases = new ApplyReleasesImpl(rootAppDirectory);
|
||||
await acquireUpdateLock();
|
||||
|
||||
await applyReleases.ApplyReleases(updateInfo, silentInstall);
|
||||
}
|
||||
|
||||
public async Task FullUninstall()
|
||||
|
||||
Reference in New Issue
Block a user