public void RemoveUserLocal(string userName) { if (string.IsNullOrEmpty(userName)) { return; } var obj = SerializeAssistant.Deserialize(userBinPath); Dictionary <string, string> users = null; if (null == obj || null == (users = obj as Dictionary <string, string>)) { return; } if (users.ContainsKey(userName)) { users.Remove(userName); SerializeAssistant.Serialize(userBinPath, users); } if (AppSettings.Default.LastLogUser == userName) { AppSettings.Default.LastLogUser = string.Empty; AppSettings.Default.AutoLogin = false; } AppSettings.Default.Save(); }
public void StoreUserLocal(string userName, string psw) { var obj = SerializeAssistant.Deserialize(userBinPath); Dictionary <string, string> users = null; if (null == obj || null == (users = obj as Dictionary <string, string>)) { users = new Dictionary <string, string>(); } if (users.ContainsKey(userName)) { users[userName] = psw.Protect(); } else { users.Add(userName, psw.Protect()); } SerializeAssistant.Serialize(userBinPath, users); }