コード例 #1
0
ファイル: Update.cs プロジェクト: csharpHub/Reloaded-II
        /// <summary>
        /// Checks if there are any updates for the mod loader.
        /// </summary>
        public static async Task CheckForLoaderUpdatesAsync()
        {
            // Check for loader updates.
            try
            {
                using (var manager = new UpdateManager(
                           new GithubPackageResolver("Reloaded-Project", "Reloaded-II", "Release.zip"),
                           new ArchiveExtractor()))
                {
                    // Check for new version and, if available, perform full update and restart
                    var result = await manager.CheckForUpdatesAsync();

                    if (result.CanUpdate)
                    {
                        ActionWrappers.ExecuteWithApplicationDispatcher(() =>
                        {
                            var dialog = new ModLoaderUpdateDialog(manager, result.LastVersion);
                            dialog.ShowDialog();
                        });
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(_xamlCheckUpdatesFailed.Get());
            }
        }
コード例 #2
0
ファイル: Update.cs プロジェクト: DeaTh-G/Reloaded-II
        /// <summary>
        /// Checks if there are any updates for the mod loader.
        /// </summary>
        public static async Task CheckForLoaderUpdatesAsync()
        {
            if (!_hasInternetConnection)
            {
                return;
            }

            // Check for loader updates.
            try
            {
                using (var manager = new UpdateManager(
                           new GithubPackageResolver(Misc.Constants.GitRepositoryAccount, Misc.Constants.GitRepositoryName, Constants.GitRepositoryReleaseName),
                           new ArchiveExtractor()))
                {
                    // Check for new version and, if available, perform full update and restart
                    var result = await manager.CheckForUpdatesAsync();

                    if (result.CanUpdate)
                    {
                        ActionWrappers.ExecuteWithApplicationDispatcher(() =>
                        {
                            var dialog = new ModLoaderUpdateDialog(manager, result.LastVersion);
                            dialog.ShowDialog();
                        });
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(_xamlCheckUpdatesFailed.Get());
            }
        }