コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: ReleaseFeed.cs プロジェクト: daviddw/Kinsky
        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();
            }
        }
コード例 #3
0
ファイル: ReleaseFeed.cs プロジェクト: daviddw/Kinsky
 public static Uri UpdateUri(this IReleaseJson aJson)
 {
     return(new Uri(aJson.UpdateUri));
 }
コード例 #4
0
ファイル: ReleaseFeed.cs プロジェクト: daviddw/Kinsky
 public static Uri DownloadUri(this IReleaseJson aJson)
 {
     return(new Uri(aJson.DownloadUri));
 }
コード例 #5
0
ファイル: ReleaseFeed.cs プロジェクト: daviddw/Kinsky
 public static DateTime Date(this IReleaseJson aJson)
 {
     return(DateTime.ParseExact(aJson.Date, kDateFormat, CultureInfo.InvariantCulture));
 }