Esempio n. 1
0
        private void PrintNode(AsciiTreeNode node, string indent)
        {
            m_Writer.WriteLine(node.Name);

            // Loop through the children recursively, passing in the
            // indent, and the isLast parameter
            var numberOfChildren = node.Children.Count;

            for (var i = 0; i < numberOfChildren; i++)
            {
                var child  = node.Children[i];
                var isLast = (i == (numberOfChildren - 1));
                PrintChildNode(child, indent, isLast);
            }
        }
Esempio n. 2
0
        private void PrintChildNode(AsciiTreeNode node, string indent, bool isLast)
        {
            // Print the provided pipes/spaces indent
            m_Writer.Write(indent);

            // Depending if this node is a last child, print the
            // corner or cross, and calculate the indent that will
            // be passed to its children
            if (isLast)
            {
                m_Writer.Write(s_Corner);
                indent += s_Space;
            }
            else
            {
                m_Writer.Write(s_Cross);
                indent += s_Vertical;
            }

            PrintNode(node, indent);
        }
Esempio n. 3
0
 public void WriteNode(AsciiTreeNode topLevelNode)
 {
     PrintNode(topLevelNode, indent: "");
 }