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