public void DownloadUpdate(UpdateInformation updateInfo) { var getUpdater = GetUpdaterVersion() < updateInfo.Manifest.UpdaterVersion; UpdateDownloader.Download (updateInfo, getUpdater); }
public void Download(UpdateInformation updateInfo, bool downloadUpdater) { var patchDest = Path.Combine (updateCacheDir, Path.GetFileName (updateInfo.PatchZipUri.LocalPath)); if (downloadUpdater) { DownloadFile (updateInfo.UpdaterUri, updaterPath, (s, e) => DownloadFile (updateInfo.PatchZipUri, patchDest)); return; } DownloadFile (updateInfo.PatchZipUri, patchDest); }
//<returns>False if exception, otherwise true</returns> private bool TryGetUpdateManifest(out UpdateInformation updateInfo, out Exception ex) { string result; if (!UpdateHelper.TryDownloadString (remoteManifestUri, out result, out ex)) { updateInfo = null; return false; } UpdateManifest manifest; try { manifest = UpdateManifest.ParseManifest (result); } catch (Exception exception) { ex = exception; updateInfo = null; return false; } // Get the patch notes string patchNotes; var patchNotesUri = remoteManifestUri.Append (manifest.ProductVersion + ".patchnotes"); if (!UpdateHelper.TryDownloadString (patchNotesUri, out patchNotes, out ex)) patchNotes = "No patch notes available."; var patchZipUri = remoteManifestUri.Append (manifest.ProductVersion + ".zip"); var updateUri = remoteManifestUri.Append ("updater." + manifest.UpdaterVersion + ".exe"); updateInfo = new UpdateInformation (manifest, patchZipUri, updateUri, patchNotes); return true; }
private void onUpdateFound(UpdateInformation updateInfo) { var handler = UpdateFound; if (handler != null) { handler (this, new UpdateCheckerEventArgs (updateInfo)); } }
private void updateFound(UpdateInformation updateInfo) { waitingUpdate = updateInfo; setFormState (PatchFormState.WaitingInstall); showPatchNotes(); }