예제 #1
0
        public string ToXml()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<collectorAgent name=\"" + Name.EscapeXml() + "\" type=\"" + TypeName.EscapeXml() + "\" enabled=\"" + Enabled.ToString() + "\">");

            string configString = ConfigString;

            if (configString.Trim().StartsWith("<config", StringComparison.CurrentCultureIgnoreCase))
            {
                sb.AppendLine(configString);
            }
            else
            {
                sb.AppendLine("<config>");
                sb.AppendLine(configString);
                sb.AppendLine("</config>");
            }

            sb.AppendLine("</collectorAgent>");
            return(sb.ToString());
        }