示例#1
0
        private void newDiscButton_Click(object sender, EventArgs e)
        {
            if (selectedGame == null)
            {
                return;
            }

            string filter    = selectedGame.ParentEmulator.Filter;
            string filterStr = string.Format("{0} rom ({1}) | {2}|All files (*.*) | *.*", selectedGame.ParentEmulator.Title, filter.Replace(";", ", "), filter);

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Select file", filterStr, System.IO.Path.GetDirectoryName(selectedGame.Path)))
            {
                dlg.Multiselect = true;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    foreach (string filename in dlg.FileNames)
                    {
                        GameDisc newDisc = new GameDisc(selectedGame);
                        newDisc.Path = filename;
                        int index = discBindingSource.Add(newDisc);
                        newDisc.Number = index + 1;
                    }
                    saveDiscs = true;
                }
            }
        }
示例#2
0
        private void videoButton_Click(object sender, EventArgs e)
        {
            if (selectedGame == null)
            {
                return;
            }

            string filter = "All files (*.*) | *.*";
            string initialDirectory;

            if (System.IO.File.Exists(videoTextBox.Text))
            {
                initialDirectory = System.IO.Directory.GetParent(videoTextBox.Text).FullName;
            }
            else
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Select path to preview video", filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    videoTextBox.Text = dlg.FileName;
                }
            }
        }
示例#3
0
        private void btnNewManual_Click(object sender, EventArgs e)
        {
            if (selectedGame == null)
            {
                return;
            }

            string filter = "PDF | *.pdf";

            string initialDirectory;

            if (txt_Manual.Text != "" && txt_Manual.Text.LastIndexOf("\\") > -1)
            {
                initialDirectory = txt_Manual.Text.Remove(txt_Manual.Text.LastIndexOf("\\"));
            }
            else
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Select manual", filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    txt_Manual.Text = dlg.FileName;
                }
            }
        }
示例#4
0
        //show dialog allowing user to select path to backup
        private void restorePathButton_Click(object sender, EventArgs e)
        {
            string title            = "Select backup file...";
            string filter           = "XML (*.xml)|*.xml";
            string initialDirectory = null;
            string path             = restorePathTextBox.Text;

            if (!string.IsNullOrEmpty(path))
            {
                int index = path.LastIndexOf("\\");
                if (index > -1)
                {
                    path = path.Remove(index);
                }
                if (System.IO.Directory.Exists(path))
                {
                    initialDirectory = path;
                }
            }
            if (initialDirectory == null)
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog(title, filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    restorePathTextBox.Text = dlg.FileName;
                }
            }
        }
示例#5
0
        private void pathBrowseButton_Click(object sender, EventArgs e)
        {
            string filter = "All files (*.*) | *.*";
            string initialDirectory;
            int    index = pathTextBox.Text.LastIndexOf("\\");

            if (index > -1)
            {
                initialDirectory = pathTextBox.Text.Remove(index);
            }
            else
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Path to game", filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    pathTextBox.Text = dlg.FileName;
                }
            }
        }
示例#6
0
        private void emuPathBrowseButton_Click(object sender, EventArgs e)
        {
            string filter = "Executables (*.bat, *.exe) | *.bat;*.exe";

            string initialDirectory;
            int    index = emuPathTextBox.Text.LastIndexOf("\\");

            if (index > -1)
            {
                initialDirectory = emuPathTextBox.Text.Remove(index);
            }
            else
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Select path to emulator", filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    emuPathTextBox.Text = dlg.FileName;
                }
            }
        }