mirror of
https://github.com/tonytins/tomas.git
synced 2025-04-30 03:31:39 -04:00
51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
// I license this project under the GPL 3.0 license.
|
|
// See the LICENSE file in the project root for more information.
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Tomas.Common;
|
|
using Tomas.Interface.Shell;
|
|
using Tomas.Kernel.Programs;
|
|
using Tomas.Terminal.Programs;
|
|
using Sys = Cosmos.System;
|
|
|
|
namespace Tomas.Kernel
|
|
{
|
|
public class Kernel : Sys.Kernel
|
|
{
|
|
protected override void BeforeRun()
|
|
{
|
|
try
|
|
{
|
|
Sys.PCSpeaker.Beep();
|
|
TomFS.Initialize();
|
|
}
|
|
catch
|
|
{
|
|
Sys.PCSpeaker.Beep();
|
|
Console.WriteLine("File system failed to load! Not all functions will work.");
|
|
}
|
|
|
|
|
|
Console.WriteLine($"{ComConsts.NAME} v{ComConsts.VersionGit} Booted successfully.");
|
|
}
|
|
|
|
protected override void Run()
|
|
{
|
|
while (true)
|
|
{
|
|
var shell = new Shell();
|
|
var command = shell.ReadLine;
|
|
OSConsts.Programs.TryGetValue(command, out var program);
|
|
var isRun = program.Start();
|
|
|
|
if (isRun) continue;
|
|
break;
|
|
}
|
|
}
|
|
|
|
protected override void AfterRun()
|
|
{
|
|
Console.WriteLine($"{ComConsts.NAME} is shutting down.");
|
|
}
|
|
}
|
|
}
|