private void ReloadInfo() { if (currentApp == null) { groupBoxOptions.Visible = true; groupBoxOptions.Enabled = false; labelID.Text = "ID: "; textBoxName.Text = ""; radioButtonOne.Checked = true; radioButtonTwo.Checked = false; radioButtonTwoSim.Checked = false; maskedTextBoxReleaseDate.Text = ""; textBoxPublisher.Text = ""; textBoxArguments.Text = ""; pictureBoxArt.Image = null; buttonBrowseImage.Enabled = false; buttonGoogle.Enabled = false; } else { groupBoxOptions.Visible = true; labelID.Text = "ID: " + currentApp.Code; textBoxName.Text = currentApp.Name; if (currentApp.Simultaneous && currentApp.Players == 2) { radioButtonTwoSim.Checked = true; } else if (currentApp.Players == 2) { radioButtonTwo.Checked = true; } else { radioButtonOne.Checked = true; } maskedTextBoxReleaseDate.Text = currentApp.ReleaseDate; textBoxPublisher.Text = currentApp.Publisher; textBoxArguments.Text = currentApp.Command; if (System.IO.File.Exists(currentApp.IconPath)) { pictureBoxArt.Image = NesMiniApplication.LoadBitmap(currentApp.IconPath); } else { pictureBoxArt.Image = null; } buttonShowGameGenieDatabase.Enabled = textBoxGameGenie.Enabled = currentApp is NesGame; textBoxGameGenie.Text = (currentApp is NesGame) ? (currentApp as NesGame).GameGenie : ""; groupBoxOptions.Enabled = true; if (currentApp.GetType() != typeof(NesDefaultGame)) { Enable(); } else { Disable(); } } }
public string GetRomFile(NesMiniApplication app) { System.Collections.Generic.List <string> exts = new System.Collections.Generic.List <string>(AppTypeCollection.GetAppByType(app.GetType()).Extensions); List <string> expectedFiles = new List <string>(); expectedFiles.Add(app.Code + ".desktop"); expectedFiles.Add(app.Code + ".png"); expectedFiles.Add(app.Code + "_small.png"); List <string> possibleRomFiles = new List <string>(); List <string> zFiles = new List <string>(); foreach (string f in System.IO.Directory.GetFiles(app.GamePath)) { string fileName = System.IO.Path.GetFileName(f); if (!expectedFiles.Contains(fileName)) { string ext = System.IO.Path.GetExtension(fileName); if (ext == ".7z") { zFiles.Add(fileName); } else { if (!exts.Contains(ext)) { } else { possibleRomFiles.Add(fileName); } } } } string tempCommand = app.Command; tempCommand = tempCommand.Replace(".nes .7z", ".nes.7z"); /*Find if of the file is linked in the commande*/ string foundRom = ""; foreach (string z in zFiles) { if (tempCommand.Contains(z)) { foundRom = z; break; } } if (foundRom == "") { /*Rom was not found in 7z*/ foreach (string z in possibleRomFiles) { if (tempCommand.Contains(z)) { foundRom = z; break; } } } if (foundRom == "") { //Cant find rom from command line, now analyse files if (zFiles.Count >= 1) { //Most likely this one foundRom = zFiles[0]; } else { if (possibleRomFiles.Count >= 1) { foundRom = possibleRomFiles[0]; } } } if (foundRom == "") { string test = "abc"; } return(foundRom); }