public static void getUsers() { userList = new List <userPopulation>(); configure config = new configure(); userHelper help = new userHelper(); if (!help.findFile(config.folder + "\\login.txt")) { return; } userList = new List <userPopulation>(); using (StreamReader sr = new StreamReader(config.folder + "\\login.txt")) { string[] sentence = sr.ReadToEnd().Replace("\n", "|\r\n").Split('|'); for (int i = 0; i < sentence.Length - 1; i++) { string[] user = sentence[i].Split(','); userList.Add(new userPopulation { userName = user[0], password = user[1], userType = user[2], firstName = user[3], lastName = user[4], dateofBirth = user[5] } ); } } }
private void Form1_Load(object sender, EventArgs e) { if (!(help.findFile(config.folder + "\\login.txt"))) { MessageBox.Show("No Database found", "security", MessageBoxButtons.OK, MessageBoxIcon.Error); this.loginbutton.Enabled = false; } }
private void register_Load(object sender, EventArgs e) { if (!(user.findFile(config.folder + "\\login.txt"))) { if (!(user.createFile(config.folder + "\\login.txt"))) { MessageBox.Show("Can't Create your Text File.", "Dernied", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop); this.Close(); } } }