예제 #1
0
        // -----------------------------------------------
        // Check Button - Tests Download URL
        // -----------------------------------------------
        private void buttonCheck_Click(object sender, RoutedEventArgs e)
        {
            //Download.waiter.Reset();
            //Download.waiter = new ManualResetEvent(false);

            // Clear RetroArch Nightlies List before each run
            if (Queue.NightliesList != null)
            {
                Queue.NightliesList.Clear();
                Queue.NightliesList.TrimExcess();
            }

            //var message = string.Join(Environment.NewLine, Queue.NightliesList); //debug
            //MessageBox.Show(message); //debug

            // Progress Info
            VM.MainView.ProgressInfo_Text = "Checking...";

            // Call SetArchitecture Method
            Paths.SetArchitecture();


            // -------------------------
            // Stellar Self-Update
            // -------------------------
            if (VM.MainView.Download_SelectedItem == "Stellar")
            {
                // Parse GitHub Page HTML
                Parse.ParseGitHubReleases();

                // Check if Stellar is the Latest Version
                if (MainWindow.currentVersion != null && Parse.latestVersion != null)
                {
                    if (Parse.latestVersion > MainWindow.currentVersion)
                    {
                        MessageBox.Show("Update Available \n\n" + "v" + Parse.latestVersion + "-" + Parse.latestBuildPhase);
                    }
                    else if (Parse.latestVersion <= MainWindow.currentVersion)
                    {
                        MessageBox.Show("This version is up to date.",
                                        "Notice",
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Information);
                    }
                    else // null
                    {
                        MessageBox.Show("Could not find download.",
                                        "Error",
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                    }
                }
            }


            // -------------------------
            // RetroArch Part
            // -------------------------
            if (VM.MainView.Download_SelectedItem == "New Install" ||
                VM.MainView.Download_SelectedItem == "Upgrade" ||
                VM.MainView.Download_SelectedItem == "RA+Cores" ||
                VM.MainView.Download_SelectedItem == "RetroArch" ||
                VM.MainView.Download_SelectedItem == "Redist")
            {
                // Parse Page (HTML) Method
                Parse.ParseBuildbotPage();

                // Display message if download available
                if (!string.IsNullOrEmpty(Parse.nightly7z)) // If Last Item in Nightlies List is available
                {
                    MessageBox.Show("Download Available \n\n" + Paths.buildbotArchitecture + "\n\n" + Parse.nightly7z);
                }
                else
                {
                    MessageBox.Show("Could not find download.",
                                    "Error",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
            }

            // Progress Info
            VM.MainView.ProgressInfo_Text = "";


            // -------------------------
            // Cores Part
            // -------------------------
            // If Download Combobox Cores or RA+Cores selected
            if (VM.MainView.Download_SelectedItem == "RA+Cores" ||
                VM.MainView.Download_SelectedItem == "Cores" ||
                VM.MainView.Download_SelectedItem == "New Cores")
            {
                // Create Builtbot Cores List
                Parse.ParseBuildbotCoresIndex();

                // Create PC Cores Lists
                Parse.ScanPcCoresDir();

                // Create Cores to Update List
                Queue.CoresToUpdate();

                // Check if Cores Up To Date
                // If All Cores up to date, display message
                Queue.CoresUpToDateCheck(); //Note there are Clears() in this method

                // -------------------------
                // Window Checklist Popup
                // -------------------------
                // If Update List greater than 0, Popup Checklist
                if (Queue.List_CoresToUpdate_Name.Count != 0)
                {
                    // Prevent Monitor Resolution Window Crash
                    //
                    try
                    {
                        // Detect which screen we're on
                        var allScreens = System.Windows.Forms.Screen.AllScreens.ToList();
                        var thisScreen = allScreens.SingleOrDefault(s => Left >= s.WorkingArea.Left && Left < s.WorkingArea.Right);

                        // Start Window
                        checklist = new Checklist();

                        // Keep Window on Top
                        checklist.Owner = Window.GetWindow(this);

                        // Position Relative to MainWindow
                        checklist.Left = Math.Max((Left + (Width - checklist.Width) / 2), thisScreen.WorkingArea.Left);
                        checklist.Top  = Math.Max((Top + (Height - checklist.Height) / 2), thisScreen.WorkingArea.Top);

                        // Open Window
                        checklist.ShowDialog();
                    }
                    // Simplified
                    catch
                    {
                        // Start Window
                        checklist = new Checklist();

                        // Keep Window on Top
                        checklist.Owner = Window.GetWindow(this);

                        // Position Relative to MainWindow
                        checklist.Left = Math.Max((Left + (Width - checklist.Width) / 2), Left);
                        checklist.Top  = Math.Max((Top + (Height - checklist.Height) / 2), Top);

                        // Open Window
                        checklist.ShowDialog();
                    }
                }
            }

            // Clear All again to prevent doubling up on Update button
            ClearRetroArchVars();
            ClearCoresVars();
            ClearLists();
        }
예제 #2
0
        // -----------------------------------------------
        // Check Button - Tests Download URL
        // -----------------------------------------------
        private void buttonCheck_Click(object sender, RoutedEventArgs e)
        {
            // Progress Info
            textBlockProgressInfo.Text = "Checking...";

            // Call SetArchitecture Method
            Paths.SetArchitecture(this);


            // -------------------------
            // Stellar Self-Update
            // -------------------------
            if ((string)comboBoxDownload.SelectedItem == "Stellar")
            {
                // Parse GitHub Page HTML
                Parse.ParseGitHubReleases(this);

                // Check if Stellar is the Latest Version
                if (MainWindow.currentVersion != null && Parse.latestVersion != null)
                {
                    if (Parse.latestVersion > MainWindow.currentVersion)
                    {
                        MessageBox.Show("Update Available \n\n" + "v" + Parse.latestVersion + "-" + Parse.latestBuildPhase);
                    }
                    else if (Parse.latestVersion <= MainWindow.currentVersion)
                    {
                        MessageBox.Show("This version is up to date.");
                    }
                    else // null
                    {
                        MessageBox.Show("Could not find download.");
                    }
                }
            }


            // -------------------------
            // RetroArch Part
            // -------------------------
            if ((string)comboBoxDownload.SelectedItem == "New Install" ||
                (string)comboBoxDownload.SelectedItem == "Upgrade" ||
                (string)comboBoxDownload.SelectedItem == "RA+Cores" ||
                (string)comboBoxDownload.SelectedItem == "RetroArch" ||
                (string)comboBoxDownload.SelectedItem == "Redist")
            {
                // Parse Page (HTML) Method
                Parse.ParseBuildbotPage(this);

                // Display message if download available
                if (!string.IsNullOrEmpty(Parse.nightly7z)) // If Last Item in Nightlies List is available
                {
                    MessageBox.Show("Download Available \n\n" + Paths.buildbotArchitecture + "\n\n" + Parse.nightly7z);
                }
                else
                {
                    MessageBox.Show("Could not find download.");
                }
            }

            // Progress Info
            textBlockProgressInfo.Text = "";


            // -------------------------
            // Cores Part
            // -------------------------
            // If Download Combobox Cores or RA+Cores selected
            if ((string)comboBoxDownload.SelectedItem == "RA+Cores" ||
                (string)comboBoxDownload.SelectedItem == "Cores" ||
                (string)comboBoxDownload.SelectedItem == "New Cores")
            {
                // Create Builtbot Cores List
                Parse.ParseBuildbotCoresIndex(this);

                // Create PC Cores Lists
                Parse.ScanPcCoresDir(this);

                // Create Cores to Update List
                Queue.UpdatedCores(this);

                // Check if Cores Up To Date
                // If All Cores up to date, display message
                Queue.CoresUpToDateCheck(this); //Note there are Clears() in this method

                // -------------------------
                // Window Checklist Popup
                // -------------------------
                // If Update List greater than 0, Popup Checklist
                if (Queue.List_UpdatedCores_Name.Count != 0)
                {
                    // Detect which screen we're on
                    var allScreens = System.Windows.Forms.Screen.AllScreens.ToList();
                    var thisScreen = allScreens.SingleOrDefault(s => this.Left >= s.WorkingArea.Left && this.Left < s.WorkingArea.Right);

                    // Start Window
                    checklist = new Checklist();

                    // Keep Window on Top
                    checklist.Owner = Window.GetWindow(this);

                    // Position Relative to MainWindow
                    checklist.Left = Math.Max((this.Left + (this.Width - checklist.Width) / 2), thisScreen.WorkingArea.Left);
                    checklist.Top  = Math.Max((this.Top + (this.Height - checklist.Height) / 2), thisScreen.WorkingArea.Top);

                    // Open Window
                    checklist.ShowDialog();
                }
            }

            // Clear All again to prevent doubling up on Update button
            ClearRetroArchVars();
            ClearCoresVars();
            ClearLists();
        }