public void AddToBase(string Username, string Password) { ModelPasswordHistory p = new ModelPasswordHistory(Username, Password); FileStream fs = new FileStream(path, FileMode.Append); StreamWriter sw = new StreamWriter(fs); sw.WriteLine($"{p.Username};{p.Password}"); sw.Close(); fs.Close(); }
public List <ModelPasswordHistory> ReadFromPasswordHistoryBase() { List <ModelPasswordHistory> listPasswords = new List <ModelPasswordHistory>(); FileStream fs = new FileStream(path, FileMode.Open); StreamReader sr = new StreamReader(fs); string line = ""; while ((line = sr.ReadLine()) != null) { string[] podaci = line.Split(';'); string Username = podaci[0]; string Password = podaci[1]; ModelPasswordHistory p = new ModelPasswordHistory(Username, Password); listPasswords.Add(p); } sr.Close(); fs.Close(); return(listPasswords); }