public string GetTranslatedMessage(Settings.Languages Language, int MessageID, string DefaultValue) { if (_messagesTranslations != null && _messagesTranslations.ContainsKey(MessageID)) return _messagesTranslations[MessageID].GetTranslation(Language); return DefaultValue; }
public GamesPanelsBase() { InitializeComponent(); this.Dock = DockStyle.Fill; _settings = (Settings)null; _translator = (TranslationsHelpers)null; }
public GamesPanelsBase(AppManager manager) { InitializeComponent(); this.Dock = DockStyle.Fill; _settings = manager.AppSettings; _translator = manager.Translator; }
private void CompileUI(Helpers.Data.Objects.Settings AppSettings) { txtDosBoxExePath.Text = AppSettings.DosboxPath; txtDosBoxConfigFile.Text = AppSettings.DosboxDefaultConfFilePath; txtDosBoxLanguageFile.Text = AppSettings.DosboxDefaultLangFilePath; chkPortable.Checked = AppSettings.PortableMode; }
public BaseSettingsPanel(TranslationsHelpers Translator, Settings AppSettings, string PanelName) { InitializeComponent(); this.Dock = DockStyle.Fill; _AppSettings = AppSettings; _translator = Translator; this.PanelName = PanelName; }
public CategoryDialog(AppManager manager) { InitializeComponent(); _translator = manager.Translator; _AppSettings = manager.AppSettings; this.Text = _translator.GetTranslatedMessage(_AppSettings.Language, 35, "Add New Category"); _translator.TranslateUI(_AppSettings.Language, this.Name, this.Controls); }
public GamesPanelsBase(AppManager manager, List<Game> games, Dictionary<String, Category> cats) { InitializeComponent(); this.Dock = DockStyle.Fill; _settings = manager.AppSettings; _translator = manager.Translator; _games = games; _cats = cats; }
public CategoryDialog(Helpers.Data.Objects.Settings AppSettings, TranslationsHelpers translator, Category editCat) { InitializeComponent(); _translator = translator; _AppSettings = AppSettings; this.Text = _translator.GetTranslatedMessage(_AppSettings.Language, 36, "Edit Category"); _translator.TranslateUI(_AppSettings.Language, this.Name, this.Controls); PopulateForm(editCat); }
public GamesPanel(TranslationsHelpers Translator, Settings AppSettings, string PanelName) : base(Translator, AppSettings, PanelName) { _flgInitiation = true; InitializeComponent(); _dialogsHelpers = new DialogsHelpers(); CompileUI(_AppSettings); _flgInitiation = false; }
public GamePanelBase(AppManager Manager, DialogsHelpers DialogsHelpers, Game GameData) { InitializeComponent(); _manager = Manager; _settings = _manager.AppSettings; _translator = _manager.Translator; _dialogsHelpers = DialogsHelpers; _game = GameData; }
private void CompileUI(Helpers.Data.Objects.Settings AppSettings) { txtDefaultGamesFolder.Text = AppSettings.GamesDefaultDir; txtDefaultImagesFolder.Text = AppSettings.CDsDefaultDir; txtAdditionalCommands.Text = AppSettings.GamesAdditionalCommands; chkNoConsole.Checked = AppSettings.GamesNoConsole; chkQuitOnExit.Checked = AppSettings.GamesQuitOnExit; chkFullscreen.Checked = AppSettings.GamesInFullScreen; chk3DBox.Checked = AppSettings.BoxRendered; }
public AppManager() { _SettingsDB = new SettingsManager("settings.dbm"); _translator = new TranslationsHelpers(_SettingsDB.LoadMessagesTranslations(), _SettingsDB.LoadComponentsTranslations()); _AppSettings = _SettingsDB.LoadSettings(); _recentDBs = _SettingsDB.LoadRecentDatabases(); _DB = new Database(); _DosBoxHelper = new DOSBoxHelpers(); _fileHelper = new FileHelpers(); }
public BehavioursPanel(TranslationsHelpers Translator, Settings AppSettings, SettingsManager SettingsDB, string PanelName) : base(Translator, AppSettings, PanelName) { _flgInitiation = true; InitializeComponent(); _helpers = new SettingsHelpers(); _dialogsHelpers = new DialogsHelpers(); _SettingsDB = SettingsDB; CompileUI(_AppSettings); _flgInitiation = false; }
public SettingsDialog(AppManager manager) { InitializeComponent(); _Settings = (Settings)manager.AppSettings.Clone(); _manager = manager; _Translator = manager.Translator; this.Text = _Translator.GetTranslatedMessage(_Settings.Language, 51, "Application Settings"); _Translator.TranslateUI(_Settings.Language, this.Name, this.Controls); InitiateUI(); }
public void TranslateMenusUI(Settings.Languages Language, String FormName, ToolStripItemCollection menuCollection) { if (_componentsTranslations != null) { foreach (object mnu in menuCollection) { if (mnu.GetType() != typeof(ToolStripSeparator)) { ToolStripMenuItem itm = (ToolStripMenuItem)mnu; if (_componentsTranslations.ContainsKey(FormName + itm.Name)) { itm.Text = _componentsTranslations[FormName + itm.Name].GetTranslation(Language); itm.ToolTipText = _componentsTranslations[FormName + itm.Name].GetTooltipTranslation(Language); } if (itm.HasDropDownItems) TranslateMenusUI(Language, FormName, itm.DropDownItems); } } } }
public String BuildArgs(bool Setup, Game game, Settings settings) { //Arguments string for DOSBox.exe String Arguments = String.Empty; if (settings.DosboxPath != String.Empty && settings.DosboxPath != "dosbox.exe isn't in the same directory as DosBoxManager.exe!" && File.Exists(settings.DosboxPath)) { String qt = char.ToString('"'); if (game.Directory[0] != '/') qt = "'"; //string for the Game's configuration file. String DBCfgPath = String.Empty; //if the "do not use any config file at all" has not been checked if (game.NoConfig == false) { //use at first the game's custom config file if (game.DBConfigPath != String.Empty) DBCfgPath = game.DBConfigPath; //if not, use the default dosbox.conf file else if (settings.DosboxDefaultConfFilePath != String.Empty && settings.DosboxDefaultConfFilePath != "No configuration file (*.conf) found in DosBoxManager's directory.") DBCfgPath = settings.DosboxDefaultConfFilePath; } //The arguments for DOSBox begins with the game executable (.exe, .bat, or .com) if (game.DOSExePath != String.Empty) { if (!Setup) Arguments = '"' + game.DOSExePath + '"'; else Arguments = '"' + game.DOSExePath + '"'; } //the game directory mounted as C (if the DOSEXEPath is specified, the DOSEXEPath parent directory will be mounted as C: by DOSBox //hence the "else if" instead of "if". else if (game.Directory != String.Empty) Arguments = " -c " + '"' + "mount c " + qt + game.Directory + qt + '"'; //puting DBCfgPath and Arguments together if (DBCfgPath != String.Empty) Arguments = Arguments + " -conf " + '"' + DBCfgPath + '"'; //Path for the default language file used for DOSBox and specified by the user in the Tools menu if (settings.DosboxDefaultLangFilePath != String.Empty && settings.DosboxDefaultLangFilePath != "No language file (*.lng) found in DosBoxManager's directory.") Arguments = Arguments + " -lang " + '"' + settings.DosboxDefaultLangFilePath + '"'; //Path for the game's CD image (.bin, .cue, or .iso) mounted as D: if (game.CDPath != String.Empty) { //put ' and _not_ " after imgmount (or else the path will be misunderstood by DOSBox). Paths with spaces will NOT work either way on GNU/Linux! if (game.IsCDImage == true) { Arguments = Arguments + " -c " + '"' + "imgmount"; if (game.MountAsFloppy == true) Arguments = Arguments + " a " + qt + game.CDPath + qt + " -t floppy" + '"'; else Arguments = Arguments + " d " + qt + game.CDPath + qt + " -t iso" + '"'; } else { if (game.UseIOCTL == true) Arguments = Arguments + " -c " + '"' + "mount d " + qt + game.CDPath + qt + " -t cdrom -usecd 0 -ioctl" + '"'; else if (game.MountAsFloppy == true) Arguments = Arguments + " -c " + '"' + "mount a " + qt + game.CDPath + qt + " -t floppy" + '"'; else Arguments = Arguments + " -c " + '"' + "mount d " + qt + game.CDPath + qt; } } //Additionnal user commands for the game if (game.AdditionalCommands != String.Empty) Arguments = Arguments + " " + game.AdditionalCommands; //corresponds to the Fullscreen checkbox in GameForm if (game.InFullScreen == true) Arguments = Arguments + " -fullscreen"; //corresponds to the "no console" checkbox in the GameForm if (game.NoConsole == true) Arguments = Arguments + " -noconsole"; //corresponds to the "quit on exit (only for .exe)" checkbox in the GameForm if (game.QuitOnExit == true) Arguments = Arguments + " -exit"; return Arguments; } else { return null; } }
public void SaveSettings(Settings AppSettings) { if (AppSettings == null) throw new Exception("No application settings provided!"); try { if (_Connection.State != System.Data.ConnectionState.Open) //I raise an error as there is no connection to the database throw new Exception("There is no connection to the database"); StringBuilder sql = new StringBuilder(); sql.AppendLine("UPDATE Settings SET "); sql.AppendLine(string.Format("app_width = {0}, ", AppSettings.AppWidth)); sql.AppendLine(string.Format("app_height = {0}, ", AppSettings.AppHeight)); sql.AppendLine(string.Format("portable_mode = {0}, ", BoolToInt(AppSettings.PortableMode))); sql.AppendLine(string.Format("dosbox_path = '{0}', ", AppSettings.DosboxPath.Replace("'", "''"))); sql.AppendLine(string.Format("dosbox_default_conf_file_path = '{0}', ", AppSettings.DosboxDefaultConfFilePath.Replace("'", "''"))); sql.AppendLine(string.Format("dosbox_default_lang_file_path = '{0}', ", AppSettings.DosboxDefaultLangFilePath.Replace("'", "''"))); sql.AppendLine(string.Format("cds_default_dir = '{0}', ", AppSettings.CDsDefaultDir.Replace("'", "''"))); sql.AppendLine(string.Format("games_default_dir = '{0}', ", AppSettings.GamesDefaultDir.Replace("'", "''"))); sql.AppendLine(string.Format("games_no_console = {0}, ", BoolToInt(AppSettings.GamesNoConsole))); sql.AppendLine(string.Format("games_in_full_screen = {0}, ", BoolToInt(AppSettings.GamesInFullScreen))); sql.AppendLine(string.Format("games_quit_on_exit = {0}, ", BoolToInt(AppSettings.GamesQuitOnExit))); sql.AppendLine(string.Format("games_additional_commands = '{0}', ", AppSettings.GamesAdditionalCommands.Replace("'", "''"))); sql.AppendLine(string.Format("box_rendered = {0}, ", BoolToInt(AppSettings.BoxRendered))); sql.AppendLine(string.Format("app_fullscreen = {0}, ", BoolToInt(AppSettings.AppFullscreen))); sql.AppendLine(string.Format("menu_bar_visible = {0}, ", BoolToInt(AppSettings.MenuBarVisible))); sql.AppendLine(string.Format("toolbar_visible = {0}, ", BoolToInt(AppSettings.ToolbarVisible))); sql.AppendLine(string.Format("status_bar_visible = {0}, ", BoolToInt(AppSettings.StatusBarVisible))); sql.AppendLine(string.Format("config_editor_path = '{0}', ", AppSettings.ConfigEditorPath.Replace("'", "''"))); sql.AppendLine(string.Format("config_editor_additional_parameters = '{0}', ", AppSettings.ConfigEditorAdditionalParameters.Replace("'", "''"))); sql.AppendLine(string.Format("category_delete_prompt = {0}, ", BoolToInt(AppSettings.CategoryDeletePrompt))); sql.AppendLine(string.Format("game_delete_prompt = {0}, ", BoolToInt(AppSettings.GameDeletePrompt))); sql.AppendLine(string.Format("remember_window_size = {0}, ", BoolToInt(AppSettings.RememberWindowSize))); sql.AppendLine(string.Format("reload_latest_db = {0}, ", BoolToInt(AppSettings.ReloadLatestDB))); sql.AppendLine(string.Format("language = {0}, ", ((AppSettings.Language == Settings.Languages.English) ? 0 : 1))); sql.AppendLine(string.Format("reduce_to_tray_on_play = {0};", BoolToInt(AppSettings.ReduceToTrayOnPlay))); SQLiteCommand command = new SQLiteCommand(sql.ToString(), _Connection); command.ExecuteNonQuery(); } catch (Exception e) { CustomMessageBox cmb = new CustomMessageBox("An issues raised trying to save the application settings:\n" + e.Message, "Error", MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false); cmb.ShowDialog(); cmb.Dispose(); } }
private static Settings GetDefaultSettings() { Settings result = new Settings(); result.AppWidth = 800; result.AppHeight = 600; result.PortableMode = false; result.DosboxPath = string.Empty; result.DosboxDefaultConfFilePath = string.Empty; result.DosboxDefaultLangFilePath = string.Empty; result.CDsDefaultDir = string.Empty; result.GamesDefaultDir = string.Empty; result.GamesNoConsole = false; result.GamesInFullScreen = false; result.GamesQuitOnExit = false; result.GamesAdditionalCommands = string.Empty; result.BoxRendered = false; result.AppFullscreen = false; result.MenuBarVisible = true; result.ToolbarVisible = true; result.StatusBarVisible = true; result.ConfigEditorPath = string.Empty; result.ConfigEditorAdditionalParameters = string.Empty; result.CategoryDeletePrompt = true; result.GameDeletePrompt = true; result.RememberWindowSize = true; result.ReloadLatestDB = false; result.Language = Settings.Languages.English; result.ReduceToTrayOnPlay = true; return result; }
private void CompileUI(Settings AppSettings) { txtTextEditor.Text = AppSettings.ConfigEditorPath; txtAdditionalCommands.Text = AppSettings.ConfigEditorAdditionalParameters; chkRememberSize.Checked = AppSettings.RememberWindowSize; chkMenuBar.Checked = AppSettings.MenuBarVisible; chkStatusBar.Checked = AppSettings.StatusBarVisible; chkToolbar.Checked = AppSettings.ToolbarVisible; chkPromptGame.Checked = AppSettings.GameDeletePrompt; chkCategoryDelete.Checked = AppSettings.CategoryDeletePrompt; chkReload.Checked = AppSettings.ReloadLatestDB; chkToTrayOnPlay.Checked = AppSettings.ReduceToTrayOnPlay; cboLanguage.Items.Clear(); cboLanguage.Items.Add(new ItemData(0, "English")); cboLanguage.Items.Add(new ItemData(1, "Italian")); cboLanguage.SelectedIndex = AppSettings.Language == Settings.Languages.English ? 0 : 1; }
public bool MakeGamesConfiguration(TranslationsHelpers translator, Settings settings, Game game) { string body; string title; CustomMessageBox cmb; if (game != null && settings.DosboxDefaultConfFilePath != String.Empty) { if(File.Exists(settings.DosboxDefaultConfFilePath)){ body = "'" + game.Directory + "/" + Path.GetFileName(settings.DosboxDefaultConfFilePath) + "' " + translator.GetTranslatedMessage(settings.Language, 64, "already exists, do you want to overwrite it ?"); title = translator.GetTranslatedMessage(settings.Language, 8, "Attention"); cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Question, false, false); if ((!File.Exists(game.Directory + "/" + Path.GetFileName(settings.DosboxDefaultConfFilePath))) || (cmb.ShowDialog() == DialogResult.Yes)) { if (Directory.Exists(game.Directory)) { File.Copy(settings.DosboxDefaultConfFilePath, game.Directory + "/" + Path.GetFileName(settings.DosboxDefaultConfFilePath), true); game.DBConfigPath = game.Directory + "/" + Path.GetFileName(settings.DosboxDefaultConfFilePath); body = translator.GetTranslatedMessage(settings.Language, 65, "The configuration file has been created correctly."); title = translator.GetTranslatedMessage(settings.Language, 66, "Success"); cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Information, false, false); cmb.ShowDialog(); cmb.Dispose(); return true; } else { body = translator.GetTranslatedMessage(settings.Language, 67, "The path to the selected game seems missing, please check and eventually modify the game folder location to continue."); title = translator.GetTranslatedMessage(settings.Language, 28, "Error"); cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false); cmb.ShowDialog(); cmb.Dispose(); return false; } } else { return false; } } else { body = translator.GetTranslatedMessage(settings.Language, 68, "The path to the given DosBox configuration file seems missing, please check and eventually modify the DosBox configuration file location to continue."); title = translator.GetTranslatedMessage(settings.Language, 28, "Error"); cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false); cmb.ShowDialog(); cmb.Dispose(); return false; } } return false; }
public String SearchDOSBox(TranslationsHelpers translator, Settings settings, bool isPortableMode) { String DOSBoxPath; DOSBoxPath = String.Empty; if (isPortableMode) { if (File.Exists(Application.StartupPath + "\\dosbox.exe")) DOSBoxPath = Application.StartupPath + "\\dosbox.exe"; else if (File.Exists(Application.StartupPath + "\\dosbox")) DOSBoxPath = Application.StartupPath + "\\dosbox"; } else { //test if DOSBox is in Program Files/DOSBox-?.?? (Windows x86) if (Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "DOSBox*", SearchOption.TopDirectoryOnly).GetLength(0) != 0) { DOSBoxPath = Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "DOSBox*", SearchOption.TopDirectoryOnly)[0]; if (File.Exists(DOSBoxPath + "\\dosbox.exe")) DOSBoxPath = DOSBoxPath + "\\dosbox.exe"; } else { //test if the user is using Windows x64 //in this case, DOSBox's installation directory is most likely in "Program Files (x86)" if (Directory.Exists(Environment.SystemDirectory.Substring(0, 3) + "Program Files (x86)")) { if (Directory.GetDirectories(Environment.SystemDirectory.Substring(0, 3) + "Program Files (x86)", "DOSBox*", SearchOption.TopDirectoryOnly).GetLength(0) != 0) { DOSBoxPath = Directory.GetDirectories(Environment.SystemDirectory.Substring(0, 3) + "Program Files (x86)", "DOSBox*", SearchOption.TopDirectoryOnly)[0]; if (File.Exists(DOSBoxPath + "\\dosbox.exe")) DOSBoxPath = DOSBoxPath + "\\dosbox.exe"; } } } } //if DOSBoxPath is still empty, say to the user that dosbox's executable cannot be found if (DOSBoxPath == String.Empty) { string body = translator.GetTranslatedMessage(settings.Language, 69, "DOSBox Manager cannot find DOSBox, do you want to indicate DOSBox's executable location now?"); string title = translator.GetTranslatedMessage(settings.Language, 70, "Cannot find DOSBox"); CustomMessageBox cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Question, false, false); cmb.ShowDialog(); switch (cmb.Result) { case MessageBoxDialogResult.Yes: OpenFileDialog DBexeFD = new OpenFileDialog(); DBexeFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); DBexeFD.Title = translator.GetTranslatedMessage(settings.Language, 71, "Please indicate DosBox's executable location..."); DBexeFD.Filter = translator.GetTranslatedMessage(settings.Language, 72, "DosBox executable (dosbox*)|dosbox*"); if (DBexeFD.ShowDialog() == DialogResult.OK) DOSBoxPath = DBexeFD.FileName;//retrieve the selected dosbox.exe path into Amp.DBPath else DOSBoxPath = String.Empty; break; case MessageBoxDialogResult.No: DOSBoxPath = String.Empty; break; } } return DOSBoxPath; }
private void TranslateToolStripsUI(Settings.Languages Language, String FormName, ToolStripItemCollection buttonsCollection) { if (_componentsTranslations != null) { foreach (object mnu in buttonsCollection) { if (mnu.GetType() != typeof(ToolStripSeparator) && mnu.GetType() == typeof(ToolStripButton)) { ToolStripButton itm = (ToolStripButton)mnu; if (_componentsTranslations.ContainsKey(FormName + itm.Name)) { itm.Text = _componentsTranslations[FormName + itm.Name].GetTranslation(Language); itm.ToolTipText = _componentsTranslations[FormName + itm.Name].GetTooltipTranslation(Language); } } else if (mnu.GetType() == typeof(ToolStripSplitButton)) { ToolStripSplitButton itm = (ToolStripSplitButton)mnu; if (_componentsTranslations.ContainsKey(FormName + itm.Name)) { itm.Text = _componentsTranslations[FormName + itm.Name].GetTranslation(Language); itm.ToolTipText = _componentsTranslations[FormName + itm.Name].GetTooltipTranslation(Language); } if (itm.HasDropDownItems) TranslateMenusUI(Language, FormName, itm.DropDownItems); } } } }
public void TranslateUI(Settings.Languages Language, String FormName, Control.ControlCollection controls) { if (_componentsTranslations != null) { foreach (object cmp in controls) { Control itm = (Control)cmp; if (_componentsTranslations.ContainsKey(FormName + itm.Name)) { itm.Text = _componentsTranslations[FormName + itm.Name].GetTranslation(Language); //Setting eventual tooltip string ToolTipText = _componentsTranslations[FormName + itm.Name].GetTooltipTranslation(Language); if (ToolTipText != string.Empty) { ToolTip tp = new ToolTip(); tp.SetToolTip(itm, ToolTipText); } } if (itm.HasChildren) { TranslateUI(Language, FormName, itm.Controls); } if (itm.GetType() == typeof(MenuStrip)) { MenuStrip mnu = (MenuStrip)itm; if (mnu.Items.Count > 0) TranslateMenusUI(Language, FormName, mnu.Items); } if (itm.GetType() == typeof(ToolStrip)) { ToolStrip tsp = (ToolStrip)itm; if (tsp.Items.Count > 0) TranslateToolStripsUI(Language, FormName, tsp.Items); } } } }
public void Dispose() { _recentDBs = null; _translator = null; _AppSettings = null; _DosBoxHelper = null; _fileHelper = null; if(_DB != null && _DB.ConnectionStatus == System.Data.ConnectionState.Open) _DB.Disconnect(); _DB = null; if (_SettingsDB != null && _SettingsDB.ConnectionStatus == System.Data.ConnectionState.Open) _SettingsDB.Disconnect(); _SettingsDB = null; }
public Settings LoadSettings() { Settings result = null; try { if (_Connection.State != System.Data.ConnectionState.Open) //I raise an error as there is no connection to the database throw new Exception("There is no connection to the database"); String sql = "SELECT * FROM Settings;"; SQLiteCommand command = new SQLiteCommand(sql, _Connection); SQLiteDataReader reader = command.ExecuteReader(); if (reader.HasRows) { result = new Settings(); reader.Read(); //Load the settings row if (reader["app_width"] != DBNull.Value) result.AppWidth = reader.GetInt32(0); if (reader["app_height"] != DBNull.Value) result.AppHeight = reader.GetInt32(1); if (reader["portable_mode"] != DBNull.Value) result.PortableMode = reader.GetBoolean(2); if (reader["dosbox_path"] != DBNull.Value) result.DosboxPath = reader.GetString(3); if (reader["dosbox_default_conf_file_path"] != DBNull.Value) result.DosboxDefaultConfFilePath = reader.GetString(4); if (reader["dosbox_default_lang_file_path"] != DBNull.Value) result.DosboxDefaultLangFilePath = reader.GetString(5); if (reader["cds_default_dir"] != DBNull.Value) result.CDsDefaultDir = reader.GetString(6); if (reader["games_default_dir"] != DBNull.Value) result.GamesDefaultDir = reader.GetString(7); if (reader["games_no_console"] != DBNull.Value) result.GamesNoConsole = reader.GetBoolean(8); if (reader["games_in_full_screen"] != DBNull.Value) result.GamesInFullScreen = reader.GetBoolean(9); if (reader["games_quit_on_exit"] != DBNull.Value) result.GamesQuitOnExit = reader.GetBoolean(10); if (reader["games_additional_commands"] != DBNull.Value) result.GamesAdditionalCommands = reader.GetString(11); if (reader["box_rendered"] != DBNull.Value) result.BoxRendered = reader.GetBoolean(12); if (reader["app_fullscreen"] != DBNull.Value) result.AppFullscreen = reader.GetBoolean(13); if (reader["menu_bar_visible"] != DBNull.Value) result.MenuBarVisible = reader.GetBoolean(14); if (reader["toolbar_visible"] != DBNull.Value) result.ToolbarVisible = reader.GetBoolean(15); if (reader["status_bar_visible"] != DBNull.Value) result.StatusBarVisible = reader.GetBoolean(16); if (reader["config_editor_path"] != DBNull.Value) result.ConfigEditorPath = reader.GetString(17); if (reader["config_editor_additional_parameters"] != DBNull.Value) result.ConfigEditorAdditionalParameters = reader.GetString(18); if (reader["category_delete_prompt"] != DBNull.Value) result.CategoryDeletePrompt = reader.GetBoolean(19); if (reader["game_delete_prompt"] != DBNull.Value) result.GameDeletePrompt = reader.GetBoolean(20); if (reader["remember_window_size"] != DBNull.Value) result.RememberWindowSize = reader.GetBoolean(21); if (reader["language"] != DBNull.Value) result.Language = (reader.GetInt32(22) == 0) ? Settings.Languages.English : Settings.Languages.Italian; if (reader["reload_latest_db"] != DBNull.Value) result.ReloadLatestDB = reader.GetBoolean(23); if (reader["reduce_to_tray_on_play"] != DBNull.Value) result.ReduceToTrayOnPlay = reader.GetBoolean(24); } else { //Nothing found I set the defaults and return them return SetDefaultSettings(); } } catch (Exception) { //In case of errors I return at least the defaults ones without storing them to avoid other issues. return GetDefaultSettings(); } return result; }