mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Plumb some methods to give us paths we can use
This commit is contained in:
@@ -43,7 +43,9 @@ namespace Squirrel
|
|||||||
/// CheckForUpdate</param>
|
/// CheckForUpdate</param>
|
||||||
/// <param name="progress">A Observer which can be used to report Progress -
|
/// <param name="progress">A Observer which can be used to report Progress -
|
||||||
/// will return values from 0-100 and Complete, or Throw</param>
|
/// will return values from 0-100 and Complete, or Throw</param>
|
||||||
Task ApplyReleases(UpdateInfo updateInfo, Action<int> progress = null);
|
/// <returns>The path to the installed application (i.e. the path where
|
||||||
|
/// your package's contents ended up</returns>
|
||||||
|
Task<string> ApplyReleases(UpdateInfo updateInfo, Action<int> progress = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Completely Installs a targeted app
|
/// Completely Installs a targeted app
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ namespace Squirrel
|
|||||||
this.rootAppDirectory = rootAppDirectory;
|
this.rootAppDirectory = rootAppDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ApplyReleases(UpdateInfo updateInfo, bool silentInstall, Action<int> progress = null)
|
public async Task<string> ApplyReleases(UpdateInfo updateInfo, bool silentInstall, Action<int> progress = null)
|
||||||
{
|
{
|
||||||
progress = progress ?? (_ => { });
|
progress = progress ?? (_ => { });
|
||||||
|
|
||||||
var release = await createFullPackagesFromDeltas(updateInfo.ReleasesToApply, updateInfo.CurrentlyInstalledVersion);
|
var release = await createFullPackagesFromDeltas(updateInfo.ReleasesToApply, updateInfo.CurrentlyInstalledVersion);
|
||||||
progress(10);
|
progress(10);
|
||||||
|
|
||||||
await installPackageToAppDir(updateInfo, release);
|
var ret = await installPackageToAppDir(updateInfo, release);
|
||||||
progress(30);
|
progress(30);
|
||||||
|
|
||||||
var currentReleases = await updateLocalReleasesFile();
|
var currentReleases = await updateLocalReleasesFile();
|
||||||
@@ -45,6 +45,8 @@ namespace Squirrel
|
|||||||
|
|
||||||
await cleanDeadVersions(newVersion);
|
await cleanDeadVersions(newVersion);
|
||||||
progress(100);
|
progress(100);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task FullUninstall()
|
public async Task FullUninstall()
|
||||||
@@ -61,7 +63,7 @@ namespace Squirrel
|
|||||||
await Utility.DeleteDirectoryWithFallbackToNextReboot(rootAppDirectory);
|
await Utility.DeleteDirectoryWithFallbackToNextReboot(rootAppDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task installPackageToAppDir(UpdateInfo updateInfo, ReleaseEntry release)
|
async Task<string> installPackageToAppDir(UpdateInfo updateInfo, ReleaseEntry release)
|
||||||
{
|
{
|
||||||
var pkg = new ZipPackage(Path.Combine(updateInfo.PackageDirectory, release.Filename));
|
var pkg = new ZipPackage(Path.Combine(updateInfo.PackageDirectory, release.Filename));
|
||||||
var target = getDirectoryForRelease(release.Version);
|
var target = getDirectoryForRelease(release.Version);
|
||||||
@@ -98,6 +100,7 @@ namespace Squirrel
|
|||||||
// which shortcuts to install, and nuking them. Then, run the app's
|
// which shortcuts to install, and nuking them. Then, run the app's
|
||||||
// post install and set up shortcuts.
|
// post install and set up shortcuts.
|
||||||
runPostInstallAndCleanup(newCurrentVersion, updateInfo.IsBootstrapping);
|
runPostInstallAndCleanup(newCurrentVersion, updateInfo.IsBootstrapping);
|
||||||
|
return target.FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyFileToLocation(FileSystemInfo target, IPackageFile x)
|
void CopyFileToLocation(FileSystemInfo target, IPackageFile x)
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ namespace Squirrel
|
|||||||
await downloadReleases.DownloadReleases(updateUrlOrPath, releasesToDownload, progress, urlDownloader);
|
await downloadReleases.DownloadReleases(updateUrlOrPath, releasesToDownload, progress, urlDownloader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ApplyReleases(UpdateInfo updateInfo, Action<int> progress = null)
|
public async Task<string> ApplyReleases(UpdateInfo updateInfo, Action<int> progress = null)
|
||||||
{
|
{
|
||||||
var applyReleases = new ApplyReleasesImpl(rootAppDirectory);
|
var applyReleases = new ApplyReleasesImpl(rootAppDirectory);
|
||||||
await acquireUpdateLock();
|
await acquireUpdateLock();
|
||||||
|
|
||||||
await applyReleases.ApplyReleases(updateInfo, false, progress);
|
return await applyReleases.ApplyReleases(updateInfo, false, progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task FullInstall(bool silentInstall = false)
|
public async Task FullInstall(bool silentInstall = false)
|
||||||
@@ -152,6 +152,10 @@ namespace Squirrel
|
|||||||
key.DeleteSubKeyTree(applicationName);
|
key.DeleteSubKeyTree(applicationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string RootAppDirectory {
|
||||||
|
get { return rootAppDirectory; }
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
var disp = Interlocked.Exchange(ref updateLock, null);
|
var disp = Interlocked.Exchange(ref updateLock, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user