private XmlDocument CreateXmlDocument() { XmlDocument xmlDocument = new SafeXmlDocument(); xmlDocument.InsertBefore(xmlDocument.CreateXmlDeclaration("1.0", "utf-8", null), xmlDocument.DocumentElement); xmlDocument.AppendChild(xmlDocument.CreateElement("configuration")); XmlElement xmlElement = xmlDocument.CreateElement("mexRuntime"); xmlDocument.DocumentElement.PrependChild(xmlElement); XmlElement xmlElement2 = xmlDocument.CreateElement("monitoring"); xmlElement.AppendChild(xmlElement2); XmlElement xmlElement3 = xmlDocument.CreateElement("agentExecution"); xmlElement3.SetAttribute("timeLimitInMilliseconds", this.monitoringOptions.AgentExecutionLimitInMilliseconds.ToString(CultureInfo.InvariantCulture)); xmlElement2.AppendChild(xmlElement3); if (!this.monitoringOptions.MessageSnapshotEnabled) { XmlElement xmlElement4 = xmlDocument.CreateElement("messageSnapshot"); xmlElement4.SetAttribute("enabled", "false"); xmlElement2.AppendChild(xmlElement4); } XmlElement xmlElement5 = xmlDocument.CreateElement("agentList"); xmlElement.AppendChild(xmlElement5); foreach (AgentInfo agentInfo in this.agentList) { if (!agentInfo.IsInternal) { XmlElement xmlElement6 = xmlDocument.CreateElement("agent"); xmlElement6.SetAttribute("name", agentInfo.AgentName); xmlElement6.SetAttribute("baseType", agentInfo.BaseTypeName); xmlElement6.SetAttribute("classFactory", agentInfo.FactoryTypeName); xmlElement6.SetAttribute("assemblyPath", agentInfo.FactoryAssemblyPath); xmlElement6.SetAttribute("enabled", agentInfo.Enabled.ToString().ToLower(CultureInfo.InvariantCulture)); xmlElement5.AppendChild(xmlElement6); } } XmlElement xmlElement7 = xmlDocument.CreateElement("settings"); if (!this.disposeAgents) { XmlElement xmlElement8 = xmlDocument.CreateElement("disposeAgents"); xmlElement8.InnerText = "false"; xmlElement7.AppendChild(xmlElement8); } xmlElement.AppendChild(xmlElement7); return(xmlDocument); }