Example #1
0
 public static void DelUserInfo(string userName)
 {
     List<UserInfo> list = GetUsers();
     UserInfo[] _list = new UserInfo[list.Count];
     list.CopyTo(_list);
     for (int i = 0; i < _list.Length; i++)
     {
         if (_list[i].UserName == userName)
         {
             list.Remove(_list[i]);
         }
     }
     Save(list);
 }
Example #2
0
 public static void SaveUserInfo(string userName, string pwd,string from="",string to="")
 {
     List<UserInfo> list = GetUsers();
     UserInfo user = list.Find(l => l.UserName == userName);
     if (user != null)
     {
         user.Pwd = pwd;
         if (from != "" && to != "")
         {
             user.LastQueryFromStation = from;
             user.LastQueryToStation = to;
         }
     }
     else
     {
         user = new UserInfo() { UserName = userName, Pwd = pwd, LastQueryFromStation=from, LastQueryToStation=to };
         list.Add(user);
     }
     StaticValues.MyUser = user;
     Save(list);
 }