private string _filedlg(_promptdlgtype type, string def) { OpenFileDialog romDlg = new OpenFileDialog(); switch (type) { case _promptdlgtype.rom: string dir = _settings["defaultdirs", def]; if (!Directory.Exists(dir)) { dir = ""; } romDlg.InitialDirectory = dir; romDlg.Title = "Please select the ROM to use"; romDlg.Filter = "All ROM Files (*.nes;*.gb;*.gbc;*.gba)|*.nes;*.gb;*.gbc;*.gba|NES ROMs (*.nes)|*.nes|Gameboy ROMs (*.gb;*.gbc;*.gba)|*.gb;*.gbc;*.gba|All Files (*.*)|*.*"; break; case _promptdlgtype.emu: romDlg.Title = "Please select the emulator to use"; romDlg.Filter = "Executables (*.exe)|*.exe"; break; case _promptdlgtype.dir: //sorry, seems can't be done. default: return(null); } if (romDlg.ShowDialog() == DialogResult.OK) { return(romDlg.FileName); } else { return(null); } }
private string _filedlg(_promptdlgtype type) { return(_filedlg(type, null)); }
private string _filedlg(_promptdlgtype type) { return _filedlg(type, null); }
private string _filedlg(_promptdlgtype type, string def) { OpenFileDialog romDlg = new OpenFileDialog(); switch (type) { case _promptdlgtype.rom: string dir = _settings["defaultdirs", def]; if (!Directory.Exists(dir)) dir = ""; romDlg.InitialDirectory = dir; romDlg.Title = "Please select the ROM to use"; romDlg.Filter = "All ROM Files (*.nes;*.gb;*.gbc;*.gba)|*.nes;*.gb;*.gbc;*.gba|NES ROMs (*.nes)|*.nes|Gameboy ROMs (*.gb;*.gbc;*.gba)|*.gb;*.gbc;*.gba|All Files (*.*)|*.*"; break; case _promptdlgtype.emu: romDlg.Title = "Please select the emulator to use"; romDlg.Filter = "Executables (*.exe)|*.exe"; break; case _promptdlgtype.dir: //sorry, seems can't be done. default: return null; } if (romDlg.ShowDialog() == DialogResult.OK) return romDlg.FileName; else return null; }