MCPcopy Create free account
hub / github.com/Squirrel/Squirrel.Windows / Download

Method Download

src/Update/Program.cs:237–259  ·  view source on GitHub ↗
(string updateUrl, string appName = null)

Source from the content-addressed store, hash-verified

235 }
236
237 public async Task<string> Download(string updateUrl, string appName = null)
238 {
239 appName = appName ?? getAppNameFromDirectory();
240
241 this.Log().Info("Fetching update information, downloading from " + updateUrl);
242 using (var mgr = new UpdateManager(updateUrl, appName)) {
243 var updateInfo = await mgr.CheckForUpdate(intention: UpdaterIntention.Update, progress: x => Console.WriteLine(x / 3));
244 await mgr.DownloadReleases(updateInfo.ReleasesToApply, x => Console.WriteLine(33 + x / 3));
245
246 var releaseNotes = updateInfo.FetchReleaseNotes();
247
248 var sanitizedUpdateInfo = new {
249 currentVersion = updateInfo.CurrentlyInstalledVersion.Version.ToString(),
250 futureVersion = updateInfo.FutureReleaseEntry.Version.ToString(),
251 releasesToApply = updateInfo.ReleasesToApply.Select(x => new {
252 version = x.Version.ToString(),
253 releaseNotes = releaseNotes.ContainsKey(x) ? releaseNotes[x] : "",
254 }).ToArray(),
255 };
256
257 return SimpleJson.SerializeObject(sanitizedUpdateInfo);
258 }
259 }
260
261 public async Task<string> CheckForUpdate(string updateUrl, string appName = null)
262 {

Callers

nothing calls this directly

Calls 10

FetchReleaseNotesMethod · 0.80
ContainsKeyMethod · 0.80
SerializeObjectMethod · 0.80
InfoMethod · 0.45
LogMethod · 0.45
CheckForUpdateMethod · 0.45
DownloadReleasesMethod · 0.45
ToStringMethod · 0.45
ToArrayMethod · 0.45
SelectMethod · 0.45

Tested by

no test coverage detected