Ejemplo n.º 1
0
 /// <summary>
 /// Check application for update. Installs the latest installer and runs the file before closing this instance
 /// </summary>
 public static void CheckVersion()
 {
     try
     {
         Program.LogMessage("Checking application for update...");
         using (StreamReader sr = new StreamReader(HttpExtensions.GetStream(Utilities.ProjectVersionUrl)))
         {
             Version newVersion = new Version(sr.ReadToEnd());
             Version curVersion = Assembly.GetExecutingAssembly().GetName().Version;
             if (curVersion.CompareTo(newVersion) < 0)
             {
                 RunInstaller(newVersion);
             }
             else
             {
                 Program.LogMessage(string.Format("Application running latest update. Version: {0}", newVersion));
             }
         }
     }
     catch (Exception ex)
     {
         Program.LogMessage("Update failed: " + ex.Message);
         Application.Exit();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        ///     Get the latest release information from the GitHub API.
        /// </summary>
        /// <returns></returns>
        public static GitHubData GetGitHubLatestReleaseData()
        {
            GitHubData gitHubLatestReleaseData;

            using (var streamReader = new StreamReader(HttpExtensions.GetStream(Urls.GitHubLatestRelease)))
            {
                gitHubLatestReleaseData = JsonConvert.DeserializeObject <GitHubData>(streamReader.ReadToEnd());
            }

            return(gitHubLatestReleaseData);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Get the latest release information from the GitHub API.
 /// </summary>
 /// <returns> </returns>
 public static GitHubData GetLatestReleaseData()
 {
     using StreamReader streamReader = new(HttpExtensions.GetStream(Urls.GitHubLatestRelease));
     return(JsonConvert.DeserializeObject <GitHubData>(streamReader.ReadToEnd()));
 }