Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Dynamic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Threading.Tasks;
- namespace CSLight
- {
- class Program
- {
- static void Main(string[] args)
- {
- string comand;
- string tempPassword = "";
- string name = "";
- string password = "";
- int tryCount = 3;
- string tempName;
- while (true)
- {
- comand = Console.ReadLine();
- if (comand == "Exit" || comand == "e")
- break;
- else if (comand == "Help" || comand == "h")
- {
- Console.WriteLine("Esc или e - выход из программы");
- Console.WriteLine("SetName или sn – установить имя");
- Console.WriteLine("ChangeConsoleColor или ссс - изменить цвет консоли");
- Console.WriteLine("SetPassword или sp – установить пароль ");
- Console.WriteLine("WriteName или wn– вывести имя (после ввода пароля)");
- Console.WriteLine("Help или h – отобразить список команд");
- }
- else if (comand == "SetName" || comand == "sn")
- {
- for (int i = 0; i < tryCount; i++)
- {
- Console.Write("Введите имя(не может содержать меньше одного символа):");
- tempName = Console.ReadLine();
- if (tempName.Length >= 1)
- {
- name = tempName;
- Console.WriteLine($"Имя '{name}' может быть использовано.");
- break;
- }
- else
- {
- Console.WriteLine("Имя должно содержать больше одного символа.");
- }
- }
- }
- else if (comand == "SetPassword" || comand == "sp")
- for (int i = 0; i < tryCount; i++)
- {
- Console.Write("Введите пароль(6 символов):");
- tempPassword = Console.ReadLine();
- if (tempPassword.Length >= 6)
- {
- password = tempPassword;
- Console.WriteLine($"Ваш пароль {password} отвечает требованиям.");
- break;
- }
- else
- {
- Console.WriteLine($"Ваш пароль {tempPassword} не отвечает требованиям. Требуется еще {6 - tempPassword.Length} cимволов");
- }
- }
- else if (comand == "WriteName" || comand == "wn")
- {
- if (password == "" && name == "")
- {
- Console.WriteLine("Для отображения имени требуется задать пароль(Команда SetPassword) и имя (Команда SetName)");
- Console.WriteLine("");
- Console.WriteLine("");
- }
- else if (name == "")
- {
- Console.WriteLine("Для отображения требуется задать имя(Команда SetName)");
- Console.WriteLine("");
- Console.WriteLine("");
- }
- else if (password == "")
- {
- Console.WriteLine("Для отображения требуется задать пароль(Команда SetPassword)");
- Console.WriteLine("");
- Console.WriteLine("");
- }
- else if (name != "" && password != "")
- for (int i = 0; i < tryCount; i++)
- {
- Console.Write("Введите пароль:");
- if (password == Console.ReadLine())
- {
- Console.WriteLine($"Ваше имя: {name}");
- break;
- }
- else
- {
- Console.WriteLine($"Пароль не верный, осталось {tryCount - i - 1} попыток");
- }
- }
- }
- else if (comand == "ChangeConsoleColor" || comand == "ccc")
- while (true)
- {
- comand = Console.ReadLine();
- if (comand == "Exit" || comand == "e")
- {
- Console.WriteLine("Вы вышли из меню изменения цвета консоли.");
- break;
- }
- else if (comand == "ChangeBackgroundСolor" || comand == "cbc")
- {
- Console.WriteLine("Изменить на серый желтый - 1");
- Console.WriteLine("Изменить на серый красный - 2");
- Console.WriteLine("Изменить на серый зеленый - 3");
- comand = Console.ReadLine();
- switch(comand)
- {
- case "1":
- Console.BackgroundColor = ConsoleColor.Yellow;
- Console.Clear();
- Console.WriteLine("Цвет изменен на желтый");
- break;
- case "2":
- Console.BackgroundColor = ConsoleColor.Red;
- Console.Clear();
- Console.WriteLine("Цвет изменен на красный");
- break;
- case "3":
- Console.BackgroundColor = ConsoleColor.Green;
- Console.Clear();
- Console.WriteLine("Цвет изменен на зеленый");
- break;
- default:
- Console.WriteLine("Такой команды не существует.");
- Console.WriteLine("Вы вышли из меню изменения цвета фона консоли.");
- break;
- }
- }
- else if (comand == "СhangeTextColor" || comand == "ctc")
- {
- Console.WriteLine("Изменить на серый белый - 1");
- Console.WriteLine("Изменить на серый черный - 2");
- Console.WriteLine("Изменить на серый синий - 3");
- comand = Console.ReadLine();
- switch (comand)
- {
- case "1":
- Console.ForegroundColor = ConsoleColor.White;
- Console.Clear();
- Console.WriteLine("Цвет изменен на белый");
- break;
- case "2":
- Console.ForegroundColor = ConsoleColor.Black;
- Console.Clear();
- Console.WriteLine("Цвет изменен на черный");
- break;
- case "3":
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.Clear();
- Console.WriteLine("Цвет изменен на синий");
- break;
- default:
- Console.WriteLine("Такой команды не существует.");
- Console.WriteLine("Вы вышли из меню изменения цвета фона консоли.");
- break;
- }
- }
- else if (comand == "Help" || comand == "h")
- {
- Console.WriteLine("Esc или e - выход из программы");
- Console.WriteLine("ChangeBackgroundСolor или cbc - изменить цвет фона");
- Console.WriteLine("СhangeTextColor или ctc - изменить цвет текста");
- }
- else if (comand != "ChangeBackgroundСolor" || comand != "cbc" || comand != "СhangeTextColor" || comand != "ctc" || comand != "Help" || comand != "h" || comand != "help")
- {
- Console.WriteLine($"Команды '{comand}'не существует, отобразить список команд - help");
- }
- }
- else if (comand != "SetName" || comand != "sn" || comand != "SetPassword" || comand != "sp" || comand != "WriteName" || comand != "wn" || comand != "Help" || comand != "h" || comand != "help")
- {
- Console.WriteLine($"Команды '{comand}'не существует, отобразить список команд - help");
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment