Exemplo n.º 1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            string appPath    = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string configFile = System.IO.Path.Combine(appPath, "Conan Exiles Server Admin.exe.config");
            ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();

            configFileMap.ExeConfigFilename = configFile;
            Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);

            if (workshopPakLocationText.Text != "")
            {
                config.AppSettings.Settings["PAK_Location"].Value = workshopPakLocationText.Text.ToString();
            }
            if (modTargetLocationText.Text != "")
            {
                config.AppSettings.Settings["PAK_Target_Location"].Value = modTargetLocationText.Text.ToString();
            }
            decimal iSleepTime = (sleepTimeInt.Value * 1000);

            if (sleepTimeInt.Value >= 0)
            {
                config.AppSettings.Settings["Sleep_Time"].Value = iSleepTime.ToString();
            }
            if (transferFilesCheck.Checked == true)
            {
                config.AppSettings.Settings["Automaticaly_Transfer_Files"].Value = "true";
            }
            else
            {
                config.AppSettings.Settings["Automaticaly_Transfer_Files"].Value = "false";
            }
            if (ConanServerLocationText.Text != "")
            {
                config.AppSettings.Settings["Conan_Server_Location"].Value = ConanServerLocationText.Text.ToString();
            }
            if (SteamCmdLocationText.Text != "")
            {
                config.AppSettings.Settings["SteamCmd_Location"].Value = SteamCmdLocationText.Text.ToString();
            }
            if (ValidationCheckBox.Checked == true)
            {
                config.AppSettings.Settings["Validate_Conan"].Value = "true";
            }
            else
            {
                config.AppSettings.Settings["Validate_Conan"].Value = "false";
            }
            config.Save();
            GettingSettings Settings = new GettingSettings();

            Settings.SettingValuesFromConfig();

            Application.OpenForms[1].Close();
        }