/// <summary> /// Авторизация в системе /// </summary> /// <param name="login">Логин пользователя</param> /// <param name="password">Пароль пользователя</param> /// <param name="isDone">Закончена ли авторизация</param> /// <returns>Статус авторизации</returns> public static AuthorizationStatus Authorization(string login, string password, bool isDone) { if (isDone) { if (!AuthLoginInFile(login)) { return(AuthorizationStatus.AuthError); } _login = login; _md5 = HashForSecurity.GetMd5Hash(login + password); string md5 = _fileUsers.GetMd5(login); if (md5 != _md5) { return(AuthorizationStatus.AuthError); } StackOperations.AddOperation(new Operation("Вход в систему", null, null)); } if (login == string.Empty) { return(AuthorizationStatus.AuthLogin); } if (password == string.Empty) { return(AuthorizationStatus.AuthPassword); } return(AuthorizationStatus.AuthOK); }
/// <summary> /// Регистрация в системе /// </summary> /// <param name="login">Логин пользователя</param> /// <param name="password">Пароль пользователя</param> /// <param name="isServer">Регистрация на сервере</param> /// <param name="isDone">Закончена ли регистрация</param> /// <returns>Статус регистрации</returns> public static RegistrationStatus Registration(string login, string password, bool isServer, bool isDone) { if (isDone) { if (isServer && RegistrationFindUser(login)) { return(RegistrationStatus.RegError); } _login = login; _md5 = HashForSecurity.GetMd5Hash(login + password); RegistrationFunc(isServer); StackOperations.AddOperation(new Operation("Регистрация", null, null)); Close(false); return(RegistrationStatus.RegGood); } if (login == string.Empty) { return(RegistrationStatus.RegLogin); } if (AuthLoginInFile(login)) { return(RegistrationStatus.RegError); } if (isServer) { if (IsServer) { bool isQuery = RegistrationFindUser(login); if (isQuery) { return(RegistrationStatus.RegError); } } else { return(RegistrationStatus.RegServerErr); } } if (password == string.Empty) { return(RegistrationStatus.RegPassword); } return(RegistrationStatus.RegOK); }
private static void Main(string[] args) { Console.WriteLine("================================================================================================="); Console.WriteLine(" WELCOME"); Console.WriteLine("================================================================================================="); Console.WriteLine(); bool running = true; while (running) { Console.WriteLine(" ENTER 1 : TO INITIALIZE A QUEUE"); Console.WriteLine(" ENTER 2 : TO INITIALIZE A STACK"); Console.WriteLine(" ENTER 3 : TO INITIALIZE A LINKED-LIST"); Console.WriteLine(" ENTER 4 : TO EXIT"); Console.WriteLine(); string input = Console.ReadLine(); switch (input) { case "1": QueueOperations.Start(); break; case "2": StackOperations.Start(); break; case "3": LinkedListOperations.Start(); break; case "4": Console.WriteLine("Good bye!"); running = false; break; } } }
public QueuedStackOperation(StackOperations operation, Text codeLine = null) { Operation = operation; CodeLine = codeLine; }
public QueuedStackOperation(StackOperations operation, VehicleType type, Text codeLine = null) { Operation = operation; Type = type; CodeLine = codeLine; }