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; } } }
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; } } }
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; } } }
//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; } } }
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; } } }
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; } } }