public AutoUpdateInfo CheckForUpdate() { try { WebRequest request = WebRequest.Create(iUpdateFeedLocation); request.Credentials = CredentialCache.DefaultCredentials; if (request.Proxy != null) { request.Proxy.Credentials = CredentialCache.DefaultCredentials; } WebResponse response = request.GetResponse(); using (Stream stream = response.GetResponseStream()) { ReleaseFeed feed = new ReleaseFeed(stream); IReleaseJson update = feed.CheckForUpdate(iHelper.Version, iApplicationQuality, iApplicationTarget, Environment.OSVersion.Version.ToString(), DesiredQuality); if (update != null) { UserLog.WriteLine(String.Format("{0} update available: {1}", update.Quality, update.Version)); return(new AutoUpdateInfo(iApplicationName, update.Version, feed.Json.History(), update.UpdateUri(), update.Quality(), VersionSupport.Family(iHelper.Version) != VersionSupport.Family(update.Version))); } else { return(null); } } } catch (Exception ex) { UserLog.WriteLine(String.Format("Error caught checking for updates: {0}", ex.ToString())); } return(null); }
public static EReleaseQuality Quality(this IReleaseJson aJson) { switch (aJson.Quality) { case "developer": return(EReleaseQuality.Developer); case "nightly": return(EReleaseQuality.Nightly); case "development": return(EReleaseQuality.Development); case "beta": return(EReleaseQuality.Beta); case "stable": return(EReleaseQuality.Stable); default: throw new NotImplementedException(); } }
public static Uri UpdateUri(this IReleaseJson aJson) { return(new Uri(aJson.UpdateUri)); }
public static Uri DownloadUri(this IReleaseJson aJson) { return(new Uri(aJson.DownloadUri)); }
public static DateTime Date(this IReleaseJson aJson) { return(DateTime.ParseExact(aJson.Date, kDateFormat, CultureInfo.InvariantCulture)); }