Advertisement
LeRoY_Go

Untitled

Jan 25th, 2022
676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.32 KB | None | 0 0
  1. using System;
  2.  
  3. namespace C_Sharp_Junior
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string userName = null;
  10.             string password = null;
  11.             bool inputCheckName = false;
  12.             bool inputCheckPassword = false;
  13.             while (true)
  14.             {
  15.                 Console.WriteLine("SetName – установить имя\n" +
  16.                     "ChangeConsoleColor - изменить цвет консоли\n" +
  17.                     "ChangeConsoleColorText - изменить цвет текста в консоли\n" +
  18.                     "SetPassword – установить пароль\n" +
  19.                     "WriteName – вывести имя(после ввода пароля)\n" +
  20.                     "Esc – выход из программы");
  21.                 Console.Write("Введите команду из предложенных:");
  22.                 string userInput = Console.ReadLine();
  23.                 switch (userInput)
  24.                 {
  25.                     case "SetName":
  26.                         Console.Write("Введите имя:");
  27.                         userName = Console.ReadLine();
  28.                         Console.WriteLine("Ваше имя:" + userName);
  29.                         inputCheckName = true;
  30.                         break;
  31.                     case "ChangeConsoleColor":
  32.                         Console.WriteLine("Выбирите вариант темы\n" +
  33.                             "1 - Тёмная тема(по умолчанию)\n" +
  34.                             "2 - Светлая тема");
  35.                         Console.Write("Введите пункт:");
  36.                         string topicSelection = Console.ReadLine();
  37.                         switch (topicSelection)
  38.                         {
  39.                             case "1":
  40.                                 Console.BackgroundColor = ConsoleColor.Black;
  41.                                 Console.ForegroundColor = ConsoleColor.White;
  42.                                 break;
  43.                             case "2":
  44.                                 Console.BackgroundColor = ConsoleColor.White;
  45.                                 Console.ForegroundColor = ConsoleColor.Black;
  46.                                 break;
  47.                         }
  48.                         break;
  49.                     case "ChangeConsoleColorText":
  50.  
  51.                         Console.WriteLine("Выбирите вариант цвета текста\n" +
  52.                             "1  - Черный цвет \n" +
  53.                             "2  - Темно-синий цвет \n" +
  54.                             "3  - Темно-зеленый цвет \n" +
  55.                             "4  - Темно-голубой цвет (темный сине-зеленый) \n" +
  56.                             "5  - Темно-красный цвет \n" +
  57.                             "6  - Темно-пурпурный цвет (темный фиолетово-красный) \n" +
  58.                             "7  - Темно-желтый цвет (коричнево-желтый) \n" +
  59.                             "8  - Серый цвет. \n" +
  60.                             "9  - Темно-серый цвет \n" +
  61.                             "10 - Синий цвет \n" +
  62.                             "11 - Зеленый цвет \n" +
  63.                             "12 - Голубой цвет (сине-зеленый) \n" +
  64.                             "13 - Красный цвет \n" +
  65.                             "14 - Пурпурный цвет (фиолетово-красный) \n" +
  66.                             "15 - Желтый цвет \n" +
  67.                             "16 - Белый цвет");
  68.                         Console.Write("Ваш выбор:");
  69.                         int numberColorText = Convert.ToInt32(Console.ReadLine()) - 1;
  70.                         Console.ForegroundColor = (ConsoleColor)numberColorText;
  71.                         break;
  72.                     case "SetPassword":
  73.                         Console.Write("Придумайте пароль:");
  74.                         password = Console.ReadLine();
  75.                         inputCheckPassword = true;
  76.                         break;
  77.                     case "WriteName":
  78.                         Console.Write("Введите пароль:");
  79.                         string inputPassword = Console.ReadLine();
  80.                         if (inputCheckName == true && inputCheckPassword == true && password == inputPassword)
  81.                         {
  82.                             Console.WriteLine("Ваше имя:" + userName);
  83.                         }
  84.                         else
  85.                         {
  86.                             Console.WriteLine("Ошибка. Возможно вы ввели неправильно пароль или не установили имя и пароль вообще.");
  87.                         }
  88.                         break;
  89.                     case "Esc":
  90.                         Environment.Exit(0);
  91.                         break;
  92.                 }
  93.                 Console.WriteLine("Нажмите Enter что-бы вернуться в меню.");
  94.                 Console.ReadLine();
  95.                 Console.Clear();
  96.             }
  97.         }
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement