public override void Execute() { Console.WriteLine("Enter string to be hashed using SHA256"); string hash = StringExtensions.SHA256(Console.ReadLine()); Console.WriteLine(hash); KernelExtensions.PressAnyKey(); }
/// <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(); } }