예제 #1
0
        public void LaunchGame(GameRom rom)
        {
            try
            {
                Emulator emulator = GetEmulatorByGameRom(rom);

                if (emulator != null)
                {
                    WindowState = FormWindowState.Minimized;

                    string args = string.IsNullOrWhiteSpace(emulator.Arguments) ? "" : emulator.Arguments + " ";

                    args += "\"" + rom.Path + "\"";
                    Process.Start(emulator.EmulatorPath, args);
                    rom.LastPlayedDateTime = DateTime.Now;
                }
                else
                {
                    Error("Emulator not found for the selected game file");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
 private void OpenSelectedFileLocation()
 {
     if (LstRoms.SelectedItem != null)
     {
         GameRom rom = LstRoms.SelectedItem as GameRom;
         Process.Start(rom.Directory);
     }
 }
예제 #3
0
 public GameSelectorItem(GameSelector selector, GameRom rom)
 {
     Selector = selector;
     InitializeComponent();
     Cursor       = Cursors.Hand;
     Margin       = new Padding(5);
     LbTitle.Font = ApplicationStyle.MainFont;
     SetRom(rom);
     PreviewKeyDown += GameSelectorItem_PreviewKeyDown;
 }
예제 #4
0
        public void UpdateGames(Emulator emulator)
        {
            if (emulator != Emulator)
            {
                Page = 0;
            }

            Hide();
            Emulator = emulator;
            int maxGamesPerPage = ApplicationSettings.GameSelectorMaxGamesPerPage;

            TbGames.ColumnCount = ApplicationSettings.GameSelectorColumns;
            TbGames.Controls.Clear();
            TbGames.RowCount = emulator.Roms.Count / TbGames.ColumnCount;

            Pages = emulator.Roms.Count / maxGamesPerPage + 1;

            ApplySort();
            Items.Clear();

            for (int i = Page * maxGamesPerPage; i < emulator.Roms.Count; i++)
            {
                GameRom rom = emulator.Roms[i];

                if (!DisplayOnlyFavorites || (DisplayOnlyFavorites && rom.Favorite))
                {
                    Items.Add(new GameSelectorItem(this, rom));
                }

                if (Items.Count >= maxGamesPerPage)
                {
                    break;
                }
            }

            TbGames.Controls.AddRange(Items.ToArray());

            foreach (RowStyle style in TbGames.RowStyles)
            {
                style.SizeType = SizeType.AutoSize;
            }
            foreach (ColumnStyle style in TbGames.ColumnStyles)
            {
                style.SizeType = SizeType.AutoSize;
            }

            UpdateInfo(emulator);
            Show();
            Refresh();

            if (Items.Count > 0)
            {
                Items[0].SelectItem();
            }
        }
예제 #5
0
        private void UpdateInfo()
        {
            if (LstRoms.SelectedItem == null)
            {
                return;
            }

            GameRom rom = LstRoms.SelectedItem as GameRom;

            ClearInfo();
            AddInfo(rom.FriendlyTitle);
            AddInfo("File: " + rom.File);
            AddInfo("Path: " + rom.Path);
            AddInfo("Size: " + rom.SizeDescription);
            AddInfo("Last played: " + rom.LastPlayed);
        }
예제 #6
0
 private Emulator GetEmulatorByGameRom(GameRom rom)
 {
     return(Emulators.Find(e => e.RomPath == rom.Directory));
 }
예제 #7
0
 public void SetRom(GameRom rom)
 {
     Rom = rom;
     Refresh();
 }