Here are the examples of the csharp api class AAngelov.Utilities.Configuration.ConfigModificator.LoadConfigDocument(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
0
1. Example
Project: AutomateThePlanet
Source File: ConfigModificator.cs
Source File: ConfigModificator.cs
public static void WriteSetting(string key, string value, ConfigModificatorSettings configWriterSettings) { XmlDocument doc = ConfigModificator.LoadConfigDocument(configWriterSettings.ConfigPath); // retrieve appSettings node XmlNode rootNode = doc.SelectSingleNode(configWriterSettings.RootNode); if (rootNode == null) { throw new InvalidOperationException("appSettings section not found in config file."); } try { // select the 'note for edit' element that contains your key XmlElement elem = (XmlElement)rootNode.SelectSingleNode(string.Format(configWriterSettings.NodeForEdit, key)); elem.FirstChild.InnerText = value; doc.Save(configWriterSettings.ConfigPath); } catch { throw; } }
0
2. Example
Project: AutomateThePlanet
Source File: ConfigModificator.cs
Source File: ConfigModificator.cs
public static void ChangeValueByKey(string key, string value, string attributeForChange, ConfigModificatorSettings configWriterSettings) { XmlDocument doc = ConfigModificator.LoadConfigDocument(configWriterSettings.ConfigPath); // retrieve the root node XmlNode rootNode = doc.SelectSingleNode(configWriterSettings.RootNode); if (rootNode == null) { throw new InvalidOperationException("the root node section not found in config file."); } try { // select the element that contains the key XmlElement elem = (XmlElement)rootNode.SelectSingleNode(string.Format(configWriterSettings.NodeForEdit, key)); elem.SetAttribute(attributeForChange, value); doc.Save(configWriterSettings.ConfigPath); } catch (Exception ex) { throw ex; } }