public Form6(profile user, bool isFirstAuth) { userF6 = user; isFirstAuthF6 = isFirstAuth; InitializeComponent(); }
public ChgPswdForm(profile user, bool isFirstAuth) { ind = -1; foreach (profile userBuf in dataBase.dBase) { ind++; if (userBuf.name == user.name) { userF3 = userBuf; break; } } isFirstAuthF3 = isFirstAuth; pswChanged = false; InitializeComponent(); }
public ActSelForm(profile user, bool isFirstAuth) { userF2 = user; isFirstAuthF2 = isFirstAuth; InitializeComponent(); }
public ActSelForm(string name) { try { using (StreamReader sr = new StreamReader(@"data.txt")) { string line; string[] lineSplitted = new string[3]; profile user; while (!sr.EndOfStream) { line = sr.ReadLine(); lineSplitted = line.Split('\t'); user.name = lineSplitted[0]; user.password = lineSplitted[1]; user.hashIter = Convert.ToInt32(lineSplitted[2]); dataBase.dBase.Add(user); } } } catch (FileNotFoundException e1) { using (StreamWriter sw = new StreamWriter(@"log.txt")) { sw.WriteLine(DateTime.Now + " " + "Создание учетной записи администратора.."); } profile user; user.name = "Admin"; user.password = ""; user.hashIter = 0; dataBase.dBase.Add(user); } userExists = false; foreach (profile user in dataBase.dBase) { if (user.name == name) { userF2 = user; userExists = true; if (userF2.password == "") { using (StreamWriter sw = new StreamWriter(@"log.txt", true)) { sw.WriteLine(DateTime.Now + " " + "Первый вход пользователя:" + " " + userF2.name); } isFirstAuthF2 = true; } else { using (StreamWriter sw = new StreamWriter(@"log.txt", true)) { sw.WriteLine(DateTime.Now + " " + "Авторизация пользователя:" + " " + userF2.name); } isFirstAuthF2 = false; } break; } } defaultIterNum = 500; InitializeComponent(); }