예제 #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);
 }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
 public static User GetUser(EncryptedUser e)
 {
     return(new User(e.UserName, e.PassWord, e.DisplayName));
 }