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

Method CheckForUpdate

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

Source from the content-addressed store, hash-verified

259 }
260
261 public async Task<string> CheckForUpdate(string updateUrl, string appName = null)
262 {
263 appName = appName ?? getAppNameFromDirectory();
264
265 this.Log().Info("Fetching update information, downloading from " + updateUrl);
266 using (var mgr = new UpdateManager(updateUrl, appName)) {
267 var updateInfo = await mgr.CheckForUpdate(intention: UpdaterIntention.Update, progress: x => Console.WriteLine(x));
268 var releaseNotes = updateInfo.FetchReleaseNotes();
269
270 var sanitizedUpdateInfo = new {
271 currentVersion = updateInfo.CurrentlyInstalledVersion.Version.ToString(),
272 futureVersion = updateInfo.FutureReleaseEntry.Version.ToString(),
273 releasesToApply = updateInfo.ReleasesToApply.Select(x => new {
274 version = x.Version.ToString(),
275 releaseNotes = releaseNotes.ContainsKey(x) ? releaseNotes[x] : "",
276 }).ToArray(),
277 };
278
279 return SimpleJson.SerializeObject(sanitizedUpdateInfo);
280 }
281 }
282
283 public async Task Uninstall(string appName = null)
284 {

Calls 8

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