void SetupSystem() { Machine.Devices.ForEach(AddDevice); Machine.OnDeviceConnected += AddDevice; Machine.OnDeviceDisconnected += RemoveDevice; rootDirectory = DirEntry.MakeRoot(); var dev = rootDirectory.CreateSubdirectory("dev"); var devFs = new DevFs(dev, this); dev.fileSystem = devFs; dev.isMountPoint = true; dev.Refresh(); var sys = rootDirectory.CreateSubdirectory("sys"); var sysFs = new SysFs(dev, this); sys.fileSystem = sysFs; sys.isMountPoint = true; sys.Refresh(); Mount("/dev/" + DeviceType.SCSIDevice.GetName(), "/", "csv"); session = new Session(); session.operatingSystem = this; session.userName = "******"; var input = GetFileEntry("/dev/" + DeviceType.Keyboard.GetName()); if (input.Exists) { session.stdIn = input.OpenText(); } else { session.stdIn = new StreamReader(Stream.Null); } var output = GetFileEntry("/dev/" + DeviceType.Display.GetName()); if (output.Exists) { session.stdOut = session.stdErr = new StreamWriter(output.OpenWrite()) { AutoFlush = true }; } else { var stdOut = GetFileEntry("/tmp/std-out-" + World.UtcNow.Ticks + ".txt"); session.stdOut = new StreamWriter(stdOut.OpenWrite()) { AutoFlush = true }; var stdErr = GetFileEntry("/tmp/std-err-" + World.UtcNow.Ticks + ".txt"); session.stdErr = new StreamWriter(stdErr.OpenWrite()) { AutoFlush = true }; } session.currentDirectory = "/"; api.Console.WriteLine("niOS [version 0.0.1.0a]"); api.Console.WriteLine("(c) 2016 Neitri Industries. All rights reserved."); api.Console.WriteLine(World.UtcNow); //.WriteLine("This software is protected by following patents US14761 NI4674765 EU41546 US145-7756 US765-577") //.WriteLine("Any unauthorized reproduction of this software is strictly prohibited.") api.Console.WriteLine(); if (!api.File.Exists("/bin/sh")) { api.Console.WriteLine("/bin/sh not found, re/installing system"); new InitializeFileSystem().Install(this.session, "/"); } if (input.Exists) { UserInteraction(); } }