示例#1
0
        static void GetCourses(string courseFolder)
        {
            var myCourseFinder = new MyCourseFinder();
            var myCourses      = myCourseFinder.FindAll(courseFolder);

            foreach (var myCourse in myCourses)
            {
                Console.WriteLine("{0}\t{1}", myCourse.Title, myCourse.Size.ToFriendlySize());
            }

            var nodeCourses     = ConvertToNodes(myCourses);
            var asciiTreeHelper = new AsciiTreeHelper();

            //asciiTreeHelper.MaxPrintDeep = 0;
            asciiTreeHelper.PrintAllDeep();
            var sb = new StringBuilder();

            foreach (var nodeCourse in nodeCourses)
            {
                asciiTreeHelper.ProcessNode(nodeCourse, "", sb, 0);
            }

            var json = myCourses.ToJson(true);

            File.WriteAllText("courses.json", json);
            File.WriteAllText("courses_ascii.text", sb.ToString());
            Console.Read();
        }
示例#2
0
        static void Main(string[] args)
        {
            var asciiTreeHelper = new AsciiTreeHelper();
            // Get the list of nodes
            var topLevelNodes = Mock.CreateNodeList(3, 5);

            asciiTreeHelper.MaxPrintDeep = 2;
            var sb = new StringBuilder();

            foreach (var topLevelNode in topLevelNodes)
            {
                asciiTreeHelper.ProcessNode(topLevelNode, "", sb, 0);
            }
            Console.WriteLine(sb);
            Console.Read();
        }