internal static GsAuthResponse RegisterServer(byte gameId, byte[] ips, string password, GameConnection client) { string text = client.IP.Split(':')[0]; if (!gameservers.ContainsKey(gameId)) { log.WarnFormat("未注册的游戏服务器ID:{0} IP:{1}", (object)gameId, (object)text); return(GsAuthResponse.NOT_AUTHED); } GameInfo gameInfo = gameservers[gameId]; if (!Information.IsNothing(gameInfo.GameConnection)) { log.WarnFormat("游戏服务器ID:{0} IP:{1} 试图重复注册.", (object)gameId, (object)text); return(GsAuthResponse.ALREADY_REGISTERED); } if (!gameInfo.GameIp.Equals(text)) { log.WarnFormat("游戏服务器ID:{0} 授权通信地址与 IP:{1} 不匹配.", (object)gameId, (object)text); return(GsAuthResponse.NOT_AUTHED); } if (!password.Equals(gameInfo.Password)) { log.WarnFormat("游戏服务器ID:{0} IP:{1} 通信密码错误.", (object)gameId, (object)text); return(GsAuthResponse.NOT_AUTHED); } gameInfo.GameConnection = client; gameInfo.GameConnection.GameServerId = gameId; gameInfo.GameConnection.Chat = new ChatService(); log.InfoFormat("#{0} 号游戏服务器认证成功.", (object)gameId); return(GsAuthResponse.AUTHED); }
protected abstract void writeImpl(GameConnection con);