public void AddParam(string sParamName, string sParamType, object oParamValue) { SubSectionParameter oSubSectionParam = new SubSectionParameter(sParamName, sParamType, oParamValue); m_oParams[sParamName] = oSubSectionParam; }
/// <summary> /// Go through all the Sub Sections in memory and /// Build the sub sections with all the parameters /// as childs elements of the inner xml . /// </summary> /// <param name="sInnerXML"></param> public void BuildSubSectionsElements(XmlDocument oXmlDoc, ref string sInnerXML) { int i = 0; // create new sub sections if needed for (i = 0; i < m_oSectionsToCreate.Count; i++) { CreateSubSectionElement(oXmlDoc, m_oSectionsToCreate[i].ToString()); } // delete the sub sections if needed for (i = 0; i < m_oSectionsToDelete.Count; i++) { DeleteSubSectionElement(oXmlDoc, m_oSectionsToDelete[i].ToString()); } // build all the parameters for the sub section SubSection oSection = null; foreach (DictionaryEntry sectionEntry in m_oSubSections) { oSection = (SubSection)sectionEntry.Value; // build the parameters of the section SubSectionParameter [] oParameters = oSection.Parameters; if (oParameters != null) { for (i = 0; i < oParameters.Length; i++) { SubSectionParameter oParam = (SubSectionParameter)oParameters.GetValue(i); if (oParam != null) { // build the parameter BuildParam(oXmlDoc, oSection.Name, oParam.ParamName, oParam.ParamValue); } } } } // find the ConfigSection node and update the inner xml string xPath = "SECTION" + "[@" + ATTR_NAME + " = \"" + m_sConfigSectionName + "\"]"; XmlNode oConfigSectionNode = oXmlDoc.DocumentElement.SelectSingleNode(xPath); if (oConfigSectionNode != null) { // update the inner xml of the parent Config section // with the changes of new sub sections sInnerXML = oConfigSectionNode.InnerXml.ToString(); } }