-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathKernel.cs
More file actions
102 lines (93 loc) · 5.06 KB
/
Copy pathKernel.cs
File metadata and controls
102 lines (93 loc) · 5.06 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//using Cosmos.HAL;
using System; //namesapace declaration and organize program
using System.IO;
using Sys = Cosmos.System;
namespace Osproject
{
public class Kernel : Sys.Kernel
{
protected override void BeforeRun() // override modifier is required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event.
{
// var fs = new Sys.FileSystem.CosmosVFS();
// Sys.FileSystem.VFS.VFSManager.RegisterVFS(fs);
//Directory.CreateDirectory("0:\\TestFolder");
// File.Create("0:\\TestFolder\\MyFile.txt");
//Directory.CreateDirectory("0:\\TestFolder");
//File.Create("0:\\TestFolder\testFile.txt");
Console.WriteLine("\n\nYour chaOS has booted successfully.\nType Help");
}
protected override void Run()
{
int s, b, c, d, e, f, g, h, result, result1, result2, result3;
string a;
string choice;
a = Console.ReadLine();
string input;
if (a == "Help")
{
{
do
{
Console.WriteLine("Following is the list of available commands: \nA.About\nB.Calculator\nC.ShutDown");
Console.WriteLine("Enter Your Choice:");
input = Console.ReadLine();
switch (input)
{
case "A":
Console.WriteLine("This is our primitive commandline OS build using COSMOS framework\n\n");
break;
case "B":
do
{
Console.WriteLine("Calculator Functions\n");
Console.WriteLine("a.Add\nb.Subtract\nc.Multiply\nd.Divide\ne.Exit");
Console.WriteLine("Enter Your choice\n");
choice = Console.ReadLine();
switch (choice)
{
case "a":
Console.WriteLine("Enter The two numbers for addition\n");
s = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
result = s + b;
Console.WriteLine("The Answer is " + s + "+" + b + "=" + result);
break;
case "b":
Console.WriteLine("Enter The two Numbers for subtraction\n");
c = int.Parse(Console.ReadLine());
d = int.Parse(Console.ReadLine());
result1 = c - d;
Console.WriteLine("The Answer is " + c + "-" + d + "=" + result1);
break;
case "c":
Console.WriteLine("Enter The two Numbers for multiplication\n");
e = int.Parse(Console.ReadLine());
f = int.Parse(Console.ReadLine());
result2 = e * f;
Console.WriteLine("The Answer is " + e + "*" + f + "=" + result2);
break;
case "d":
Console.WriteLine("Enter The two Numbers for break\n");
g = int.Parse(Console.ReadLine());
h = int.Parse(Console.ReadLine());
result3 = g / h;
Console.WriteLine("The Answer is " + g + "/" + h + "=" + result3);
break;
default:
Console.WriteLine("Enter Valid Option\n");
break;
}
} while (choice != "e");
break;
case "C":
Sys.Power.Reboot();
break;
default:
break;
}
} while (input != "E");
}
}
}
}
}