public void CancelGameCallback(RPCContext context)
        {
            BattleNetCSharp sharp = BattleNet.Get() as BattleNetCSharp;

            if ((sharp != null) && (sharp.Games != null))
            {
                BattleNetErrors status = (BattleNetErrors)context.Header.Status;
                sharp.Games.ApiLog.LogDebug("CancelGameCallback, status=" + status);
                switch (status)
                {
                case BattleNetErrors.ERROR_OK:
                case BattleNetErrors.ERROR_GAME_MASTER_INVALID_GAME:
                    if (sharp.Games.IsFindGamePending || ((sharp.Games.CurrentGameRequest != 0) && (sharp.Games.CurrentGameRequest != this.m_gameRequestId)))
                    {
                        object[] args = new object[] { this.m_gameRequestId, sharp.Games.CurrentGameRequest };
                        sharp.Games.ApiLog.LogDebug("CancelGameCallback received for id={0} but is not the current gameRequest={1}, ignoring it.", args);
                    }
                    else
                    {
                        sharp.Games.CurrentGameRequest = 0L;
                        sharp.Games.AddQueueEvent(BattleNet.QueueEvent.Type.QUEUE_CANCEL, 0, 0, 0, null);
                    }
                    break;

                default:
                    sharp.EnqueueErrorInfo(BnetFeature.Games, BnetFeatureEvent.Games_OnCancelGame, status, context.Context);
                    break;
                }
            }
        }
示例#2
0
 public void PresenceUnsubscribeCallback(RPCContext context)
 {
     if (this.m_battleNet.Presence.CheckRPCCallback("PresenceUnsubscribeCallback", context))
     {
         this.m_battleNet.Channel.RemoveActiveChannel(this.m_objectId);
     }
 }
    public void SendUtilPacket(int packetId, int systemId, byte[] bytes, int size, int subID, int context, ulong route)
    {
        ClientRequest message = this.CreateClientRequest(packetId, systemId, bytes, route);

        if (base.m_rpcConnection == null)
        {
            base.ApiLog.LogError("SendUtilPacket could not send, connection not valid : " + message.ToString());
        }
        else
        {
            if (!warnComplete)
            {
                base.ApiLog.LogWarning("SendUtilPacket: need to map context to RPCContext");
                warnComplete = true;
            }
            RPCContext context2 = base.m_rpcConnection.QueueRequest(this.m_gameUtilitiesService.Id, 1, message, new RPCContextDelegate(this.ClientRequestCallback), 0);
            context2.SystemId = systemId;
            context2.Context  = context;
            if (context == 0)
            {
                object[] args = new object[] { packetId, systemId };
                Debug.LogFormat("PacketId: {0} systemId={1}", args);
            }
        }
    }
示例#4
0
    private void OnExternalChallengeCallback(RPCContext context)
    {
        ChallengeExternalRequest request = ChallengeExternalRequest.ParseFrom(context.Payload);

        if (!request.IsInitialized || !request.HasPayload)
        {
            object[] args = new object[] { request.IsInitialized, request.HasRequestToken, request.HasPayload, request.HasPayloadType };
            base.ApiLog.LogWarning("Bad ChallengeExternalRequest received IsInitialized={0} HasRequestToken={1} HasPayload={2} HasPayloadType={3}", args);
        }
        else if (request.PayloadType != "web_auth_url")
        {
            object[] objArray2 = new object[] { request.PayloadType };
            base.ApiLog.LogWarning("Received a PayloadType we don't know how to handle PayloadType={0}", objArray2);
        }
        else
        {
            ExternalChallenge challenge = new ExternalChallenge {
                PayLoadType = request.PayloadType,
                URL         = Encoding.ASCII.GetString(request.Payload)
            };
            object[] objArray3 = new object[] { challenge.PayLoadType, challenge.URL };
            base.ApiLog.LogDebug("Received external challenge PayLoadType={0} URL={1}", objArray3);
            if (this.m_nextExternalChallenge == null)
            {
                this.m_nextExternalChallenge = challenge;
            }
            else
            {
                this.m_nextExternalChallenge.Next = challenge;
            }
        }
    }
    private void ClientRequestCallback(RPCContext context)
    {
        BattleNetErrors status = (BattleNetErrors)context.Header.Status;

        if (status != BattleNetErrors.ERROR_OK)
        {
            base.m_battleNet.EnqueueErrorInfo(BnetFeature.Games, BnetFeatureEvent.Games_OnClientRequest, status, context.Context);
        }
        else
        {
            ClientResponse response = ClientResponse.ParseFrom(context.Payload);
            if (response.AttributeCount >= 2)
            {
                bnet.protocol.attribute.Attribute attribute  = response.AttributeList[0];
                bnet.protocol.attribute.Attribute attribute2 = response.AttributeList[1];
                if (!attribute.Value.HasIntValue || !attribute2.Value.HasBlobValue)
                {
                    base.ApiLog.LogError("Malformed Attribute in Util Packet: incorrect values");
                }
                int           intValue  = (int)attribute.Value.IntValue;
                byte[]        blobValue = attribute2.Value.BlobValue;
                PegasusPacket item      = new PegasusPacket(intValue, blobValue.Length, blobValue)
                {
                    Context = context.Context
                };
                this.m_utilPackets.Enqueue(item);
            }
            else
            {
                base.ApiLog.LogError("Malformed Attribute in Util Packet: missing values");
            }
        }
    }
    private void HandleLogonCompleteRequest(RPCContext context)
    {
        LogonResult     result    = LogonResult.ParseFrom(context.Payload);
        BattleNetErrors errorCode = (BattleNetErrors)result.ErrorCode;

        if (errorCode != BattleNetErrors.ERROR_OK)
        {
            base.m_battleNet.EnqueueErrorInfo(BnetFeature.Auth, BnetFeatureEvent.Auth_OnFinish, errorCode, context.Context);
        }
        else
        {
            this.m_accountEntity = result.Account;
            base.m_battleNet.Presence.PresenceSubscribe(this.m_accountEntity);
            this.m_gameAccounts = new List <EntityId>();
            foreach (EntityId id in result.GameAccountList)
            {
                this.m_gameAccounts.Add(id);
                base.m_battleNet.Presence.PresenceSubscribe(id);
            }
            if (this.m_gameAccounts.Count > 0)
            {
                this.m_gameAccount = result.GameAccountList[0];
            }
            base.m_battleNet.IssueSelectGameAccountRequest();
            base.m_battleNet.SetConnectedRegion(result.ConnectedRegion);
            object[] args = new object[] { result };
            base.ApiLog.LogDebug("LogonComplete {0}", args);
            object[] objArray2 = new object[] { result.ConnectedRegion };
            base.ApiLog.LogDebug("Region (connected): {0}", objArray2);
            BIReport.Get().Report_Telemetry(Telemetry.Level.LEVEL_INFO, BIReport.TelemetryEvent.EVENT_LOGIN_SUCCESS);
        }
    }
 public void NotifyMethodListener(RPCContext context)
 {
     if (((this.Methods != null) && (context.Header.MethodId > 0)) && (context.Header.MethodId <= this.Methods.Length))
     {
         this.Methods[context.Header.MethodId].NotifyListener(context);
     }
 }
示例#8
0
 public void NotifyListener(RPCContext context)
 {
     if (this.listener != null)
     {
         this.listener(context);
     }
 }
 private void GetAccountStateCallback(RPCContext context)
 {
     if ((context == null) || (context.Payload == null))
     {
         base.ApiLog.LogWarning("GetAccountLevelInfo invalid context!");
     }
     else
     {
         BattleNetErrors status = (BattleNetErrors)context.Header.Status;
         if (status != BattleNetErrors.ERROR_OK)
         {
             object[] args = new object[] { status.ToString() };
             base.ApiLog.LogError("GetAccountLevelInfo failed with error={0}", args);
         }
         else
         {
             GetAccountStateResponse response = GetAccountStateResponse.ParseFrom(context.Payload);
             if ((response == null) || !response.IsInitialized)
             {
                 base.ApiLog.LogWarning("GetAccountStateCallback unable to parse response!");
             }
             else if (!response.HasState || !response.State.HasAccountLevelInfo)
             {
                 base.ApiLog.LogWarning("GetAccountStateCallback response has no data!");
             }
             else
             {
                 GetAccountStateRequest request = (GetAccountStateRequest)context.Request;
                 if ((request != null) && (request.EntityId == base.m_battleNet.AccountId))
                 {
                     AccountLevelInfo accountLevelInfo = response.State.AccountLevelInfo;
                     this.m_preferredRegion = accountLevelInfo.PreferredRegion;
                     this.m_accountCountry  = accountLevelInfo.Country;
                     object[] objArray2 = new object[] { this.m_preferredRegion };
                     base.ApiLog.LogDebug("Region (preferred): {0}", objArray2);
                     object[] objArray3 = new object[] { this.m_accountCountry };
                     base.ApiLog.LogDebug("Country (account): {0}", objArray3);
                     if (accountLevelInfo.LicensesList.Count > 0)
                     {
                         this.m_licenses.Clear();
                         object[] objArray4 = new object[] { accountLevelInfo.LicensesList.Count };
                         base.ApiLog.LogDebug("Found {0} licenses.", objArray4);
                         for (int i = 0; i < accountLevelInfo.LicensesList.Count; i++)
                         {
                             AccountLicense item = accountLevelInfo.LicensesList[i];
                             this.m_licenses.Add(item);
                             object[] objArray5 = new object[] { item.Id };
                             base.ApiLog.LogDebug("Adding license id={0}", objArray5);
                         }
                     }
                     else
                     {
                         base.ApiLog.LogWarning("No licenses found!");
                     }
                 }
                 base.ApiLog.LogDebug("GetAccountLevelInfo, status=" + status.ToString());
             }
         }
     }
 }
示例#10
0
    private void GetContentHandleCallback(RPCContext context)
    {
        ResourcesAPIPendingState state = null;

        if (!this.m_pendingLookups.TryGetValue(context.Header.Token, out state))
        {
            base.ApiLog.LogWarning("Received unmatched lookup response");
        }
        else
        {
            this.m_pendingLookups.Remove(context.Header.Token);
            bnet.protocol.ContentHandle contentHandle = bnet.protocol.ContentHandle.ParseFrom(context.Payload);
            if ((contentHandle == null) || !contentHandle.IsInitialized)
            {
                base.ApiLog.LogWarning("Received invalid response");
                state.Callback(null, state.UserContext);
            }
            else
            {
                BattleNetErrors status = (BattleNetErrors)context.Header.Status;
                if (status != BattleNetErrors.ERROR_OK)
                {
                    object[] args = new object[] { status };
                    base.ApiLog.LogWarning("Battle.net Resources API C#: Failed lookup. Error={0}", args);
                    state.Callback(null, state.UserContext);
                }
                else
                {
                    ContentHandle handle2 = ContentHandle.FromProtocol(contentHandle);
                    state.Callback(handle2, state.UserContext);
                }
            }
        }
    }
 private void NotifyReceivedInvitationRemovedCallback(RPCContext context)
 {
     if (this.m_state == FriendsAPIState.INITIALIZED)
     {
         Invitation invitation = this.ExtractInvitationFromInvitationNotification(context.Payload);
         this.AddInvitationInternal(BattleNet.FriendsUpdate.Action.FRIEND_INVITE_REMOVED, invitation, 0);
     }
 }
 private void NotifyFriendRemovedListenerCallback(RPCContext context)
 {
     if (this.m_state == FriendsAPIState.INITIALIZED)
     {
         BnetEntityId entityId = this.ExtractEntityIdFromFriendNotification(context.Payload);
         this.RemoveFriendInternal(entityId);
     }
 }
示例#13
0
    public bool CheckRPCCallback(string name, RPCContext context)
    {
        BattleNetErrors status = (BattleNetErrors)context.Header.Status;
        int             index  = (status != BattleNetErrors.ERROR_OK) ? 1 : 0;

        object[] args = new object[] { status, !string.IsNullOrEmpty(name) ? name : "<null>", (context.Request == null) ? "<null>" : context.Request.ToString() };
        this.m_logDelegates[index]("Callback invoked, status = {0}, name = {1}, request = {2}", args);
        return(status == BattleNetErrors.ERROR_OK);
    }
    private void HandleLogonQueueUpdate(RPCContext context)
    {
        LogonQueueUpdateRequest request = LogonQueueUpdateRequest.ParseFrom(context.Payload);

        base.ApiLog.LogDebug("HandleLogonQueueUpdate : " + request.ToString());
        long end = (long)((request.EstimatedTime - ((ulong)base.m_battleNet.ServerTimeUTCAtConnectMicroseconds)) / ((ulong)0xf4240L));

        this.SaveQueuePosition((int)request.Position, end, (long)request.EtaDeviationInSec, false);
    }
    private void WhisperSentCallback(RPCContext context)
    {
        BattleNetErrors status = (BattleNetErrors)context.Header.Status;

        if (status != BattleNetErrors.ERROR_OK)
        {
            base.ApiLog.LogWarning("Battle.net Whisper API C#: Failed to SendWhisper. " + status);
            base.m_battleNet.EnqueueErrorInfo(BnetFeature.Whisper, BnetFeatureEvent.Whisper_OnSend, status, context.Context);
        }
    }
 private void AcceptInvitationCallback(RPCContext context)
 {
     if (this.m_state == FriendsAPIState.INITIALIZED)
     {
         BattleNetErrors status = (BattleNetErrors)context.Header.Status;
         if (status != BattleNetErrors.ERROR_OK)
         {
             base.ApiLog.LogWarning("Battle.net Friends API C#: Failed to AcceptInvitation. " + status);
             base.m_battleNet.EnqueueErrorInfo(BnetFeature.Friends, BnetFeatureEvent.Friends_OnAcceptInvitation, status, context.Context);
         }
     }
 }
示例#17
0
    public void AnswerChallenge(ulong challengeID, string answer)
    {
        ChallengeAnsweredRequest message = new ChallengeAnsweredRequest();

        message.SetAnswer("pass");
        byte[] val = new byte[] { 2, 3, 4, 5, 6, 7, 0, 0 };
        message.SetData(val);
        if (message.IsInitialized)
        {
            RPCContext context = base.m_rpcConnection.QueueRequest(this.ChallengeService.Id, 2, message, new RPCContextDelegate(this.ChallengeAnsweredCallback), 0);
            this.s_pendingAnswers.Add(context.Header.Token, challengeID);
        }
    }
    private void SubscribeToAccountServiceCallback(RPCContext context)
    {
        BattleNetErrors status = (BattleNetErrors)context.Header.Status;

        if (status != BattleNetErrors.ERROR_OK)
        {
            base.ApiLog.LogError("SubscribeToAccountServiceCallback: " + status.ToString());
        }
        else
        {
            base.ApiLog.LogDebug("SubscribeToAccountServiceCallback, status=" + status.ToString());
        }
    }
        public void JoinChannelCallback(RPCContext context)
        {
            BattleNetErrors status = (BattleNetErrors)context.Header.Status;

            if (status != BattleNetErrors.ERROR_OK)
            {
                this.m_channelAPI.ApiLog.LogError("JoinChannelCallback: " + status.ToString());
            }
            else
            {
                JoinChannelResponse response = JoinChannelResponse.ParseFrom(context.Payload);
                base.SetObjectId(response.ObjectId);
                this.m_channelAPI.AddActiveChannel(base.m_subscriberObjectId, new ChannelAPI.ChannelReferenceObject(this));
                this.m_channelAPI.ApiLog.LogDebug("JoinChannelCallback, status=" + status.ToString());
            }
        }
 private void SubscribeToFriendsCallback(RPCContext context)
 {
     if (this.m_state == FriendsAPIState.INITIALIZING)
     {
         if (context.Header.Status == 0)
         {
             this.m_state = FriendsAPIState.INITIALIZED;
             base.ApiLog.LogDebug("Battle.net Friends API C#: Initialized.");
             SubscribeToFriendsResponse response = SubscribeToFriendsResponse.ParseFrom(context.Payload);
             this.ProcessSubscribeToFriendsResponse(response);
         }
         else
         {
             this.m_state = FriendsAPIState.FAILED_TO_INITIALIZE;
             base.ApiLog.LogWarning("Battle.net Friends API C#: Failed to initialize.");
         }
     }
 }
    private void FindGameCallback(RPCContext context)
    {
        this.IsFindGamePending = false;
        BattleNetErrors status = (BattleNetErrors)context.Header.Status;

        base.ApiLog.LogDebug("Find Game Callback, status=" + status);
        if (status != BattleNetErrors.ERROR_OK)
        {
            base.m_battleNet.EnqueueErrorInfo(BnetFeature.Games, BnetFeatureEvent.Games_OnFindGame, status, context.Context);
        }
        else
        {
            FindGameResponse response = FindGameResponse.ParseFrom(context.Payload);
            if (response.HasRequestId)
            {
                this.s_gameRequest = response.RequestId;
            }
        }
    }
        public void AcceptInvitationCallback(RPCContext context, RPCContextDelegate callback)
        {
            BattleNetErrors status = (BattleNetErrors)context.Header.Status;

            if (status != BattleNetErrors.ERROR_OK)
            {
                this.m_channelAPI.ApiLog.LogError("AcceptInvitationCallback: " + status.ToString());
            }
            else
            {
                AcceptInvitationResponse response = AcceptInvitationResponse.ParseFrom(context.Payload);
                base.SetObjectId(response.ObjectId);
                this.m_channelAPI.AddActiveChannel(base.m_subscriberObjectId, new ChannelAPI.ChannelReferenceObject(this));
                this.m_channelAPI.ApiLog.LogDebug("AcceptInvitationCallback, status=" + status.ToString());
                if (callback != null)
                {
                    callback(context);
                }
            }
        }
 public void GetGameSessionInfoRequestContextCallback(RPCContext context)
 {
     this.m_parent.GameSessionRunningCount--;
     if ((context == null) || (context.Payload == null))
     {
         this.m_parent.ApiLog.LogWarning("GetPlayRestrictions invalid context!");
     }
     else
     {
         BattleNetErrors status = (BattleNetErrors)context.Header.Status;
         if (status != BattleNetErrors.ERROR_OK)
         {
             object[] args = new object[] { status.ToString() };
             this.m_parent.ApiLog.LogError("GetPlayRestrictions failed with error={0}", args);
         }
         else
         {
             GetGameSessionInfoResponse response = GetGameSessionInfoResponse.ParseFrom(context.Payload);
             if ((response == null) || !response.IsInitialized)
             {
                 this.m_parent.ApiLog.LogWarning("GetPlayRestrictions unable to parse response!");
             }
             else if (!response.HasSessionInfo)
             {
                 this.m_parent.ApiLog.LogWarning("GetPlayRestrictions response has no data!");
             }
             else
             {
                 this.m_parent.LastGameSessionInfo = new AccountAPI.GameSessionInfo();
                 if (response.SessionInfo.HasStartTime)
                 {
                     this.m_parent.LastGameSessionInfo.SessionStartTime = response.SessionInfo.StartTime;
                 }
                 else
                 {
                     this.m_parent.ApiLog.LogWarning("GetPlayRestrictions response has no HasStartTime!");
                 }
             }
         }
     }
 }
示例#24
0
    private void ChallengeAnsweredCallback(RPCContext context)
    {
        ChallengeAnsweredResponse response = ChallengeAnsweredResponse.ParseFrom(context.Payload);

        if (response.IsInitialized)
        {
            ulong num = 0L;
            if (this.s_pendingAnswers.TryGetValue(context.Header.Token, out num))
            {
                if (response.HasDoRetry && response.DoRetry)
                {
                    BattleNet.DllChallengeInfo item = new BattleNet.DllChallengeInfo {
                        challengeId = num,
                        isRetry     = true
                    };
                    this.m_challengeUpdateList.Add(item);
                }
                this.s_pendingAnswers.Remove(context.Header.Token);
            }
        }
    }
示例#25
0
 public void QueueResponse(RPCContext context, IProtoBuf message)
 {
     if ((message == null) || (context.Header == null))
     {
         this.m_logSource.LogError("QueueResponse: invalid response");
     }
     else if (this.serviceHelper.GetImportedServiceById(context.Header.ServiceId) == null)
     {
         this.m_logSource.LogError("QueueResponse: error, unrecognized service id: " + context.Header.ServiceId);
     }
     else
     {
         this.m_logSource.LogDebug(string.Concat(new object[] { "QueueResponse: type=", this.serviceHelper.GetImportedServiceById(context.Header.ServiceId).GetMethodName(context.Header.MethodId), " data=", message }));
         bnet.protocol.Header header = context.Header;
         header.SetServiceId(0xfe);
         header.SetMethodId(0);
         header.SetSize(message.GetSerializedSize());
         context.Header = header;
         BattleNetPacket packet = new BattleNetPacket(context.Header, message);
         this.QueuePacket(packet);
     }
 }
示例#26
0
 private void ChallengedPickedCallback(RPCContext context)
 {
     BattleNet.DllChallengeInfo info;
     if (!this.m_challengePendingList.TryGetValue(context.Header.Token, out info))
     {
         base.ApiLog.LogWarning("Battle.net Challenge API C#: Received unexpected ChallengedPicked.");
     }
     else
     {
         BattleNetErrors status = (BattleNetErrors)context.Header.Status;
         if (status != BattleNetErrors.ERROR_OK)
         {
             this.m_challengePendingList.Remove(context.Header.Token);
             base.ApiLog.LogWarning("Battle.net Challenge API C#: Failed ChallengedPicked. " + status);
         }
         else
         {
             this.m_challengeUpdateList.Add(info);
             this.m_challengePendingList.Remove(context.Header.Token);
         }
     }
 }
 private void HandleAccountNotify_AccountStateUpdated(RPCContext context)
 {
     if ((context == null) || (context.Payload == null))
     {
         base.ApiLog.LogWarning("HandleAccountNotify_AccountStateUpdated invalid context!");
     }
     else
     {
         AccountStateNotification notification = AccountStateNotification.ParseFrom(context.Payload);
         if ((notification == null) || !notification.IsInitialized)
         {
             base.ApiLog.LogWarning("HandleAccountNotify_AccountStateUpdated unable to parse response!");
         }
         else if (!notification.HasState)
         {
             object[] args = new object[] { notification };
             base.ApiLog.LogDebug("HandleAccountNotify_AccountStateUpdated HasState=false, data={0}", args);
         }
         else
         {
             AccountState state = notification.State;
             if (!state.HasAccountLevelInfo)
             {
                 object[] objArray2 = new object[] { notification };
                 base.ApiLog.LogDebug("HandleAccountNotify_AccountStateUpdated HasAccountLevelInfo=false, data={0}", objArray2);
             }
             else if (!state.AccountLevelInfo.HasPreferredRegion)
             {
                 object[] objArray3 = new object[] { notification };
                 base.ApiLog.LogDebug("HandleAccountNotify_AccountStateUpdated HasPreferredRegion=false, data={0}", objArray3);
             }
             else
             {
                 object[] objArray4 = new object[] { notification };
                 base.ApiLog.LogDebug("HandleAccountNotify_AccountStateUpdated, data={0}", objArray4);
             }
         }
     }
 }
示例#28
0
    public void LookupResource(FourCC programId, FourCC streamId, FourCC locale, ResourceLookupCallback cb, object userContext)
    {
        ContentHandleRequest message = new ContentHandleRequest();

        message.SetProgramId(programId.GetValue());
        message.SetStreamId(streamId.GetValue());
        message.SetLocale(locale.GetValue());
        if ((message == null) || !message.IsInitialized)
        {
            base.ApiLog.LogWarning("Unable to create request for RPC call.");
        }
        else
        {
            RPCContext context             = base.m_rpcConnection.QueueRequest(this.m_resourcesService.Id, 1, message, new RPCContextDelegate(this.GetContentHandleCallback), 0);
            ResourcesAPIPendingState state = new ResourcesAPIPendingState {
                Callback    = cb,
                UserContext = userContext
            };
            this.m_pendingLookups.Add(context.Header.Token, state);
            object[] args = new object[] { programId, streamId, locale };
            base.ApiLog.LogDebug("Lookup request sent. PID={0} StreamID={1} Locale={2}", args);
        }
    }
示例#29
0
    public RPCContext QueueRequest(uint serviceId, uint methodId, IProtoBuf message, RPCContextDelegate callback = null, uint objectId = 0)
    {
        uint nextToken;

        if (message == null)
        {
            return(null);
        }
        object tokenLock = this.tokenLock;

        lock (tokenLock)
        {
            nextToken = RPCConnection.nextToken;
            RPCConnection.nextToken++;
        }
        RPCContext context = new RPCContext();

        if (callback != null)
        {
            context.Callback = callback;
            this.waitingForResponse.Add(nextToken, context);
        }
        bnet.protocol.Header h    = this.CreateHeader(serviceId, methodId, objectId, nextToken, message.GetSerializedSize());
        BattleNetPacket      item = new BattleNetPacket(h, message);

        context.Header  = h;
        context.Request = message;
        if (!this.m_connMetering.AllowRPCCall(serviceId, methodId))
        {
            this.m_pendingOutboundPackets.Add(item);
            this.LogOutgoingPacket(item, true);
            return(context);
        }
        this.QueuePacket(item);
        return(context);
    }
示例#30
0
    private void ChallengeUserCallback(RPCContext context)
    {
        ChallengeUserRequest request = ChallengeUserRequest.ParseFrom(context.Payload);

        if (request.IsInitialized)
        {
            ulong id   = request.Id;
            bool  flag = false;
            for (int i = 0; i < request.ChallengesCount; i++)
            {
                Challenge challenge = request.Challenges[i];
                if (challenge.Type == 0x505744)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                this.AbortChallenge(id);
            }
            else
            {
                ChallengePickedRequest message = new ChallengePickedRequest();
                message.SetChallenge(0x505744);
                message.SetId((uint)id);
                message.SetNewChallengeProtocol(true);
                RPCContext context2             = base.m_rpcConnection.QueueRequest(this.ChallengeService.Id, 1, message, new RPCContextDelegate(this.ChallengedPickedCallback), 0);
                BattleNet.DllChallengeInfo info = new BattleNet.DllChallengeInfo {
                    challengeId = id,
                    isRetry     = false
                };
                this.m_challengePendingList.Add(context2.Header.Token, info);
            }
        }
    }