public List <CuratorDataSet.ROMRow> GetRomsForConsole(CuratorDataSet.ConsoleRow console, bool filtered = true) { var romFolders = Form1._romFolderController.GetRomFoldersForConsole(console); var roms = RomData.Where(x => x.RowState != System.Data.DataRowState.Deleted).Where(x => romFolders.Select(y => y.Id).Contains(x.RomFolder_Id)); return(filtered ? FilterRoms(roms).ToList() : roms.ToList()); }
public List <CuratorDataSet.RomFolderRow> GetRomFoldersForConsole(CuratorDataSet.ConsoleRow console) { if (console == null) { return(new List <CuratorDataSet.RomFolderRow>()); } return(RomFolderData.Where(x => x.RowState != DataRowState.Deleted).Where(x => x.Console_Id == console.Id).ToList()); }
public string GetExePath(CuratorDataSet.ROMRow rom, CuratorDataSet.ConsoleRow console) { var romArgs = rom.OverrideArgs ? rom.CustomArgs : $"{console.RomArgs} {rom.CustomArgs}"; var exepath = $"\"{console.EmulatorPath}\" {console.EmulatorArgs} \"{rom.FileName}\""; if (!string.IsNullOrWhiteSpace(romArgs)) { exepath += $" {romArgs}"; } return(exepath); }
internal void AddToConsole(string path, CuratorDataSet.ConsoleRow console, bool addSubFolders = false) { if (addSubFolders) { var subDirectories = Directory.GetDirectories(path); foreach (var directory in subDirectories) { AddToConsole(directory, console, addSubFolders); } } var romFolder = RomFolderData.NewRomFolderRow(); romFolder.Path = path; romFolder.Console_Id = console.Id; RomFolderData.Rows.Add(romFolder); }
private void RemoveConsole(CuratorDataSet.ConsoleRow console, object sender, EventArgs e) { if (MetroMessageBox.Show(this, "This will delete the console and all of it's associated data!", "Are you sure?", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (_steamController.ShortcutsContainConsole(console.Name)) { var deleteFromSteam = MetroMessageBox.Show(this, $"You have existing Shortcuts with the label '{console.Name}'. Remove these Shortcuts from Steam?", "Are you sure?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (deleteFromSteam == DialogResult.Yes) { _steamController.DeleteShortcutsByTag(console_ComboBox.Text); ShowSteamModifiedMessage(); } if (deleteFromSteam == DialogResult.Cancel) { return; } } _consoleController.Remove(console); ConsoleHasChanged(sender, e); } }
internal void SaveFilterForConsole(CuratorDataSet.ConsoleRow selectedConsole, string fileExtensions) { selectedConsole.Filter = fileExtensions; }
public void Remove(CuratorDataSet.ConsoleRow console) { Consoles.Rows.Remove(console); }
public void SetActiveConsole(CuratorDataSet.ConsoleRow console) { Form1.ActiveConsole = console; }
public static CuratorDataSet.ConsoleRow ShowDialog(IWin32Window window) { Form prompt = new Form() { Width = 500, Height = 200, FormBorderStyle = FormBorderStyle.FixedDialog, Text = "Add ROM Folder", StartPosition = FormStartPosition.CenterScreen, MinimizeBox = false, MaximizeBox = false }; Label consoleNameLabel = new Label() { Left = 18, Top = 20, Text = "Select Console" }; var consoleSelector = new ComboBox() { Left = 20, Top = 40, Width = 150, DropDownStyle = ComboBoxStyle.DropDownList }; consoleSelector.Items.AddRange(Form1._consoleController.GetAllConsoles().Select(x => x.Name).ToArray()); if (Form1.ActiveConsole != null) { consoleSelector.SelectedItem = consoleSelector.Items[consoleSelector.Items.IndexOf(Form1.ActiveConsole.Name)]; } var romFolderPathDisplayBox = new TextBox { ReadOnly = true, Left = 20, Top = 95, Width = 380 }; var romFolderFileSelector = new Button() { Text = "Select Folder", Left = 18, Top = 70, Width = 80 }; var romFolderToAdd = string.Empty; romFolderFileSelector.Click += (sender, e) => { var folderBrowser = new FolderBrowserDialog(); if (folderBrowser.ShowDialog() == DialogResult.OK) { romFolderToAdd = folderBrowser.SelectedPath; romFolderPathDisplayBox.Text = folderBrowser.SelectedPath; } }; var includeSubFoldersCheckbox = new CheckBox() { Text = "Include Sub-Folders", Left = 20, Top = 130, Width = 150, CheckAlign = System.Drawing.ContentAlignment.MiddleLeft }; Button okButton = new Button() { Text = "Ok", Left = 350, Width = 50, Top = 130 }; okButton.Click += (sender, e) => { console = Form1._consoleController.GetAllConsoles().FirstOrDefault(x => x.Name == consoleSelector.Text); if (console == null) { return; } Form1._romFolderController.AddToConsole(romFolderToAdd, console, includeSubFoldersCheckbox.Checked); }; Button cancelButton = new Button() { Text = "Cancel", Left = 410, Width = 50, Top = 130, DialogResult = DialogResult.Cancel }; okButton.Click += (sender, e) => { if (string.IsNullOrWhiteSpace(consoleSelector.Text)) { ShowError(consoleSelector, "Please select a Console"); return; } else { prompt.DialogResult = DialogResult.OK; } }; prompt.Controls.Add(consoleSelector); prompt.Controls.Add(okButton); prompt.Controls.Add(cancelButton); prompt.Controls.Add(consoleNameLabel); prompt.Controls.Add(romFolderFileSelector); prompt.Controls.Add(romFolderPathDisplayBox); prompt.Controls.Add(includeSubFoldersCheckbox); prompt.AcceptButton = okButton; prompt.CancelButton = cancelButton; return(prompt.ShowDialog() == DialogResult.OK ? console : null); }