private bool Contains(EncryptedUser Euser) { foreach (EncryptedUser e in userList) { if (e.EuserName == Euser.EuserName && e.EpassWord == Euser.EpassWord) { return(true); } } return(false); }
public string Find(User user) { EncryptedUser u = new EncryptedUser(user); foreach (EncryptedUser e in userList) { if (e.EuserName == u.EuserName && e.EpassWord == u.EpassWord) { return(e.DisplayName); } } return(u.UserName); }
public void UpdateFile(User userInfo) { if (File.Exists(encryptedFileName)) { EncryptedFile.DecryptLogin(fileName); File.Delete(encryptedFileName); } using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Append))) { EncryptedUser u = new EncryptedUser(userInfo); writer.Write(u.EuserName); writer.Write(u.EpassWord); writer.Write(u.DisplayName); Trace.WriteLine(u.EuserName + ", " + u.EpassWord + " and " + u.DisplayName + " are written to the file!"); } EncryptedFile.EncryptLogin(fileName); File.Delete(fileName); }
public static User GetUser(EncryptedUser e) { return(new User(e.UserName, e.PassWord, e.DisplayName)); }