private void CreateUserLocal(string Username) { string userlibpath = OriPath + "Users\\" + Username + "\\library\\"; string userbakpath = OriPath + "Users\\" + Username + "\\bak\\"; string curuserpath = OriPath + "Users\\" + Username + "\\psw"; if (Directory.Exists(userlibpath)) { MessageBox.Show("用户已存在"); //return 3; } else { System.IO.Directory.CreateDirectory(userlibpath); System.IO.Directory.CreateDirectory(userbakpath); } PassWordDic newuser = new PassWordDic(); newuser.Username = Username; newuser.password = aes_logic.EncryptWithMD5(textBox9.Text); newuser.otherinfo = "这里先测试一下"; newuser.numberofpassword = 0; newuser.MYpasswordList = new List <PassWordStruct>(); SaveObj(newuser, curuserpath); MessageBox.Show("新建成功"); }
private bool LoadUserLoacal(string Username, string psw) { string curuserpath = OriPath + "Users\\" + Username + "\\psw"; if (File.Exists(curuserpath)) { PassWordDic newuser = (PassWordDic)LoadObj(curuserpath); string curpsw = aes_logic.EncryptWithMD5(psw); if (curpsw == newuser.password) { return(true); } else { MessageBox.Show("密码错误"); return(false); } } else { MessageBox.Show("用户不存在"); return(false); } }