示例#1
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            TduModdingToolsSettings currentSettings = Program.ApplicationSettings;

            try
            {
                // Sauvegarde des données
                Cursor = Cursors.WaitCursor;

                // Main
                currentSettings.TduMainFolder = rootTextBox.Text;
                currentSettings.StartupModule = (moduleList.SelectedItem == null ? "" : moduleList.SelectedItem.ToString());
                currentSettings.TduLanguage   = (languageList.SelectedItem == null ? "" : languageList.SelectedItem.ToString());
                // EVO_73: debug mode
                currentSettings.DebugModeEnabled = (debugModeCheckBox.Checked.ToString());

                // File Editing
                // EVO_102
                if (editNewFilesFolderCurrentRadioButton.Checked)
                {
                    currentSettings.DefaultEditNewFilesFolder = "";
                }
                else
                {
                    currentSettings.DefaultEditNewFilesFolder = editFolderNewFilesTextBox.Text;
                }
                // EVO_136: display files in explorer after extract
                currentSettings.ExtractDisplayInExplorer = (editExtractShowFilesCheckBox.Checked.ToString());

                // Launch Configuration
                // Ensures current configuration has been saved
                saveConfigButton_Click(this, new EventArgs());
                currentSettings.TduLaunchConfigurations = (LaunchConfigurationConverter.ConvertToString(_TemporaryConfigList));

                // Patch Editor
                currentSettings.PatchEditorReportAutoScroll = (reportAutoScrollCheckBox.Checked.ToString());
                // EVO_110
                currentSettings.PatchEditorReportClear = (reportClearingCheckBox.Checked.ToString());

                // [EVO_172] Track Pack
                currentSettings.PlayerProfile = profilesComboBox.Text;

                currentSettings.Save();

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                MessageBoxes.ShowError(this, ex);
            }

            Close();
        }
示例#2
0
        /// <summary>
        /// Initialise les paramètres de l'application
        /// </summary>
        private static void _InitializeSettings()
        {
            _ApplicationSettings = new TduModdingToolsSettings();

            // BUG_30 : dossier de paramètres
            string settingsFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\" + Application.ProductName;

            if (!Directory.Exists(settingsFolder))
            {
                Directory.CreateDirectory(settingsFolder);
            }

            _ApplicationSettings.ConfigFilePath = settingsFolder + @"\settings.xml";
            _ApplicationSettings.Load();
        }
示例#3
0
        /// <summary>
        /// Définit le contenu de la fenêtre
        /// </summary>
        private void _InitializeContents()
        {
            TduModdingToolsSettings currentSettings = Program.ApplicationSettings;

            // Contenus

            // Liste de langues
            foreach (string languageName in DBResource.LanguageList)
            {
                languageList.Items.Add(languageName);
            }

            // Liste de modules
            moduleList.Items.Add("");

            foreach (string moduleName in MainForm.StartupModuleList)
            {
                moduleList.Items.Add(moduleName);
            }

            // Affiche les valeurs stockées dans la configuration
            // Main
            rootTextBox.Text          = currentSettings.TduMainFolder;
            moduleList.SelectedItem   = currentSettings.StartupModule;
            languageList.SelectedItem = currentSettings.TduLanguage;
            // EVO_73: debug mode
            debugModeCheckBox.Checked = (bool.Parse(currentSettings.DebugModeEnabled));

            // File Editing
            // EVO_102 : default location for new files
            if (string.IsNullOrEmpty(currentSettings.DefaultEditNewFilesFolder))
            {
                editNewFilesFolderCurrentRadioButton.Checked = true;
                editNewFilesFolderCurrentRadioButton_CheckedChanged(this, new EventArgs());
            }
            else
            {
                editNewFilesFolderHardRadioButton.Checked = true;
                editNewFilesFolderHardRadioButton_CheckedChanged(this, new EventArgs());
                editFolderNewFilesTextBox.Text = currentSettings.DefaultEditNewFilesFolder;
            }
            // EVO_136: display files in explorer after extract
            editExtractShowFilesCheckBox.Checked = (bool.Parse(currentSettings.ExtractDisplayInExplorer));

            // Launch Configuration
            Collection <LaunchConfiguration> configList = currentSettings.GetLaunchConfigList();

            _TemporaryConfigList = new Collection <LaunchConfiguration>(configList);
            configComboBox.Items.Add(_CONFIG_LIST_NEW_ITEM);

            foreach (LaunchConfiguration anotherConfig in _TemporaryConfigList)
            {
                configComboBox.Items.Add(anotherConfig.Name);
            }

            if (configComboBox.Items.Count > 1)
            {
                configComboBox.SelectedIndex = 1;
            }
            else
            {
                configComboBox.SelectedIndex = 0;
            }

            // Patch Editor
            reportAutoScrollCheckBox.Checked = bool.Parse(currentSettings.PatchEditorReportAutoScroll);
            // EVO_110 : report clearing
            reportClearingCheckBox.Checked = bool.Parse(currentSettings.PatchEditorReportClear);

            // [EVO_172] Track Pack
            string[] profileNames = new string[0];

            // [BUG_103] Error when savegame folder not found
            try
            {
                profileNames = Tools.GetPlayerProfiles();
            }
            catch (Exception ex)
            {
                MessageBoxes.ShowError(this, new Exception(_ERROR_PROFILE, ex));
            }
            //

            foreach (string anotherProfile in profileNames)
            {
                profilesComboBox.Items.Add(anotherProfile);
            }

            // Selected profile
            if (string.IsNullOrEmpty(currentSettings.PlayerProfile))
            {
                if (profilesComboBox.Items.Count > 0)
                {
                    profilesComboBox.Text = profilesComboBox.Items[0].ToString();
                }
            }
            else
            {
                profilesComboBox.Text = currentSettings.PlayerProfile;
            }
        }