-
Notifications
You must be signed in to change notification settings - Fork 7
/
Program.cs
62 lines (53 loc) · 2.04 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
namespace TreeLibNugetDemo
{
using System;
using TreeLibNugetDemo.Demos;
using TreeLibNugetDemo.Demos.Directories;
/// <summary>
/// This demo application tests different versions of tree traversal algorithms from
/// the Nuget Dirster.TreeLib package (you may have to enable/restore NuGet packaging).
/// </summary>
class Program
{
static int Main(string[] args)
{
PrintMenu menu = new PrintMenu();
var root = TraversalDemo.makeTree();
menu.AddMenuEntry('1', "Level Order Traversal Demo");
menu.AddMenuEntry('2', "Pre-Order Traversal Demo");
menu.AddMenuEntry('3', "Post-Order Traversal Demo");
menu.AddMenuEntry('4', "Compute Directory Size (without exception handling in enumeration)");
menu.AddMenuEntry('5', "Compute Directory Size (WITH exception handling and Generic class)");
while (true)
{
Console.WriteLine();
Console.WriteLine("This program demos TreeLib applications and use cases by example.");
var key = menu.ShowMenu();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
switch (key)
{
case '1':
TraversalDemo.TestLevelOrder(root);
break;
case '2':
TraversalDemo.TestPreOrder(root);
break;
case '3':
TraversalDemo.TestPostOrder(root);
break;
case '4':
DirSizeWoException.DemoDirectoryTreeTraversal();
break;
case '5':
DirectorySize.DemoDirectoryTreeTraversal();
break;
default:
return (0);
}
}
}
}
}