Cosmos/Users/Sentinel/SentinelKernel/Kernel.cs
Charles Betros 2e4e0dd370 Added a test kernel for boxing.
Moved Char Plug to Cosmos.System.Plugs
Added FAT writing. (Doesn't work yet.)
2015-07-24 17:52:44 -05:00

82 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using SentinelKernel.System.FileSystem.VFS;
using Cosmos.Common.Extensions;
using Sys = Cosmos.System;
namespace SentinelKernel
{
public class Kernel : Sys.Kernel
{
private VFSBase myVFS;
protected override void BeforeRun()
{
Console.WriteLine("Cosmos booted successfully.");
myVFS = new SentinelVFS();
VFSManager.RegisterVFS(myVFS);
}
protected override void Run()
{
Console.WriteLine("Run");
try
{
var xRoot = Path.GetPathRoot(@"0:\test");
bool xTest = Directory.Exists("0:\\test");
Console.WriteLine("After test");
if (!xTest)
{
Console.WriteLine("Folder does not exist!");
return;
}
//Console.WriteLine("Folder exists!");
//xTest = Directory.Exists("0:\\test\\DirInTest");
//if (!xTest)
//{
// Console.WriteLine("Subfolder doesn't exist!");
// return;
//}
//Console.WriteLine("Subfolder exists as well!");
xTest = File.Exists(@"0:\KudzU.txt");
if (!xTest)
{
Console.WriteLine(@"\Kudzu.txt not found!");
return;
}
Console.WriteLine("Kudzu.txt found!");
Console.Write("File contents of Kudzu.txt: ");
Console.WriteLine(File.ReadAllText(@"0:\Kudzu.txt"));
File.WriteAllText(@"0:\Kudzu.txt", "Test FAT write.");
Console.WriteLine(File.ReadAllText(@"0:\Kudzu.txt"));
//xTest = File.Exists(@"0:\Test\DirInTest\Readme.txt");
//if (!xTest)
//{
// Console.WriteLine(@"\Test\DirInTest\Readme.txt not found!");
// return;
//}
//Console.WriteLine(@"Test\DirInTest\Readme.txt found!");
//Console.WriteLine(@"File contents of Test\DirInTest\Readme.txt: ");
//Console.WriteLine(File.ReadAllText(@"0:\Test\DirInTest\Readme.txt"));
}
catch (Exception e)
{
Console.WriteLine("Exception occurred:");
Console.WriteLine(e.Message);
}
finally
{
while (true)
{
}
}
}
}
}