/// <summary> /// Checks for new updates asynchronously. After update check is finished, event UpdateChecked is raised. /// </summary> /// <exception cref="ArgumentNullException">Thrown when manifestUrl is null.</exception> /// <exception cref="WebException">Thrown when manifestUrl is not valid url or client can't connect to specified url.</exception> public void CheckUpdateAsync() { _webClient.OpenReadCompleted += (sender, args) => { _manifest = _manifestSerializer.Deserialize(args.Result) as XmlUpdateManifest; OnUpdateChecked(new UpdateCheckedEventArgs(UpdatesAvailable())); }; _webClient.OpenReadAsync(new Uri(_manifestUrl)); }
private void CreateManifest() { XmlUpdateManifest manifest = new XmlUpdateManifest { Url = ((_package.PackageUrlDirectory.EndsWith("/")) ? _package.PackageUrlDirectory : _package.PackageUrlDirectory + "/") + string.Format(UpdatePackage.AssemblyName, _package.NextVersion) + UpdatePackage.AssemblySuffix + UpdatePackage.PackageSuffix, Version = _package.NextVersion.ToString(), }; using (var manifestFile = new FileStream(System.IO.Path.Combine(_package.OutputDirectory, "UpdateManifest.xml"), FileMode.Create)) { _manifestSerializer.Serialize(manifestFile, manifest); } }
/// <summary> /// Checks for new updates. /// </summary> /// <exception cref="ArgumentNullException">Thrown when manifestUrl is null.</exception> /// <exception cref="WebException">Thrown when manifestUrl is not valid url or client can't connect to specified url.</exception> /// <returns>True if new updates are available. False if there are no new updates or downloaded UpdateManifest couldn't be deserialized.</returns> public bool CheckUpdate() { _manifest = _manifestSerializer.Deserialize(_webClient.OpenRead(_manifestUrl)) as XmlUpdateManifest; return(UpdatesAvailable()); }
/// <summary> /// Checks for new updates. /// </summary> /// <exception cref="ArgumentNullException">Thrown when manifestUrl is null.</exception> /// <exception cref="WebException">Thrown when manifestUrl is not valid url or client can't connect to specified url.</exception> /// <returns>True if new updates are available. False if there are no new updates or downloaded UpdateManifest couldn't be deserialized.</returns> public bool CheckUpdate() { _manifest = _manifestSerializer.Deserialize(_webClient.OpenRead(_manifestUrl)) as XmlUpdateManifest; return UpdatesAvailable(); }