コード例 #1
0
        private string ToString(int no, int level)
        {
            StringBuilder res    = new StringBuilder();
            string        number = ("[" + no + "]").PadLeft(level + 1);
            string        indent = "".PadLeft(number.Length);

            res.Append(number).Append("NodeType:").Append(this.GetType().Name).Append(" - ").Append(Type.ToString()).Append('\n');
            if (!string.IsNullOrEmpty(this.TextContent))
            {
                res.Append(indent).Append("NodeText:").Append(this.TextContent).Append('\n');
            }
            string internalStr = this.ToStringInternal();

            if (!string.IsNullOrEmpty(internalStr))
            {
                res.Append(indent).Append(internalStr).Append('\n');
            }
            if (children.Count > 0)
            {
                res.Append(indent).Append("Children:\n");
                for (int i = 0; i < children.Count; i++)
                {
                    MarkdownElementBase el = children[i];
                    res.Append(el.ToString(i + 1, number.Length + 2));
                }

                res.Append('\n');
            }

            return(res.ToString());
        }
コード例 #2
0
 public void AddChildElement(MarkdownElementBase el)
 {
     this.children.Add(el);
 }