// load all the config sections from the file // into m_sections table private void LoadConfigSections() { try { m_changed = false; // clear the table m_sections.Clear(); // load the config file XmlDocument xmlDoc = LoadConfigDocument(); if (xmlDoc == null) { return; } string xPath = ELEMENT_SECTION; XmlNodeList sectionList = xmlDoc.DocumentElement.SelectNodes(xPath); XmlNode sectionNode; if (sectionList != null) { for (int i = 0; i < sectionList.Count; i++) { sectionNode = sectionList.Item(i); if (sectionNode != null) { string serializeTypeName = ""; string sectionName = ""; string sInnerObjectType = string.Empty; ConfigSerializeType serializeType = ConfigSerializeType.None; if (sectionNode.Attributes[ATTR_NAME] != null) { sectionName = sectionNode.Attributes[ATTR_NAME].Value.ToString(); } else { throw new TisException("Load Config Sections failed , the Section is missing the 'name' attribute."); } if (sectionNode.Attributes[ATTR_OBJECT_TYPE] != null) { sInnerObjectType = sectionNode.Attributes[ATTR_OBJECT_TYPE].Value.ToString(); } if (sectionNode.Attributes[ATTR_SERIALIZATION_TYPE] != null) { serializeTypeName = sectionNode.Attributes[ATTR_SERIALIZATION_TYPE].Value.ToString(); object serializeTypeObj = Enum.Parse(typeof(ConfigSerializeType), serializeTypeName); serializeType = (ConfigSerializeType)serializeTypeObj; } else { throw new TisException("Load Config Sections failed , the Section {0} is missing the Attribute : {1} value", sectionName, ATTR_SERIALIZATION_TYPE); } ConfigSectionImpl configSection = new ConfigSectionImpl( sectionName, serializeType, sInnerObjectType, sectionNode.InnerXml); // build the sub sections if needed configSection.BuildSubSectionsElements(xmlDoc, true); // save the config section in the map m_sections[sectionName] = configSection; } } } } catch (Exception e) { // write error to Log File. Log.Write( Log.Severity.ERROR, System.Reflection.MethodInfo.GetCurrentMethod(), "failed , Details : {0}", e.Message); throw new TiS.Core.TisCommon.TisException( e, "failed , Details : {0}", e.Message); } }