Exemplo n.º 1
0
        private static async Task KeyListener()
        {
            await Task.Run(() =>
            {
                while (!Error)
                {
                    switch (Console.ReadKey().KeyChar)
                    {
                    case (char)ConsoleKey.D9:
                        if (SegmentsToWrite - 4096 > 0)
                        {
                            SegmentsToWrite -= 4096;
                        }
                        break;

                    case (char)ConsoleKey.D0:
                        if (SegmentsToWrite + 4096 <= 16384)
                        {
                            SegmentsToWrite += 4096;
                        }
                        break;

                    case '\\':
                        if (ProcessPointer == 2)
                        {
                            ProcessPointer = 0;
                        }
                        else
                        {
                            ProcessPointer++;
                        }
                        break;

                    case (char)ConsoleKey.Enter:
                        try
                        {
                            MemoryControl.DeleteProcessSegments(MemoryControl._processes[ProcessPointer]);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                            throw;
                        }
                        break;

                    case ' ':
                        try
                        {
                            MemoryControl.WritingToRAM(SegmentsToWrite);
                        }
                        catch (Exception e)
                        {
                            Error = true;
                        }
                        break;
                    }
                }
            });
        }
Exemplo n.º 2
0
        static async Task Main(string[] args)
        {
            Console.CursorVisible = false;
            MemoryControl.Initialization();
            MemoryControl.FreeSegmentsUpdate();
            KeyListener();
            await UIUpdate();


            Console.BackgroundColor = ConsoleColor.Blue;
            Clear(1, 1, Console.WindowWidth - 1, Console.WindowHeight);
            Console.SetCursorPosition(Console.WindowWidth / 4, Console.WindowHeight / 2);
            Console.Write(":(   Your PC Ran into a Problem and Needs to Restart");

            Console.ReadKey();
        }