Esempio n. 1
0
 public bool QueryClient(string uac, out Client c)
 {
     return __table.TryGetValue(uac, out c);
 }
Esempio n. 2
0
 public void AddClient(Client guy)
 {
     __table.Add(guy.client.account, guy);
 }
Esempio n. 3
0
 private void OnClientLogin(ref IPAddress where, ref string[] result, out string answer)
 {
     User client; answer = VerMessage.DEFAULT_RESPONSE;
     int idx = users.Find(result[1], out client);
     // 用户不存在
     if (idx == -1)
     {
         answer = VerMessage.LOGIN_FAILED_NO_SUCH_USER;
         return;
     }
     // 检查密码
     if (!client.testPassword(result[2]))
     {
         answer = VerMessage.LOGIN_FAILED_WRONG_PW;
         return;
     }
     // 发送用户个人资料
     tcpClientUserFile = new TcpClientP();
     tcpClientUserFile.Connect(new IPEndPoint(where, Port.TCP_USER_FILE_PORT));
     string data = client.toUserFile();
     tcpClientUserFile.Write(data);
     tcpClientUserFile.Close();
     // 加入连接列表
     Client login = new Client(where, client);
     onlineUsers.AddClient(login);
     Invoke(new AddUserIntoToListView_dele(AddUserIntoView), new object[] {client.account, client.name });
     // 反馈消息
     answer = VerMessage.LOGIN_SUCCESS;
 }