private void openROMToolStripMenuItem_Click(object sender, EventArgs e) { string file_path = ""; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "Select a ROM to edit."; openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); openFileDialog.RestoreDirectory = true; openFileDialog.Filter = "NDS ROM (*.nds)|*.nds"; DialogResult result = openFileDialog.ShowDialog(); // Testing the open file dialog result. if (result != DialogResult.OK) { // Presumption of cancellation. return; } if (!openFileDialog.CheckFileExists) { CustomMessageBox.Show("File Doesn't Exist", "Cannot find the specified file."); } file_path = openFileDialog.FileName; openFileDialog.Dispose(); NDSROM rom = new NDSROM(file_path); new DocumentROM(TabManager.tabInterfaces.First(), rom); }
public DocumentROM(TabInterface tabInterface, NDSROM rom) { ROMViewer viewer = new ROMViewer(rom); viewer.Dock = DockStyle.Fill; string rom_title = "[" + rom.GameCode + "] " + rom.GameTitle; documentTab = new Tab(tabInterface, rom_title); documentTab.tabControl = viewer; documentTab.tabDocument = this; tabInterface.OpenTab(documentTab); tabInterface.ActivateTab(documentTab); }