コード例 #1
0
        /// <summary>
        /// Checks if there is a new version of the application available.
        /// </summary>
        public void CheckSelfUpdates()
        {
            var release_info  = UpdateHelpers.GitReleaseInfo(applicationRepoUrl);
            var latestVersion = release_info.tag_name;

            if (latestVersion == _configurationManager.ApplicationVersion)
            {
                return;
            }

            OpeningViewModel.GetInstance.UpdateAvailable      = $"{latestVersion} {StaticText.Available.ToLower()}!";
            OpeningViewModel.GetInstance.UpdateLinkVisibility = Visibility.Visible;
        }
コード例 #2
0
        /// <summary>
        /// Checks for update to addon loader and downloads if a new release is available
        /// </summary>
        /// <returns></returns>
        public async Task handleLoaderInstall()
        {
            dynamic releaseInfo = UpdateHelpers.GitReleaseInfo(loader_git_url);

            latestLoaderVersion = releaseInfo.tag_name;

            if (userConfig.loader_version == latestLoaderVersion)
            {
                return;
            }

            string downloadLink = releaseInfo.assets[0].browser_download_url;

            await Download(downloadLink);
        }
コード例 #3
0
        /// <summary>
        /// Checks if there is a new version of the application available.
        /// </summary>
        public static void CheckSelfUpdates()
        {
            string thisVersion = getConfigAsYAML().application_version;
            string latestVersion;

            dynamic release_info = UpdateHelpers.GitReleaseInfo(applicationRepoUrl);

            latestVersion = release_info.tag_name;

            if (latestVersion != thisVersion)
            {
                OpeningViewModel.GetInstance.UpdateAvailable      = latestVersion + " available!";
                OpeningViewModel.GetInstance.UpdateLinkVisibility = Visibility.Visible;
            }
        }
コード例 #4
0
        /// <summary>
        /// Checks for update to addon loader and downloads if a new release is available
        /// </summary>
        /// <returns></returns>
        public async Task HandleLoaderUpdate()
        {
            dynamic releaseInfo = UpdateHelpers.GitReleaseInfo(loader_git_url);

            loader_destination = Path.Combine(loader_game_path, "d3d9.dll");

            latestLoaderVersion = releaseInfo.tag_name;

            if (File.Exists(loader_destination) && _configurationManager.UserConfig.LoaderVersion == latestLoaderVersion)
            {
                return;
            }

            string downloadLink = releaseInfo.assets[0].browser_download_url;

            await Download(downloadLink);
        }
コード例 #5
0
        /***** UPDATE CHECK *****/

        /// <summary>
        /// Checks whether an update is required and performs it for an add-on hosted on Github.
        /// </summary>
        private async Task GitCheckUpdate()
        {
            var client = new WebClient();

            client.Headers.Add("User-Agent", "request");

            dynamic release_info = UpdateHelpers.GitReleaseInfo(addon_info.host_url);

            latestVersion = release_info.tag_name;

            if (userConfig.version.ContainsKey(addon_name) && userConfig.version[addon_name] != null && latestVersion == userConfig.version[addon_name])
            {
                return;
            }

            string download_link = release_info.assets[0].browser_download_url;

            viewModel.ProgBarLabel = "Downloading " + addon_info.addon_name + " " + latestVersion;
            await Download(download_link, client);
        }
コード例 #6
0
        /// <summary>
        /// Downloads the latest application release.
        /// </summary>
        /// <returns></returns>
        public async Task downloadLatestRelease()
        {
            //perhaps change this to check if downloaded update is latest or not
            if (Directory.Exists(update_folder))
            {
                Directory.Delete(update_folder, true);
            }

            dynamic latestInfo  = UpdateHelpers.GitReleaseInfo(applicationRepoUrl);
            string  downloadUrl = latestInfo.assets[0].browser_download_url;

            viewModel.UpdateAvailable = "Downloading " + latestInfo.tag_name;

            Directory.CreateDirectory(update_folder);
            WebClient client = new WebClient();

            client.Headers.Add("User-Agent", "request");
            client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(selfUpdate_DownloadProgress);
            client.DownloadFileCompleted   += new AsyncCompletedEventHandler(selfUpdate_DownloadCompleted);
            await client.DownloadFileTaskAsync(new System.Uri(downloadUrl), Path.Combine(update_folder, update_name));
        }
コード例 #7
0
        /***** UPDATE CHECK *****/

        /// <summary>
        /// Checks whether an update is required and performs it for an add-on hosted on Github.
        /// </summary>
        private async Task GitCheckUpdate()
        {
            var client = new WebClient();

            client.Headers.Add("User-Agent", "request");

            dynamic release_info = UpdateHelpers.GitReleaseInfo(addon_info.host_url);

            latestVersion = release_info.tag_name;

            var currentAddonVersion = _configurationManager.UserConfig.AddonsList.FirstOrDefault(a => a.Name == addon_name);

            if (currentAddonVersion != null && currentAddonVersion.Version == latestVersion)
            {
                return;
            }

            string download_link = release_info.assets[0].browser_download_url;

            viewModel.ProgBarLabel = "Downloading " + addon_info.addon_name + " " + latestVersion;
            await Download(download_link, client);
        }