mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Add a parameter for the background gif to releasify
This commit is contained in:
@@ -67,6 +67,7 @@ namespace Squirrel.Update
|
||||
string releaseDir = default(string);
|
||||
string packagesDir = default(string);
|
||||
string bootstrapperExe = default(string);
|
||||
string backgroundGif = default(string);
|
||||
|
||||
opts = new OptionSet() {
|
||||
"Usage: Update.exe command [OPTS]",
|
||||
@@ -84,6 +85,7 @@ namespace Squirrel.Update
|
||||
{ "r=|releaseDir=", "Path to a release directory to use with releasify", v => releaseDir = v},
|
||||
{ "p=|packagesDir=", "Path to the NuGet Packages directory for C# apps", v => packagesDir = v},
|
||||
{ "bootstrapperExe=", "Path to the Setup.exe to use as a template", v => bootstrapperExe = v},
|
||||
{ "g=|loadingGif=", "Path to an animated GIF to be displayed during installation", v => backgroundGif = v},
|
||||
{ "s|silent", "Silent install", _ => silentInstall = true},
|
||||
};
|
||||
|
||||
@@ -108,7 +110,7 @@ namespace Squirrel.Update
|
||||
Update(target).Wait();
|
||||
break;
|
||||
case UpdateAction.Releasify:
|
||||
Releasify(target, releaseDir, packagesDir, bootstrapperExe);
|
||||
Releasify(target, releaseDir, packagesDir, bootstrapperExe, backgroundGif);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -188,7 +190,7 @@ namespace Squirrel.Update
|
||||
}
|
||||
}
|
||||
|
||||
public void Releasify(string package, string targetDir = null, string packagesDir = null, string bootstrapperExe = null)
|
||||
public void Releasify(string package, string targetDir = null, string packagesDir = null, string bootstrapperExe = null, string backgroundGif = null)
|
||||
{
|
||||
targetDir = targetDir ?? ".\\Releases";
|
||||
packagesDir = packagesDir ?? ".";
|
||||
@@ -244,7 +246,7 @@ namespace Squirrel.Update
|
||||
var newestFullRelease = releaseEntries.MaxBy(x => x.Version).Where(x => !x.IsDelta).First();
|
||||
|
||||
File.Copy(bootstrapperExe, targetSetupExe, true);
|
||||
var zipPath = createSetupEmbeddedZip(Path.Combine(di.FullName, newestFullRelease.Filename), di.FullName);
|
||||
var zipPath = createSetupEmbeddedZip(Path.Combine(di.FullName, newestFullRelease.Filename), di.FullName, backgroundGif);
|
||||
|
||||
try {
|
||||
var zip = File.ReadAllBytes(zipPath);
|
||||
@@ -275,7 +277,7 @@ namespace Squirrel.Update
|
||||
opts.WriteOptionDescriptions(Console.Out);
|
||||
}
|
||||
|
||||
string createSetupEmbeddedZip(string fullPackage, string releasesDir)
|
||||
string createSetupEmbeddedZip(string fullPackage, string releasesDir, string backgroundGif)
|
||||
{
|
||||
string tempPath;
|
||||
|
||||
@@ -286,6 +288,12 @@ namespace Squirrel.Update
|
||||
File.Copy(fullPackage, Path.Combine(tempPath, Path.GetFileName(fullPackage)));
|
||||
}, "Failed to write package files to temp dir: " + tempPath);
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(backgroundGif)) {
|
||||
this.ErrorIfThrows(() => {
|
||||
File.Copy(backgroundGif, Path.Combine(tempPath, "background.gif"));
|
||||
}, "Failed to write animated GIF to temp dir: " + tempPath);
|
||||
}
|
||||
|
||||
var releases = new[] { ReleaseEntry.GenerateFromFile(fullPackage) };
|
||||
ReleaseEntry.WriteReleaseFile(releases, Path.Combine(tempPath, "RELEASES"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user