示例#1
0
        /// <summary>
        /// Sets the CSDM config.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        public static void SetCSDMConfig(CSDMConfigSection section, string key, string value)
        {
            XmlDocument configDoc = new XmlDocument();

            configDoc.Load(GetCSDMConfigFilePath());
            XmlNodeList configNodes = configDoc.SelectNodes("trophy/" + section.ToString() + "/property");

            foreach (XmlNode node in configNodes)
            {
                if (node.Attributes["key"].Value.Trim().ToUpper() == key.Trim().ToUpper())
                {
                    node.Attributes["value"].Value = value;
                }
            }
            configDoc.Save(GetCSDMConfigFilePath());
        }
示例#2
0
        /// <summary>
        /// Gets the CSDM config.
        /// </summary>
        /// <param name="section">The section. Possible value can be: remote, proxy, local, common</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public static string GetCSDMConfig(CSDMConfigSection section, string key)
        {
            string value          = string.Empty;
            string configFilePath = string.Empty;

            configFilePath = GetCSDMConfigFilePath();

            //Open the Config file and get the specific config value
            XmlDocument configDoc = new XmlDocument();

            configDoc.Load(configFilePath);

            XmlNodeList configNodes = configDoc.SelectNodes("trophy/" + section.ToString() + "/property");

            foreach (XmlNode node in configNodes)
            {
                if (node.Attributes["key"].Value.Trim().ToUpper() == key.Trim().ToUpper())
                {
                    value = node.Attributes["value"].Value;
                }
            }

            return(value);
        }
 /// <summary>
 /// Sets the CSDM config.
 /// </summary>
 /// <param name="section">The section.</param>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 public static void SetCSDMConfig(CSDMConfigSection section, string key, string value)
 {
     XmlDocument configDoc = new XmlDocument();
     configDoc.Load(GetCSDMConfigFilePath());
     XmlNodeList configNodes = configDoc.SelectNodes("trophy/" + section.ToString() + "/property");
     foreach (XmlNode node in configNodes)
     {
         if (node.Attributes["key"].Value.Trim().ToUpper() == key.Trim().ToUpper())
         {
             node.Attributes["value"].Value = value;
         }
     }
     configDoc.Save(GetCSDMConfigFilePath());
 }
        /// <summary>
        /// Gets the CSDM config.
        /// </summary>
        /// <param name="section">The section. Possible value can be: remote, proxy, local, common</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public static string GetCSDMConfig(CSDMConfigSection section, string key)
        {
            string value = string.Empty;
            string configFilePath = string.Empty;

            configFilePath = GetCSDMConfigFilePath();

            //Open the Config file and get the specific config value
            XmlDocument configDoc = new XmlDocument();
            configDoc.Load(configFilePath);

            XmlNodeList configNodes = configDoc.SelectNodes("trophy/" + section.ToString() + "/property");

            foreach (XmlNode node in configNodes)
            {
                if (node.Attributes["key"].Value.Trim().ToUpper() == key.Trim().ToUpper())
                {
                    value = node.Attributes["value"].Value;
                }
            }

            return value;
        }