// init public static void Initialize() { try { // init Driver Driver = new CosmosVFS(); Sys.FileSystem.VFS.VFSManager.RegisterVFS(Driver); // check for system path if (!FolderExists(@"0:\SYSTEM")) { CreateFolder(@"0:\SYSTEM"); } // if no config file exists at default location, create one if (!FileExists(ConfigFile)) { WriteAllText(ConfigFile, SystemInfo.DefaultConfig); } } // unknown exception catch (Exception ex) { Console.WriteLine("Error intializing FAT file system!"); Console.WriteLine("[INTERNAL] " + ex.Message); } }
private static CosmosVFS createFS() { CosmosVFS vfs = new CosmosVFS(); vfs.Initialize(); return(vfs); }
protected override void BeforeRun() { // init filesystem var fs = new CosmosVFS(); VFSManager.RegisterVFS(fs); }
public void Setup() { DebuggerFactory.WriteToConsole = true; var xDevice = new TestBlockDevice(); var xPartition = new Partition(xDevice, 0, xDevice.BlockCount); BlockDevice.Devices.Clear(); Partition.Partitions.Clear(); BlockDevice.Devices.Add(xDevice); Partition.Partitions.Add(xPartition); CosmosVFS cosmosVFS = new CosmosVFS(); VFSManager.RegisterVFS(cosmosVFS, true); foreach (var disk in VFSManager.GetDisks()) { foreach (var part in disk.Partitions) { if (part.RootPath == @"0:\") { ourDisk = disk; ourPart = part; break; } } } if (ourDisk == null) { throw new Exception("Failed to find our drive."); } }
public FileSystem() { Console.WriteLine("Initializing file system ..."); this.vfs = new CosmosVFS(); VFSManager.RegisterVFS(this.vfs); Console.WriteLine("File system initialized !"); }
protected override void BeforeRun() { Console.Clear(); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.Write("Booting Aura...\n"); Console.ForegroundColor = ConsoleColor.White; #region FileSystem Init FS = new CosmosVFS(); FS.Initialize(); Console.ForegroundColor = ConsoleColor.Green; Console.Write("[OK]"); Console.ForegroundColor = ConsoleColor.White; Console.Write(" "); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.Write("FileSystem Initialized\n"); Console.ForegroundColor = ConsoleColor.White; #endregion #region FileSystem Scan Sys.FileSystem.VFS.VFSManager.RegisterVFS(FS); Console.ForegroundColor = ConsoleColor.Green; Console.Write("[OK]"); Console.ForegroundColor = ConsoleColor.White; Console.Write(" "); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.Write("FileSystem Scanned\n"); Console.ForegroundColor = ConsoleColor.White; #endregion setup.InitSetup(); if (SystemExists) { if (!JustInstalled) { Settings.LoadValues(); langSelected = Settings.GetValue("language"); #region Language Lang.Keyboard.Init(); #endregion Info.getComputerName(); running = true; } } else { running = true; } }
protected override void BeforeRun() { fs = new CosmosVFS(); VFSManager.RegisterVFS(fs); Console.Clear(); if (!File.Exists(main_part + "AirOS.cfg")) { Setup.StartSetup.Step1(); } else { if (File.Exists(main_part + "lang.cfg")) { string lang = File.ReadAllText(main_part + "lang.cfg"); if (lang == "de") { SetKeyboardScanMap(new DE_Standard()); } else if (lang == "us") { SetKeyboardScanMap(new US_Standard()); } } Console.Write("Enter Username: "******":"); if (loguser == newuser[0]) { Console.Write("Enter Password: "******"Welcome Back {0}", newuser[0]); /* Network.NetworkInit.Init(); * Network.NetworkInit.Enable(); * System.Utilities.WaitSeconds(1); * Network.NetworkInterfaces.Init(); * System.Utilities.WaitSeconds(3);*/ return; } else { System.Utilities.ErrorScreen("0x101", "Your Login Details are incorrect!", 5, true); } } else { System.Utilities.ErrorScreen("0x101", "Your Login Details are incorrect!", 5, true); } } }
/// <summary> /// Initialise the filesystem service /// </summary> /// <returns></returns> public static bool Init() { if (Kernel.IsLive == true) { Active = false; return(false); } vFS = new CosmosVFS(); Cosmos.System.FileSystem.VFS.VFSManager.RegisterVFS(vFS); if (CheckVolumes() == false) { Console.WriteLine("Running Medli in Live User mode."); Console.WriteLine("FS operations are disabled!"); Kernel.IsLive = true; Active = false; return(false); } else { if ((File.Exists(Paths.System + @"live.user")) || Kernel.IsLive == true) { Console.WriteLine("OS in recovery mode! Live User mode enabled..."); Kernel.IsLive = true; Paths.CurrentDirectory = "LIVE"; Active = false; return(false); } else { /* * int i = 0; * for (i = 0; i < Paths.OSDirectories.Length; i++) * { * if (!Directory.Exists(Paths.OSDirectories[i])) * { * AreaInfo.SystemDevInfo.WriteDevicePrefix("FS", "Creating directory " + Paths.OSDirectories[i] + "..."); * System.FS.Makedir(Paths.OSDirectories[i], true); * } * }*/ Paths.CreateDirectories(); ServiceLogger = new LoggingService(Paths.SystemLogs + @"\fs.log"); ServiceLogger.Record("FS Service logger initialized."); #warning WIP Restore Functionality //var mydrive = new DiskManager(driveID); //ServiceLogger.Record("Filesystem service running on " + mydrive.Name); ServiceLogger.Record("Filesystem service running on " + vFS.GetFileSystemLabel(driveID)); Kernel.IsLive = false; Level3.ReadHostname(); Directory.SetCurrentDirectory(Paths.Root); Paths.CurrentDirectory = Paths.Root; Active = true; return(true); } } }
/// <summary> /// Create new instance of the <see cref="FtpServer"/> class. /// </summary> /// <exception cref="Exception">Thrown if directory does not exists.</exception> /// <param name="fs">Initialized Cosmos Virtual Filesystem.</param> /// <param name="directory">FTP Server root directory path.</param> /// <param name="debug">Is debug logging enabled.</param> public FtpServer(CosmosVFS fs, string directory, bool debug = false) { if (Directory.Exists(directory) == false) { throw new Exception("FTP server can't open specified directory."); } CommandManager = new FtpCommandManager(fs, directory); Listening = true; Debug = debug; }
protected override void BeforeRun() { CosmosVFS cosmosVFS = new CosmosVFS(); VFSManager.RegisterVFS(cosmosVFS); bootBitmap = new Bitmap(@"0:\boot.bmp"); vMWareSVGAII = new DoubleBufferedVMWareSVGAII(); vMWareSVGAII.SetMode(screenWidth, screenHeight); vMWareSVGAII.DoubleBuffer_DrawImage(bootBitmap, 640 / 4, 0); vMWareSVGAII.DoubleBuffer_Update(); bitmap = new Bitmap(@"0:\timg.bmp"); programlogo = new Bitmap(@"0:\program.bmp"); uint r = 0; uint g = 0; uint b = 0; for (uint i = 0; i < bitmap.rawData.Length; i++) { Color color = Color.FromArgb(bitmap.rawData[i]); r += color.R; g += color.G; b += color.B; } avgCol = Color.FromArgb((int)(r / bitmap.rawData.Length), (int)(g / bitmap.rawData.Length), (int)(b / bitmap.rawData.Length)); MouseManager.ScreenWidth = screenWidth; MouseManager.ScreenHeight = screenHeight; MouseManager.X = screenWidth / 2; MouseManager.Y = screenHeight / 2; logView = new LogView(300, 200, 10, 30); Clock = new Clock(200, 200, 400, 200); notepad = new Notepad(200, 100, 10, 300); dock = new Dock(); apps.Add(logView); apps.Add(Clock); apps.Add(notepad); }
protected override void BeforeRun() { CosmosVFS cosmosVFS = new CosmosVFS(); VFSManager.RegisterVFS(cosmosVFS); bootBitmap = new Bitmap(@"0:\boot.bmp"); vMWareSVGAII = new DoubleBufferedVMWareSVGAII(); vMWareSVGAII.SetMode(screenWidth, screenHeight); vMWareSVGAII.DoubleBuffer_DrawImage(bootBitmap, screenWidth / 2 - bootBitmap.Width / 2, screenHeight / 2 - bootBitmap.Height / 2); vMWareSVGAII.DoubleBuffer_Update(); //bitmap = new Bitmap(@"0:\timg.bmp"); Wallpaper programlogo = new Bitmap(@"0:\program.bmp"); /* * uint r = 0; * uint g = 0; * uint b = 0; * for (uint i = 0; i < bitmap.rawData.Length; i++) * { * Color color = Color.FromArgb(bitmap.rawData[i]); * r += color.R; * g += color.G; * b += color.B; * } * avgCol = Color.FromArgb((int)(r / bitmap.rawData.Length), (int)(g / bitmap.rawData.Length), (int)(b / bitmap.rawData.Length)); */ avgCol = Color.DimGray; MouseManager.ScreenWidth = screenWidth; MouseManager.ScreenHeight = screenHeight; console = new Console(400, 300, 40, 40); dock = new Dock(); apps.Add(console); }
protected override void BeforeRun() { //check for real hardware if (RH.onRealHardware() == true) { RealH = "true"; RH.RealHardwareAlert(); } //starts the filesystem stuff fs = new Sys.FileSystem.CosmosVFS(); Sys.FileSystem.VFS.VFSManager.RegisterVFS(fs); //Check for Username and start Setup if (RH.onRealHardware() == true) { } else { if (File.Exists(@"0:\SYSTEM\Username.set")) { username = File.ReadAllText(@"0:\SYSTEM\Username.set"); } else { Setup.SetupStart(); } if (File.Exists(@"0:\SYSTEM\Date&Time.set")) { if (File.ReadAllText(@"0:\SYSTEM\Date&Time.set").Contains("12hour")) { time = "12hour"; } else { time = "24hour"; } } } //startup screen Console.ResetColor(); Bcolor(); Console.Clear(); printLogoConsole(); Console.WriteLine("\n"); Console.WriteLine("Type cmd for a list of commands and Apps. "); Console.WriteLine(""); //check for calender if (RH.onRealHardware() == true) { } else { var root = @"0:\"; Directory.SetCurrentDirectory(root); if (File.Exists(DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Year + ".cal")) { Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Reminder: You have a Calender for Today! Type 'open " + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Year + ".cal' to veiw it.\n"); Console.ResetColor(); } } }
/// <summary> /// Create new instance of the <see cref="FtpCommandManager"/> class. /// </summary> /// <param name="fs">Cosmos Virtual Filesystem.</param> /// <param name="directory">Base directory used by the FTP server.</param> internal FtpCommandManager(CosmosVFS fs, string directory) { FileSystem = fs; CurrentDirectory = directory; BaseDirectory = directory; }
protected override void BeforeRun() { //Init the file system var fs = new CosmosVFS(); VFSManager.RegisterVFS(fs); Console.Clear(); //Find the location where we booted from string boot = ""; bool frame = false; foreach (var item in fs.GetVolumes()) { Console.WriteLine("Found volume: " + item.mFullPath); foreach (var d in Directory.GetDirectories(item.mFullPath)) { Console.WriteLine("dir: " + d); } foreach (var d in Directory.GetFiles(item.mFullPath)) { Console.WriteLine("file: " + d); } if (File.Exists(item.mFullPath + "TESTAPP.DLL") | File.Exists(item.mFullPath + "dotnetparser.exe")) { Console.WriteLine("Found boot volume: " + item.mFullPath); boot = item.mFullPath; } if (Directory.Exists(item.mFullPath + "framework")) { frame = true; } else if (Directory.Exists(item.mFullPath + "FRAMEW")) { frame = false; } } if (boot == "") { Console.WriteLine("Cannot find the media that we booted from."); return; } try { byte[] fi = TestApp.file; if (File.Exists(boot + @"TESTAPP.DLL")) { fi = File.ReadAllBytes(boot + @"TESTAPP.DLL"); } else if (File.Exists(boot + @"DotNetparserTester.exe")) { fi = File.ReadAllBytes(boot + @"DotNetparserTester.exe"); } var fl = new DotNetFile(fi); var clr = new DotNetClr(fl, frame ? boot + @"framework" : boot + @"FRAMEW"); //Register our internal methods clr.RegisterCustomInternalMethod("TestsComplete", TestsComplete); clr.RegisterCustomInternalMethod("TestSuccess", TestSuccess); clr.RegisterCustomInternalMethod("TestFail", TestFail); clr.Start(); Console.WriteLine("Program exec complete."); } catch (Exception x) { Console.WriteLine("Caught error: " + x.Message); } }
public Filesystem() { _vfs = new CosmosVFS(); Sys.FileSystem.VFS.VFSManager.RegisterVFS(_vfs); }
public void start_inst(CosmosVFS fs) { try { //This is in the if.. statement. Remove the Kernel.Stop(); Console.Clear(); Console.WriteLine("-----Uszka Installer-----"); /* * Console.WriteLine("Create a username and password:"******"Username: "******"Password: "******"Starting Installation Process..."); Console.WriteLine("Creating System Directory..."); fs.CreateDirectory("0:\\SYSTEM\\"); Console.WriteLine("Creating System Files"); fs.CreateFile("0:\\SYSTEM\\System.cx"); fs.CreateFile("0:\\SYSTEM\\users.db"); fs.CreateFile("0:\\SYSTEM\\readme.txt"); fs.CreateFile("0:\\SYSTEM\\sysinfo.txt"); Console.WriteLine("Setting User Preferences..."); File.WriteAllText("0:\\SYSTEM\\System.cx", "using Jajka_OS;" + "namespace System { " + "class System" + "{" + "public void Main()" + "{" + "Console.WriteLine(\"System File. Do not edit.\"" + ") } } }"); File.WriteAllText("0:\\SYSTEM\\users.db", "No Users need run afterinstall"); File.WriteAllText("0:\\SYSTEM\\readme.txt", "Note: Put the license here!"); File.WriteAllText("0:\\SYSTEM\\sysinfo.txt", "Uszka Version 0.0.1 [8 GB]"); fs.CreateDirectory("0:\\Documents\\"); try { Console.WriteLine("Deleting Preinstalled CosmosVFS Files"); Directory.Delete("0:\\Dir Testing\\"); Directory.Delete("0:\\TEST\\"); //fs.DeleteDirectory("0:\\Dir Testing\\"); //fs.DeleteDirectory("0:\\TEST\\"); File.Delete("0:\\Kudzu.txt"); File.Delete("0:\\Root.txt"); } catch (Exception ex) { } Console.WriteLine("Setting Flags"); if (!File.Exists("0:\\Flags.flg")) { // Create a file to write to. using (StreamWriter sw = File.CreateText("0:\\Flags.flg")) { sw.Write("2"); } } Console.Write("Press R to reboot..."); /* * char readkey = Console.ReadKey().KeyChar; * if (readkey == 'R' || readkey == 'r') * { * Power.ACPIReboot(); * } * else if (readkey == 'E' || readkey == 'e') * { * CrashHandler CH = new CrashHandler(); * try * { * TestingException ex = new TestingException(); * CH.Whoops(ex); * } * catch (Exception ex) * { * CH.Whoops(ex); * } * }*/ } catch (Exception ex) { CrashHandler CH = new CrashHandler(); CH.Whoops(ex); } }