-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKernel.cs
More file actions
60 lines (51 loc) · 1.54 KB
/
Kernel.cs
File metadata and controls
60 lines (51 loc) · 1.54 KB
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
using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;
namespace CosmosKernel3
{
public class Kernel : Sys.Kernel
{
protected override void BeforeRun()
{
Console.WriteLine("leonOS booted successfully. Type a line of text to get it echoed back.");
}
protected override void Run()
{
Console.Write("> ");
var input = Console.ReadLine();
Commandman.coammand a = new Commandman.coammand();
a.Init(input);// initiallizing the command
Commandman b = new Commandman();
b.Basic(a);// execute it
}
}
public class Commandman
{
public struct coammand
{
public string[] strings;
public void Init(string a)
{
strings = a.Split(' ');
//parse the input
}
}
public void Basic(Commandman.coammand com)
{
string[] a = com.strings;
switch (a[0])
{
case "echo":
Console.WriteLine(a[1]);
break;
case "turnoff":
Cosmos.System.Power.Shutdown();
break;
default:
Console.WriteLine("bad command");
break;
}
}
}
}