Implement silent install

This commit is contained in:
Paul Betts
2014-08-26 15:42:22 -07:00
parent eb5a80c3e8
commit 26bf4744b3
3 changed files with 11 additions and 6 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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()