public void ProcessExecutable(string fileName) { var game = SettingsManager.ProcessExecutable(fileName); GamesDataGridView.ClearSelection(); object selelectItemKey = null; if (game != null) { selelectItemKey = game.GameId; } ControlHelper.ShowHideAndSelectGridRows(GamesDataGridView, ShowGamesDropDownButton, null, selelectItemKey); }
void AddNewGame() { var fullPath = ""; var row = GamesDataGridView.SelectedRows.Cast <DataGridViewRow>().FirstOrDefault(); if (row != null) { var item = (x360ce.Engine.Data.Game)row.DataBoundItem; fullPath = item.FullPath; } var path = ""; AddGameOpenFileDialog.DefaultExt = ".exe"; if (!string.IsNullOrEmpty(fullPath)) { var fi = new System.IO.FileInfo(fullPath); if (string.IsNullOrEmpty(path)) { path = fi.Directory.FullName; } AddGameOpenFileDialog.FileName = fi.Name; } AddGameOpenFileDialog.Filter = EngineHelper.GetFileDescription(".exe") + " (*.exe)|*.exe|All files (*.*)|*.*"; AddGameOpenFileDialog.FilterIndex = 1; AddGameOpenFileDialog.RestoreDirectory = true; if (string.IsNullOrEmpty(path)) { path = System.IO.Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)); } AddGameOpenFileDialog.InitialDirectory = path; AddGameOpenFileDialog.Title = "Browse for Executable"; var result = AddGameOpenFileDialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { // Don't allow to add windows folder. var winFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Windows); if (AddGameOpenFileDialog.FileName.StartsWith(winFolder)) { MessageBoxForm.Show("Windows folders are not allowed.", "Windows Folder", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ProcessExecutable(AddGameOpenFileDialog.FileName); GamesDataGridView.ClearSelection(); RebindGames(System.IO.Path.GetFileName(AddGameOpenFileDialog.FileName)); } } }
public void ProcessExecutable(string fileName) { SettingsManager.ProcessExecutable(fileName); GamesDataGridView.ClearSelection(); ShowHideAndSelectGridRows(Path.GetFileName(fileName)); }
public void ProcessExecutable(string fileName) { SettingsFile.Current.ProcessExecutable(fileName); GamesDataGridView.ClearSelection(); RebindGames(Path.GetFileName(fileName)); }