public void Update() { Width = (uint)(Kernel.apps.Count * Kernel.programlogo.Width + Kernel.apps.Count * Devide); Kernel.vMWareSVGAII.DoubleBuffer_DrawFillRectangle(0, 0, Kernel.screenWidth, 20, (uint)Kernel.avgCol.ToArgb()); string text = "PowerOFF"; uint strX = 2; uint strY = (20 - 16) / 2; Kernel.vMWareSVGAII._DrawACSIIString("PowerOFF", (uint)Color.White.ToArgb(), strX, strY); if (Kernel.Pressed) { if (MouseManager.X > strX && MouseManager.X < strX + (text.Length * 8) && MouseManager.Y > strY && MouseManager.Y < strY + 16) { ACPI.Shutdown(); } } Kernel.vMWareSVGAII.DoubleBuffer_DrawFillRectangle((Kernel.screenWidth - Width) / 2, Kernel.screenHeight - Height, Width, Height, (uint)Kernel.avgCol.ToArgb()); for (int i = 0; i < Kernel.apps.Count; i++) { Kernel.apps[i].dockX = (uint)(Devide / 2 + ((Kernel.screenWidth - Width) / 2) + (Kernel.programlogo.Width * i) + (Devide * i)); Kernel.apps[i].dockY = Kernel.screenHeight - Kernel.programlogo.Height - Devide / 2; Kernel.vMWareSVGAII.DoubleBuffer_DrawImage(Kernel.programlogo, Kernel.apps[i].dockX, Kernel.apps[i].dockY); } }
/// <summary> /// Initiates a Bluescreen. /// </summary> /// <param name="error">Error title or exception name</param> /// <param name="description">Error description</param> /// <param name="critical">Critical error?</param> public static void Init( string error = "Something went wrong!", string description = "Unknown exception", bool critical = false) { DrawOOPS(); if (description.Length + 33 < System.Console.WindowHeight) { System.Console.CursorTop = 2; System.Console.CursorLeft = 33; ConsoleColor errcolor = ConsoleColor.White; if (critical) { errcolor = ConsoleColor.Red; } AConsole.WriteLineEx(error, errcolor, ConsoleColor.Blue); AConsole.CursorTop = 4; AConsole.CursorLeft = 70; AConsole.WriteLineEx(description, ConsoleColor.White, ConsoleColor.Blue); } else { AConsole.CursorTop = 12; AConsole.CursorLeft = 2; ConsoleColor errcolor = ConsoleColor.White; if (critical) { errcolor = ConsoleColor.Red; } AConsole.WriteLineEx(error, errcolor, ConsoleColor.Blue); AConsole.CursorTop = 14; AConsole.CursorLeft = 2; AConsole.WriteLineEx(description, ConsoleColor.White, ConsoleColor.Blue); } if (!critical) { AConsole.CursorTop = AConsole.WindowHeight - 1; AConsole.WriteEx("Press the [Enter]-key to resume", ConsoleColor.White, ConsoleColor.Blue); AConsole.CursorTop++; AConsole.ReadLine(); AConsole.Clear(); } else { AConsole.CursorTop = AConsole.WindowHeight - 4; AConsole.WriteLineEx("Press the [Enter]-key to shutdown", ConsoleColor.White, ConsoleColor.Blue); AConsole.CursorTop++; AConsole.WriteLineEx("If it doesn't work, press the RESET-button on your computer.", ConsoleColor.White, ConsoleColor.Blue); AConsole.CursorTop++; AConsole.ReadLine(); ACPI.Shutdown(); } }
public static void Init(Exception ex, bool critical = false) { DrawOOPS(); if (ex.Message.Length + 33 < AConsole.WindowHeight) { AConsole.CursorTop = 2; AConsole.CursorLeft = 33; ConsoleColor errcolor = ConsoleColor.White; if (critical) { errcolor = ConsoleColor.Red; } //AConsole.WriteLineEx(ex.Source, errcolor, ConsoleColor.Blue); AConsole.CursorTop = 3; AConsole.CursorLeft = 70; AConsole.WriteLineEx(ex.Message, ConsoleColor.White, ConsoleColor.Blue); } else { AConsole.CursorTop = 12; AConsole.CursorLeft = 2; ConsoleColor errcolor = ConsoleColor.White; if (critical) { errcolor = ConsoleColor.Red; } //AConsole.WriteLineEx(ex.Source, errcolor, ConsoleColor.Blue); AConsole.CursorTop = 13; AConsole.CursorLeft = 2; AConsole.WriteLineEx(ex.Message, ConsoleColor.White, ConsoleColor.Blue); } if (!critical) { AConsole.CursorTop = AConsole.WindowHeight - 3; AConsole.WriteEx("Press the [Enter]-key to resume", ConsoleColor.White, ConsoleColor.Blue); AConsole.CursorTop++; AConsole.ReadLine(); AConsole.Clear(); } else { AConsole.CursorTop = AConsole.WindowHeight - 4; AConsole.WriteEx("Press the [Enter]-key to shutdown", ConsoleColor.White, ConsoleColor.Blue); AConsole.CursorTop++; AConsole.WriteEx("If it doesn't work, press the RESET-button on your computer.", ConsoleColor.White, ConsoleColor.Blue); AConsole.CursorTop++; AConsole.ReadLine(); ACPI.Shutdown(); } }
//Shutdown with ACPI /// <summary> /// Shutdown the ACPI. /// </summary> /// <exception cref="System.IO.IOException">Thrown on IO error.</exception> public static void ACPIShutdown() { ACPI.Shutdown(); }
public static void ShutDown() { ACPI.Shutdown(); ACPI.Disable(); Cosmos.Core.Global.CPU.Halt(); }
public void shutdownButtonPressed() { ACPI.Shutdown(); }
public void Update() { //Top bar Width = (uint)(Kernel.WindowManager.apps.Count * Kernel.programLogo.Width + Kernel.WindowManager.apps.Count * Devide); Kernel.canvas.DrawFilledRectangle(Kernel.avgColPen, 0, 0, (int)Kernel.screenWidth, 24); uint strX = 0; uint strY = 0; Kernel.canvas.DrawImage(Kernel.powerIco, (int)strX, (int)strY); if (!NetworkStack.ConfigEmpty()) { Kernel.canvas.DrawImage(Kernel.connectedIco, (int)(Kernel.screenWidth - 24), (int)strY); } string time = Time.TimeString(true, true, true); Kernel.canvas.DrawString(time, Kernel.font, Kernel.BlackPen, (int)((Kernel.screenWidth / 2) - ((time.Length * Kernel.font.Width) / 2)), (int)(strY + 4)); if (Kernel.Pressed) { if (MouseManager.X > strX && MouseManager.X < strX + Kernel.powerIco.Width && MouseManager.Y > strY && MouseManager.Y < strY + 24) { ACPI.Shutdown(); } } //Dock Kernel.canvas.DrawFilledRectangle(Kernel.avgColPen, (int)(Kernel.screenWidth - Width) / 2, (int)(Kernel.screenHeight - Height), (int)Width, (int)Height); int i = 0; foreach (var process in Kernel.ProcessManager.Processes) { if (process.Type == ProcessType.Program) { var app = process as App; app.dockX = (uint)(Devide / 2 + ((Kernel.screenWidth - Width) / 2) + (Kernel.programLogo.Width * i) + (Devide * i)); app.dockY = Kernel.screenHeight - Kernel.programLogo.Height - Devide / 2; Kernel.canvas.DrawImage(Kernel.programLogo, (int)app.dockX, (int)app.dockY); i++; if (MouseManager.X > app.dockX && MouseManager.X < app.dockX + app.dockWidth && MouseManager.Y > app.dockY && MouseManager.Y < app.dockY + app.dockHeight) { Kernel.canvas.DrawString(app.name, Kernel.font, Kernel.WhitePen, (int)(app.dockX - ((app.name.Length * 8) / 2) + app.dockWidth / 2), (int)(app.dockY - 20)); } if (MouseManager.MouseState == MouseState.Left) { if (!Clicked && MouseManager.X > app.dockX && MouseManager.X < app.dockX + app.dockWidth && MouseManager.Y > app.dockY && MouseManager.Y < app.dockY + app.dockHeight) { Clicked = true; app.visible = !app.visible; if (app.visible) { Kernel.ProcessManager.Start(app); } else { app.Stop(); } } } else { Clicked = false; } } } }
public static void CMD_Shutdown()//byte* param) { ACPI.Shutdown(); }
protected override void Run() { Console.Write("Input: "); var input = Console.ReadLine(); switch (input) { case "about": { Console.WriteLine("Welcome to the OS(TBD)"); Console.WriteLine("Made by Jatin and Ishaan"); break; } case "help": { Console.WriteLine("about: Tells about the OS"); Console.WriteLine("help: list all the available commands"); Console.WriteLine("calc: Basic calculator"); Console.WriteLine("echo: Repeats the given input"); break; } case "echo": { var echo = Console.ReadLine(); Console.Write("Text typed: "); Console.WriteLine(echo); break; } case "shutdown": { ACPI.Shutdown(); break; } case "mkdir": { string dirpath = @"D:\Testdir4"; try { if (Directory.Exists(dirpath)) { Console.WriteLine("That path exists already."); return; } System.IO.Directory.CreateDirectory(dirpath); Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(dirpath)); } catch (Exception e) { Console.WriteLine("The process failed: {0}", e.ToString()); } break; } case "calc": { double a, b; char c; Console.Write("Enter First Number: "); a = Double.Parse(Console.ReadLine()); Console.Write("Enter Second Number: "); b = Double.Parse(Console.ReadLine()); Console.Write("Enter Sign (+ - * /): "); c = Char.Parse(Console.ReadLine()); switch (c) { case '+': Console.WriteLine("{0}+{1}={2}", a, b, a + b); break; case '-': Console.WriteLine("{0}-{1}={2}", a, b, a - b); break; case '*': Console.WriteLine("{0}*{1}={2}", a, b, a * b); break; case '/': Console.WriteLine("{0}/{1}={2}", a, b, a / b); break; default: Console.WriteLine("Unknown sign!"); break; } break; } default: Console.WriteLine("Unknown command"); break; } }
private static uint internalAllocation(uint size, bool allign) { totalAllocations++; tryAgain :; uint returnable = 0; if (Settings.HeapUseBasic || entryCount == 0) { if (heapPointer == 0) { heapPointer = Utils.allign4K(Multiboot.GetEndOfKernel()) + 4096; } if (allign) { heapPointer = Utils.allign4K(heapPointer) + 4096; } uint tmp = heapPointer; heapPointer += size; returnable = tmp; goto allocationEnd; } mutex.Lock(); if (currentEntry >= entryCount) { currentEntry = 0; } var entry = directory->GetEntry(currentEntry); if (entry->used) { currentEntry++; goto tryAgain; } if (!allign && size < 4096) { if (entry->size <= size && entry->location != 0) { entry->used = true; returnable = entry->location; goto allocationEnd; } if (size > pageSpace) { pageSpace = 4096; heapPointer = PageManager.GetFreePage(); if (heapPointer == 0) { // need to to a GC scan and free some pages Console.WriteLine("RAN OUT OF RAM"); ACPI.Shutdown(); while (true) { } } } pageSpace -= size; entry->size = size; entry->location = heapPointer; heapPointer += size; entry->used = true; returnable = entry->location; goto allocationEnd; } else { int num = (int)(size / 4096); int remainder = (int)(size % 4096); if (remainder > 0) { num++; } entry->used = true; entry->location = PageManager.GetFreePage(num); entry->size = (uint)num * 4096; returnable = entry->location; goto allocationEnd; } allocationEnd :; Utils.memset((byte *)returnable, 0, size); mutex.Unlock(); return(returnable); }