Ejemplo n.º 1
0
 /// <summary>
 /// �����½�ɹ��ķ��������û�
 /// </summary>
 /// <param name="h"></param>
 /// <param name="p"></param>
 /// <param name="utp"></param>
 /// <param name="u"></param>
 public static void AddLogin(String h, int p, int utp, String u)
 {
     bool hasin = false;
     foreach(HostConfig hc in hostList)
         if(hc.Host == h && hc.Port == p)
         {
             hasin = true;
             hostList.Remove(hc);
             hostList.Insert(0, hc);
             break;
         }
     if(!hasin)
     {
         HostConfig hc = new HostConfig(h, p);
         hostList.Insert(0, hc);
         while(hostList.Count > 10)
             hostList.RemoveAt(hostList.Count - 1);
     }
     hasin = false;
     foreach(UserConfig ur in userList)
         if(ur.Name == u && ur.Type == utp)
         {
             hasin = true;
             userList.Remove(ur);
             userList.Insert(0, ur);
             break;
         }
     if(!hasin)
     {
         UserConfig ur = new UserConfig(u, utp);
         userList.Insert(0, ur);
         while(userList.Count > 10)
             userList.RemoveAt(userList.Count - 1);
     }
     saveToFile();
 }