예제 #1
0
        public static string HandleLevelUserInput()
        {
            Console.SetCursorPosition(26, 23);

            string tmp = AenigmaUtils.ReadLine();

            Console.SetCursorPosition(26, 23);
            for (int i = 27; i < 45; i++)
            {
                Console.Write("_");
            }

            Console.SetCursorPosition(26, 23);
            return(tmp);
        }
예제 #2
0
        /// <summary>
        /// Run through the boot sequence.
        /// </summary>
        public static void BeginBootSequence()
        {
            ClearBox();

            using (StreamReader sr = new StreamReader("boot/a0.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 0);
                }
            }

            AenigmaUtils.ReadLine();

            ClearBox();

            using (StreamReader sr = new StreamReader("boot/a1.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 0);
                }
            }

            AenigmaUtils.ReadLine();

            ClearBox();

            using (StreamReader sr = new StreamReader("boot/bios.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 0);
                }
            }


            Thread.Sleep(2500);

            ClearBox();

            using (StreamReader sr = new StreamReader("boot/bios2.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 0);
                }
            }

            Thread.Sleep(2500);

            ClearBox();

            using (StreamReader sr = new StreamReader("boot/floppy.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 0);
                }
            }

            Thread.Sleep(500);

            using (StreamReader sr = new StreamReader("boot/floppy2.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 2);
                }
            }

            Thread.Sleep(2000);

            using (StreamReader sr = new StreamReader("boot/floppy3.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 2);
                }
            }

            Thread.Sleep(500);

            using (StreamReader sr = new StreamReader("boot/floppy4.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 0);
                }
            }

            Thread.Sleep(100);

            using (StreamReader sr = new StreamReader("boot/floppy5.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 0);
                }
            }

            Thread.Sleep(1000);

            using (StreamReader sr = new StreamReader("boot/floppy6.txt"))
            {
                string line;

                PhoneNumber = GetRandomPhoneNumber();
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line.Replace("XXXXX XXXXXX", PhoneNumber), 0);
                }
            }

            Thread.Sleep(2500);

            using (StreamReader sr = new StreamReader("boot/floppy7.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    WriteLineToBox(line, 0);
                }
            }

            Thread.Sleep(500);

            HandleMainMenu();
        }
예제 #3
0
        /// <summary>
        /// Run through the main menu.
        /// </summary>
        public static void HandleMainMenu()
        {
            ClearBox();

            WriteLineToBox($"[Connected to Aenigma BBS via {PhoneNumber}]");
            WriteLineToBox("[INFO // https://aenigma.mynameistavis.com]");
            WriteLineToBox("[INFO // Retrieving data from BBS...]");

            int amountLoaded = 0;

            while (amountLoaded < 126)
            {
                if (amountLoaded >= 114)
                {
                    amountLoaded += (126 - amountLoaded);
                }

                WriteStatusMessage($"Downloaded {amountLoaded} / 126 KB.");

                amountLoaded += new Random().Next(5, 12);
                Thread.Sleep(300);
            }

            CurrentUsers = new Random().Next(30, 90);


            using (StreamReader sr = new StreamReader("boot/main_menu.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    if (line.Contains("{0}"))
                    {
                        line = string.Format(line, LifetimeAttempts,
                                             (LastPlayed != DateTime.MinValue) ? LastPlayed.ToString("HH:mm dd/MM/yy") : "00:00 00/00/00",
                                             CurrentUsers);
                    }

                    line = line.Replace("{color_begin}", "\x1B[0;32m");
                    line = line.Replace("{color_end}", "\x1B[0m");

                    WriteLineToBox(line, 0);
                }
            }

            ClearStatusMessage();

            Console.SetCursorPosition(14, 46);

            AenigmaLevel nextLevel            = null;
            int          LastNumberOfTimeouts = NumberOfTimeouts;

            while (nextLevel == null && LastNumberOfTimeouts == NumberOfTimeouts)
            {
                string password = AenigmaUtils.ReadLine();

                if (password == "sudoritual2216")
                {
                    Environment.Exit(255);
                }

                if (password == "sudoritual2217")
                {
                    BeginBootSequence();
                }

                try
                {
                    nextLevel = AenigmaLevelManager.GetLevelByPassword(password);
                }
                catch (LevelNotFoundException)
                {
                    FailedLoginAttempts++;
                    if (FailedLoginAttempts >= 3)
                    {
                        AenigmaMenuUtils.WriteStatusMessage(
                            "Whatever it is you're doing, please stop it and just type \"start\".");
                    }
                    else
                    {
                        AenigmaMenuUtils.WriteStatusMessage("Invalid password!");
                    }

                    Console.SetCursorPosition(14, 46);
                    for (int i = 0; i < password?.Length; i++)
                    {
                        Console.Write(" ");
                    }
                    Console.SetCursorPosition(14, 46);
                }
            }

            FailedLoginAttempts = 0;
            LifetimeAttempts   += 1;

            if (LastNumberOfTimeouts != NumberOfTimeouts)
            {
                return;
            }

            AenigmaLevelHandler.JumpToLevel(nextLevel);
        }