-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKernel.cs
More file actions
70 lines (67 loc) · 2.36 KB
/
Kernel.cs
File metadata and controls
70 lines (67 loc) · 2.36 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
using PineOS.Commands;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.AccessControl;
using System.Text;
using Sys = Cosmos.System;
namespace PineOS
{
public class Kernel : Sys.Kernel
{
Sys.FileSystem.CosmosVFS fs = new Cosmos.System.FileSystem.CosmosVFS();
protected override void BeforeRun()
{
Sys.FileSystem.VFS.VFSManager.RegisterVFS(fs);
CommandManager.Register(new EchoCommand());
CommandManager.Register(new FileCommand());
CommandManager.Register(new HelpCommand());
CommandManager.Register(new SystemCommand());
CommandManager.Register(new TimeCommand());
Boot();
Console.BackgroundColor = ConsoleColor.Yellow;
Console.WriteLine("PineOS booted successfully.");
Home();
}
protected override void Run()
{
Console.Write(">");
var input = Console.ReadLine();
CommandManager.Execute(input);
}
private void Home()
{
Console.BackgroundColor = ConsoleColor.DarkGreen;
Console.WriteLine("|=============================|");
Console.WriteLine("|============PineOS===========|");
Console.WriteLine("|=============================|");
Console.BackgroundColor = ConsoleColor.Green;
}
private void Boot()
{
Console.WriteLine("Loading Storage");
var storage = fs.GetVolumes();
Console.WriteLine("Load Volume: " + storage);
var type = fs.GetFileSystemType(@"0:\");
Console.WriteLine("Volume Type: " + type);
var available_space = fs.GetAvailableFreeSpace(@"0:\");
Console.WriteLine("Available Free Space: " + available_space);
var files = Directory.GetFiles(@"0:\");
Console.WriteLine("Files in Volume 0:");
foreach (var file in files)
{
Console.WriteLine("#" + file);
}
Console.WriteLine("Loading......");
WaitSeconds(5);
Console.Clear();
}
public static void WaitSeconds(int seconds)
{
var target = DateTime.Now.AddSeconds(seconds);
while (DateTime.Now < target)
{
}
}
}
}