Exemple #1
0
 private void buttonGetMAMEName_Click(object sender, EventArgs e)
 {
     try
     {
         textBoxRomName.Text = RomFunctions.GetMAMENameFromCSV(RomFunctions.GetFileNameNoExtension(textBoxFileName.Text));
     }
     catch (Exception ex)
     {
         //FormWait.CloseWait();
         FormCustomMessage.ShowError(ex.Message);
     }
     finally
     {
         //FormWait.CloseWait();
     }
 }
        private void buttonUpdateAllRomsNames_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBoxPlatform.Text == "" || comboBoxPlatform.Text == "none")
                {
                    FormCustomMessage.ShowError("Select a platform");
                }

                Platform   platform   = PlatformBusiness.Get(comboBoxPlatform.Text);
                var        roms       = RomBusiness.GetAll(platform);
                int        count      = 0;
                List <Rom> romsUpdate = new List <Rom>();

                foreach (var rom in roms)
                {
                    var name = RomFunctions.GetMAMENameFromCSV(rom.FileNameNoExt);

                    if (name == "")
                    {
                        continue;
                    }

                    if (rom.Name != name)
                    {
                        rom.Name = name;
                        romsUpdate.Add(rom);
                        count++;
                    }
                }

                RomBusiness.SetRom(romsUpdate);
                FormCustomMessage.ShowSuccess("Rom names updated successfully! Total:" + count.ToString());
                Updated = true;
            }
            catch (Exception ex)
            {
                //FormWait.CloseWait();
                FormCustomMessage.ShowError(ex.Message);
            }
            finally
            {
                //FormWait.CloseWait();
            }
        }