(string updateUrl, string appName = null)
| 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 | { |
nothing calls this directly
no test coverage detected