Exemple #1
0
        private ROMImageList LoadROMs(GameSystem system)
        {
            if (!Directory.Exists(system.ROMsFolder))
            {
                MessageBox.Show(
                    "The ROM folder configured for this system does not exist.",
                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return(null);
            }

            DirectoryInfo dir = new DirectoryInfo(system.ROMsFolder);

            FileInfo[]   files      = dir.GetFiles();
            string[]     extensions = system.ROMExtensions.Split('|');
            ROMImageList roms       = new ROMImageList();

            foreach (FileInfo file in files)
            {
                foreach (string ext in extensions)
                {
                    if (!file.Name.Trim().ToLower().EndsWith("." + ext.Trim().ToLower()))
                    {
                        continue;
                    }

                    roms.Add(new ROMImage(file.Name, system));
                }
            }

            return(roms);
        }
Exemple #2
0
        private void ListGameSystems_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListBox      list = sender as ListBox;
            GameSystem   sys  = list.SelectedItem as GameSystem;
            ROMImageList roms = LoadROMs(sys);

            if (roms == null)
            {
                return;
            }

            if (roms.Count == 0)
            {
                MessageBox.Show(
                    "There are no games to display for this system.",
                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            Hide();
            ROMSelectionForm romSelector = new ROMSelectionForm(this, roms, sys.Name);

            romSelector.Show();
        }
Exemple #3
0
        public ROMSelectionForm(SystemSelectionForm form, ROMImageList roms, string system)
        {
            InitializeComponent();
            SystemSelectionForm = form;
            ROMList             = roms;
            StSystem.Text       = system;
            UpdateListBox();
            if (ListROMs.Items.Count > 0)
            {
                ListROMs.SelectedIndex = 0;
            }

            this.Icon        = SystemSelectionForm.Icon;
            this.Text        = SystemSelectionForm.Text;
            this.WindowState = SystemSelectionForm.WindowState;
            this.Location    = SystemSelectionForm.Location;
            this.Size        = SystemSelectionForm.Size;
        }