Beispiel #1
0
        public override void UpdatePanel()
        {
            if (!string.IsNullOrEmpty(Emulator.Title))
            {
                txt_Title.Text = Emulator.Title;
            }

            int index = platformComboBox.FindStringExact(Emulator.PlatformTitle);

            if (index > -1)
            {
                platformComboBox.SelectedIndex = index;
            }

            EmuSettingsAutoFill.SetupAspectDropdown(thumbAspectComboBox, Emulator.CaseAspect);

            if (firstLoad)
            {
                firstLoad = false;
                if (platformComboBox.SelectedIndex > 0)
                {
                    updateEmuInfo();
                }
            }
        }
        void emuPathTextBox_TextChanged(object sender, EventArgs e)
        {
            if (!allowChangedEvents || selectedEmulator == null)
            {
                return;
            }

            EmulatorProfile autoSettings = EmuSettingsAutoFill.Instance.CheckForSettings(emuPathTextBox.Text);

            if (autoSettings == null)
            {
                return;
            }

            if (MessageBox.Show(string.Format("Would you like to use the recommended settings for {0}?", autoSettings.Title), "Use recommended settings?", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (Options.Instance.GetBoolOption("autoconfemu"))
                {
                    updateFilterBox(autoSettings.Filters);
                }

                if (autoSettings.Platform != null && platformComboBox.Text == "Unspecified")
                {
                    int index = platformComboBox.FindStringExact(autoSettings.Platform);
                    if (index > -1)
                    {
                        platformComboBox.SelectedItem = platformComboBox.Items[index];
                        EmuSettingsAutoFill.SetupAspectDropdown(thumbAspectComboBox, EmuSettingsAutoFill.Instance.GetCaseAspect(platformComboBox.Text));
                    }
                }

                if (autoSettings.HasSettings)
                {
                    argumentsTextBox.Text     = autoSettings.Arguments;
                    useQuotesCheckBox.Checked = autoSettings.UseQuotes != false; //default to true if null
                    suspendMPCheckBox.Checked = autoSettings.SuspendMP == true;
                    if (autoSettings.WorkingDirectory == EmuSettingsAutoFill.USE_EMULATOR_DIRECTORY)
                    {
                        System.IO.FileInfo file = new System.IO.FileInfo(emuPathTextBox.Text);
                        if (file.Exists)
                        {
                            workingDirTextBox.Text = file.Directory.FullName;
                        }
                    }
                    else
                    {
                        workingDirTextBox.Text = autoSettings.WorkingDirectory;
                    }

                    mountImagesCheckBox.Checked = autoSettings.MountImages;
                    escExitCheckBox.Checked     = autoSettings.EscapeToExit;
                }
            }
        }
        //Updates the panels with the selected Emulator's details.
        private void setEmulatorToPanel(ListViewItem listViewItem)
        {
            //reset status flags
            saveSelectedEmulator = false;
            saveThumbs           = false;
            saveProfile          = false;
            //get the selected Emulator
            Emulator dbEmu = listViewItem.Tag as Emulator;

            selectedEmulator = dbEmu;

            if (dbEmu == null)
            {
                return;
            }

            allowChangedEvents = false;

            int index = platformComboBox.FindStringExact(dbEmu.PlatformTitle);

            if (index < 0)
            {
                index = 0;
            }

            if (index < platformComboBox.Items.Count)
            {
                platformComboBox.SelectedItem = platformComboBox.Items[index];
            }

            txt_Title.Text           = dbEmu.Title;
            romDirTextBox.Text       = dbEmu.PathToRoms;
            filterTextBox.Text       = dbEmu.Filter;
            isArcadeCheckBox.Checked = dbEmu.IsArcade;
            txt_company.Text         = dbEmu.Company;
            txt_yearmade.Text        = dbEmu.Year.ToString();
            txt_description.Text     = dbEmu.Description;
            gradeUpDown.Value        = dbEmu.Grade;

            EmuSettingsAutoFill.SetupAspectDropdown(thumbAspectComboBox, dbEmu.CaseAspect);

            videoTextBox.Text = dbEmu.VideoPreview;

            idLabel.Text = dbEmu.UID.ToString();

            if (emuThumbs != null)
            {
                emuThumbs.Dispose();
            }
            emuThumbs = new ThumbGroup(dbEmu);

            if (mainTabControl.SelectedTab == thumbsTabPage)
            {
                setGameArt(emuThumbs);
                thumbsLoaded = true;
            }
            else
            {
                setGameArt(null);
                thumbsLoaded = false;
            }

            txt_Manual.Text = emuThumbs.ManualPath;


            selectedProfile = null;
            profileComboBox.Items.Clear();
            foreach (EmulatorProfile profile in DB.Instance.GetProfiles(selectedEmulator))
            {
                profileComboBox.Items.Add(profile);
                if (profile.IsDefault)
                {
                    profileComboBox.SelectedItem = profile;
                    selectedProfile = profile;
                }
            }

            allowChangedEvents = true;
            profileComboBox_SelectedIndexChanged(profileComboBox, new EventArgs());
        }