Ejemplo n.º 1
0
 private bool Contains(EncryptedUser Euser)
 {
     foreach (EncryptedUser e in userList)
     {
         if (e.EuserName == Euser.EuserName && e.EpassWord == Euser.EpassWord)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public static User GetUser(EncryptedUser e)
 {
     return(new User(e.UserName, e.PassWord, e.DisplayName));
 }