Exemple #1
0
        public async Task StartApplicationUpdateProcess(string targetFolder, string assetFileName)
        {
            if (!File.Exists(FullUpdaterPath))
            {
                Console.WriteLine("Update executable was not found in the expected location");
                return;
            }
            var(newData, release) = await GithubInformation.GetLatestReleaseInformation(UserOrOrgNameWithRepoName, ApplicationTitle, GitHubToken, DateTime.MinValue);

            var asset = release?.Assets.FirstOrDefault(a => a.Name.Equals(assetFileName));

            if (asset == null)
            {
                return;
            }

            var    currentProcessName = Process.GetCurrentProcess().ProcessName;
            string launchDebugger     = "";// "LaunchDebugger";
            var    processStartInfo   = new ProcessStartInfo();
            string data = $"\"{ApplicationTitle}\" {asset.BrowserDownloadUrl} \"{targetFolder}\" {currentProcessName} {launchDebugger}";

            processStartInfo.Arguments = data;
            processStartInfo.Verb      = "runas";
            processStartInfo.FileName  = FullUpdaterPath;
            try
            {
                Process.Start(processStartInfo);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error during Updater: {ex.Message}");
            }
        }
Exemple #2
0
        public static async Task <(string TagName, GithubObjects.GithubAsset UpdaterAsset)?> GetLatestUpdater(string?githubToken = null)
        {
            var(newData, release) = await GithubInformation.GetLatestReleaseInformation(UpdaterRepository, "Github.Updater.Client", githubToken, DateTime.MinValue);

            return(release == null
                ? ((string TagName, GithubObjects.GithubAsset UpdaterAsset)?)null
                   : (release.TagName, release.Assets.First(a => a.Name.Contains("Github.Updater"))));
        }
Exemple #3
0
        public async Task <bool> CheckNewVersionExistsForApplication(Version applicationVersion)
        {
            var(newData, release) = await GithubInformation.GetLatestReleaseInformation(UserOrOrgNameWithRepoName, ApplicationTitle, GitHubToken, DateTime.MinValue);

            if (release == null)
            {
                return(false);
            }
            return(GetVersionFromTagName(release.TagName) > applicationVersion);
        }