예제 #1
0
        public async Task <string> GetLiveInfo(int gameId)
        {
            using (var adminService = new AdminServiceClient(new BasicHttpBinding(), new EndpointAddress(ConnectionData.Url)))
            {
                int sequenceNumber = SequenceNumber;

                var getLiveInfoReq = new GetLiveInfoReq
                {
                    Auth = new ReqAuth
                    {
                        ClientName     = ConnectionData.Username,
                        TeamName       = ConnectionData.TeamName,
                        SessionId      = _sessionId,
                        SequenceNumber = sequenceNumber,
                        AuthCode       =
                            GetAuthCode(string.Format("{0}:{1}:{2}:{3}{4}", ConnectionData.TeamName, ConnectionData.Username,
                                                      _sessionId, sequenceNumber, ConnectionData.Password)),
                    },
                    GameId = gameId,
                };

                _stopwatch.Start();

                var getLiveInfoResp = await adminService.GetLiveInfoAsync(getLiveInfoReq);

                _stopwatch.Stop();
                LastCallTime = _stopwatch.ElapsedMilliseconds;
                _stopwatch.Reset();

                if (getLiveInfoResp.Status != "OK")
                {
                    throw new Exception(getLiveInfoResp.Message);
                }

                using (var stringStream = new StringWriter())
                {
                    var requestSerializer = new XmlSerializer(typeof(GetLiveInfoResp));
                    requestSerializer.Serialize(stringStream, getLiveInfoResp);
                    return(stringStream.ToString());
                }
            }
        }
        private void GetLiveInfoImpl(GetLiveInfoReq req, GetLiveInfoResp resp)
        {
            GameLiveInfo gi = Server.GameManager.GetLiveInfo(req.GameId, Server.TeamRegistry.GetTeam(req.Auth.TeamName));

            resp.GameLiveInfo = new EnGameLiveInfo(gi);
        }
 public GetLiveInfoResp GetLiveInfo(GetLiveInfoReq req)
 {
     return(HandleServiceCall(req, new GetLiveInfoResp(), GetLiveInfoImpl));
 }