Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace C_Sharp_Junior
- {
- class Program
- {
- static void Main(string[] args)
- {
- string userName = null;
- string password = null;
- bool inputCheckName = false;
- bool inputCheckPassword = false;
- while (true)
- {
- Console.WriteLine("SetName – установить имя\n" +
- "ChangeConsoleColor - изменить цвет консоли\n" +
- "ChangeConsoleColorText - изменить цвет текста в консоли\n" +
- "SetPassword – установить пароль\n" +
- "WriteName – вывести имя(после ввода пароля)\n" +
- "Esc – выход из программы");
- Console.Write("Введите команду из предложенных:");
- string userInput = Console.ReadLine();
- switch (userInput)
- {
- case "SetName":
- Console.Write("Введите имя:");
- userName = Console.ReadLine();
- Console.WriteLine("Ваше имя:" + userName);
- inputCheckName = true;
- break;
- case "ChangeConsoleColor":
- Console.WriteLine("Выбирите вариант темы\n" +
- "1 - Тёмная тема(по умолчанию)\n" +
- "2 - Светлая тема");
- Console.Write("Введите пункт:");
- string topicSelection = Console.ReadLine();
- switch (topicSelection)
- {
- case "1":
- Console.BackgroundColor = ConsoleColor.Black;
- Console.ForegroundColor = ConsoleColor.White;
- break;
- case "2":
- Console.BackgroundColor = ConsoleColor.White;
- Console.ForegroundColor = ConsoleColor.Black;
- break;
- }
- break;
- case "ChangeConsoleColorText":
- Console.WriteLine("Выбирите вариант цвета текста\n" +
- "1 - Черный цвет \n" +
- "2 - Темно-синий цвет \n" +
- "3 - Темно-зеленый цвет \n" +
- "4 - Темно-голубой цвет (темный сине-зеленый) \n" +
- "5 - Темно-красный цвет \n" +
- "6 - Темно-пурпурный цвет (темный фиолетово-красный) \n" +
- "7 - Темно-желтый цвет (коричнево-желтый) \n" +
- "8 - Серый цвет. \n" +
- "9 - Темно-серый цвет \n" +
- "10 - Синий цвет \n" +
- "11 - Зеленый цвет \n" +
- "12 - Голубой цвет (сине-зеленый) \n" +
- "13 - Красный цвет \n" +
- "14 - Пурпурный цвет (фиолетово-красный) \n" +
- "15 - Желтый цвет \n" +
- "16 - Белый цвет");
- Console.Write("Ваш выбор:");
- int numberColorText = Convert.ToInt32(Console.ReadLine()) - 1;
- Console.ForegroundColor = (ConsoleColor)numberColorText;
- break;
- case "SetPassword":
- Console.Write("Придумайте пароль:");
- password = Console.ReadLine();
- inputCheckPassword = true;
- break;
- case "WriteName":
- Console.Write("Введите пароль:");
- string inputPassword = Console.ReadLine();
- if (inputCheckName == true && inputCheckPassword == true && password == inputPassword)
- {
- Console.WriteLine("Ваше имя:" + userName);
- }
- else
- {
- Console.WriteLine("Ошибка. Возможно вы ввели неправильно пароль или не установили имя и пароль вообще.");
- }
- break;
- case "Esc":
- Environment.Exit(0);
- break;
- }
- Console.WriteLine("Нажмите Enter что-бы вернуться в меню.");
- Console.ReadLine();
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement