void checker_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (!e.Cancelled) { CheckForUpdateCompleteEventArgs args = null; bool userInitiated = (bool)e.UserState; if (e.Error == null) { this.updatedManifest = Manifest.Parse(e.Result); if (this.updatedManifest != null) { args = new CheckForUpdateCompleteEventArgs(this.updatedManifest, this.currentVersion, userInitiated, null); this.updateAvailable = args.UpdateAvailable; } } // this could be because e.Error != null or because the Manifest.Parse() failed if (args == null) { UpdateErrorEventArgs errorArgs = new UpdateErrorEventArgs(e.Error, "Growl was unable to determine if a newer version is available. Please try again later."); args = new CheckForUpdateCompleteEventArgs(null, this.currentVersion, userInitiated, errorArgs); } this.OnCheckForUpdateComplete(args); } }
private void ReadCurrentManifest() { bool exists = File.Exists(this.manifestFile); if (exists) { string xml = File.ReadAllText(this.manifestFile); Manifest manifest = Manifest.Parse(xml); this.currentVersion = manifest.Version; this.updateLocation = manifest.UpdateLocation; manifest = null; } }