public override void GetConfig(bool refresh, ChoConfigSectionObjectMap configSectionObjectMap)
 {
     _configSection = ChoConfigurationManager.GetConfig(ConfigElementName, refresh) as IChoConfigSectionable;
     if (_configSection != null)
     {
         _configSection.Init(configSectionObjectMap);
     }
 }
Пример #2
0
        public virtual void Init(ChoConfigSectionObjectMap configSectionObjectMap)
        {
            if (configSectionObjectMap == null)
            {
                throw new ArgumentNullException("configSectionObjectMap");
            }

            configSectionObjectMap.ConfigSection = this;
        }
        public override void PersistConfig(ChoConfigSectionObjectMap configSectionObjectMap)
        {
            if (_configSection == null)
            {
                return;
            }

            _configSection.Persist(configSectionObjectMap);
        }
Пример #4
0
        public override void Persist(ChoConfigSectionObjectMap configSectionObjectMap)
        {
            StringBuilder config    = new StringBuilder();
            Hashtable     keyValues = configSectionObjectMap.ToHashtable();

            foreach (string key in keyValues.Keys)
            {
                if (keyValues[key] != null)
                {
                    config.AppendFormat("<add key=\"{0}\" value=\"{1}\" />{2}", key, keyValues[key].ToString(), Environment.NewLine);
                }
            }

            File.WriteAllText(_configPath, ChoXmlDocument.SetInnerXml(_configPath, ConfigSectionName, config.ToString()));
        }
Пример #5
0
 public abstract void Persist(ChoConfigSectionObjectMap configSectionObjectMap);
Пример #6
0
 public override void Init(ChoConfigSectionObjectMap configSectionObjectMap)
 {
     base.Init(configSectionObjectMap);
     //configSectionObjectMap.ConfigFilePath = ConfigPath;
     configSectionObjectMap.ConfigObject = ConfigObject;
 }
Пример #7
0
 public override void Persist(ChoConfigSectionObjectMap configSectionObjectMap)
 {
     File.WriteAllText(_configPath, ChoXmlDocument.SetOuterXml(_configPath, ConfigSectionName,
                                                               ChoObject.ToXmlString(configSectionObjectMap.ConfigObject)));
 }