private void WriteConfig() { Configuration config = ConfigurationManager.OpenExeConfiguration( System.IO.Path.Combine(Environment.CurrentDirectory, Environment.GetCommandLineArgs()[0])); WordAssistantSection wordAssistantSect = config.GetSection(mC_ConfigSection) as WordAssistantSection; WordAssistantConfigElement wordAssistantElement = null; if (null != wordAssistantSect) { wordAssistantElement = wordAssistantSect.WordAssistantElement; } else { wordAssistantSect = new WordAssistantSection(); wordAssistantElement = new WordAssistantConfigElement(); wordAssistantSect.WordAssistantElement = wordAssistantElement; config.Sections.Add(mC_ConfigSection, wordAssistantSect); } wordAssistantElement.Mp3FilePath = txtMp3File.Text; wordAssistantElement.LameExePath = txtLameExe.Text; config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection(mC_ConfigSection); }
private void ReadConfig() { Configuration config = ConfigurationManager.OpenExeConfiguration( System.IO.Path.Combine(Environment.CurrentDirectory, Environment.GetCommandLineArgs()[0])); WordAssistantSection wordAssistantSect = config.GetSection(mC_ConfigSection) as WordAssistantSection; if (null != wordAssistantSect) { WordAssistantConfigElement wordAssistantElement = wordAssistantSect.WordAssistantElement; txtMp3File.Text = wordAssistantElement.Mp3FilePath; txtLameExe.Text = wordAssistantElement.LameExePath; } }