-
Notifications
You must be signed in to change notification settings - Fork 15
/
Program.cs
34 lines (30 loc) · 1.21 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
using System.Configuration;
using YSGM;
Console.WriteLine(@"
██╗ ██╗███████╗ ██████╗ ███╗ ███╗
╚██╗ ██╔╝██╔════╝██╔════╝ ████╗ ████║
╚████╔╝ ███████╗██║ ███╗██╔████╔██║
╚██╔╝ ╚════██║██║ ██║██║╚██╔╝██║
██║ ███████║╚██████╔╝██║ ╚═╝ ██║
╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝
");
CommandMap.RegisterAll();
// Create prompt interface
while (true)
{
Console.Write("> ");
var userInput = Console.ReadLine();
string[] split = userInput!.Split(' ');
string cmd = split[0];
// If the user entered a valid command, execute it.
if (CommandMap.handlers.ContainsKey(cmd))
{
var handler = CommandMap.handlers[cmd];
var arguments = split.Skip(1).ToArray();
Console.WriteLine(handler.Execute(arguments));
}
else
{
Console.WriteLine("Invalid command.");
}
}