private void CheckUpdatesAndContinues()
        {
            HttpClient httpClient               = new HttpClient();
            string     author                   = "ZombieRage";
            string     repo                     = "zRageMapDownloader";
            bool       includePreRelease        = false;
            IReleaseDownloaderSettings settings = new ReleaseDownloaderSettings(httpClient, author, repo, includePreRelease, Utils.APP_PATH);

            // create downloader
            IReleaseDownloader downloader = new ReleaseDownloader(settings);

            // check version
            DispatchIfNecessary(() =>
            {
                txtMessage.Text = "Checking for updates...";
            });

            string currentVersion    = GetVersionKeyInfo();
            bool   installNewVersion = !string.IsNullOrEmpty(currentVersion) ? !downloader.IsLatestRelease(currentVersion) : true;

            if (installNewVersion || !File.Exists(Utils.APP_FILE))
            {
                DispatchIfNecessary(() =>
                {
                    Visibility      = Visibility.Visible;
                    txtMessage.Text = "Downloading lastest version...";
                });

                downloader.DownloadLatestRelease();

                var downloadedVersion = downloader.GetLatestReleaseVersion();
                UpdateVersionKeyInfo(downloadedVersion);
                RegisterCustomUrlScheme();
            }

            if (File.Exists(Utils.APP_FILE))
            {
                DispatchIfNecessary(() =>
                {
                    txtMessage.Text            = "Starting application...";
                    pbProgress.IsIndeterminate = false;
                    pbProgress.Value           = 1;
                });

                ProcessStartInfo psi = new ProcessStartInfo(Utils.APP_FILE);
                Process.Start(psi);
            }
            else
            {
                DispatchIfNecessary(() =>
                {
                    MessageBox.Show("Application not found", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                });
            }

            // clean up
            downloader.DeInit();
            httpClient.Dispose();
            DispatchIfNecessary(() =>
            {
                Application.Current.Shutdown();
            });
        }
Ejemplo n.º 2
0
 public void DeInit()
 {
     _betaDownloader.DeInit();
     _downloader.DeInit();
     _pluginService = null;
 }