Beispiel #1
0
        private void GetContentHandleCallback(RPCContext context)
        {
            ResourcesAPIPendingState resourcesAPIPendingState = null;

            if (!this.m_pendingLookups.TryGetValue(context.Header.Token, out resourcesAPIPendingState))
            {
                base.ApiLog.LogWarning("Received unmatched lookup response");
                return;
            }
            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");
                resourcesAPIPendingState.Callback(null, resourcesAPIPendingState.UserContext);
                return;
            }
            BattleNetErrors status = (BattleNetErrors)context.Header.Status;

            if (status != BattleNetErrors.ERROR_OK)
            {
                base.ApiLog.LogWarning("Battle.net Resources API C#: Failed lookup. Error={0}", new object[]
                {
                    status
                });
                resourcesAPIPendingState.Callback(null, resourcesAPIPendingState.UserContext);
                return;
            }
            ContentHandle contentHandle2 = ContentHandle.FromProtocol(contentHandle);

            resourcesAPIPendingState.Callback(contentHandle2, resourcesAPIPendingState.UserContext);
        }
 public Error(BattleNetErrors code)
 {
     this = new Error()
     {
         EnumVal = code
     };
 }
Beispiel #3
0
 public BnetErrorInfo(BnetFeature feature, BnetFeatureEvent featureEvent, BattleNetErrors error, int context)
 {
     this.m_feature       = feature;
     this.m_featureEvent  = featureEvent;
     this.m_error         = error;
     this.m_clientContext = context;
 }
        private void HandleLogonCompleteRequest(RPCContext context)
        {
            LogonResult     logonResult = LogonResult.ParseFrom(context.Payload);
            BattleNetErrors errorCode   = (BattleNetErrors)logonResult.ErrorCode;

            if (errorCode != BattleNetErrors.ERROR_OK)
            {
                this.m_battleNet.EnqueueErrorInfo(BnetFeature.Auth, BnetFeatureEvent.Auth_OnFinish, errorCode, 0);
                return;
            }
            this.m_accountEntity = logonResult.Account;
            this.m_battleNet.Presence.PresenceSubscribe(this.m_accountEntity);
            this.m_gameAccounts = new List <bnet.protocol.EntityId>();
            foreach (bnet.protocol.EntityId gameAccountList in logonResult.GameAccountList)
            {
                this.m_gameAccounts.Add(gameAccountList);
                this.m_battleNet.Presence.PresenceSubscribe(gameAccountList);
            }
            if (logonResult.HasBattleTag)
            {
                this.m_battleTag = logonResult.BattleTag;
            }
            if (this.m_gameAccounts.Count > 0)
            {
                this.m_gameAccount = logonResult.GameAccountList[0];
            }
            this.m_sessionKey = logonResult.SessionKey;
            this.m_battleNet.IssueSelectGameAccountRequest();
            this.m_battleNet.SetConnectedRegion(logonResult.ConnectedRegion);
            base.ApiLog.LogDebug("LogonComplete {0}", new object[] { logonResult });
            base.ApiLog.LogDebug("Region (connected): {0}", new object[] { logonResult.ConnectedRegion });
        }
Beispiel #5
0
        private void UtilClientRequestCallback(RPCContext context)
        {
            BattleNetErrors status = (BattleNetErrors)context.Header.Status;

            if (status != BattleNetErrors.ERROR_OK)
            {
                this.m_battleNet.EnqueueErrorInfo(BnetFeature.Games, BnetFeatureEvent.Games_OnClientRequest, status, 0);
                return;
            }
            ClientResponse clientResponse = ClientResponse.ParseFrom(context.Payload);

            if (clientResponse.AttributeCount >= 2)
            {
                bnet.protocol.attribute.Attribute attribute  = clientResponse.AttributeList[0];
                bnet.protocol.attribute.Attribute attribute2 = clientResponse.AttributeList[1];
                if (!attribute.Value.HasIntValue || !attribute2.Value.HasBlobValue)
                {
                    base.ApiLog.LogError("Malformed Attribute in Util Packet: incorrect values");
                }
                this.m_utilPackets.Enqueue(new GamesAPI.UtilResponse(clientResponse, context.Context));
            }
            else
            {
                base.ApiLog.LogError("Malformed Attribute in Util Packet: missing values");
            }
        }
Beispiel #6
0
            public void CancelGameCallback(RPCContext context)
            {
                BattleNetCSharp battleNetCSharp = BattleNet.Get() as BattleNetCSharp;

                if (battleNetCSharp == null || battleNetCSharp.Games == null)
                {
                    return;
                }
                BattleNetErrors status = (BattleNetErrors)context.Header.Status;

                battleNetCSharp.Games.ApiLog.LogDebug("CancelGameCallback, status=" + status);
                if (status == BattleNetErrors.ERROR_OK || status == BattleNetErrors.ERROR_GAME_MASTER_INVALID_GAME)
                {
                    if (battleNetCSharp.Games.IsFindGamePending || (battleNetCSharp.Games.CurrentGameRequest != 0UL && battleNetCSharp.Games.CurrentGameRequest != this.m_gameRequestId))
                    {
                        battleNetCSharp.Games.ApiLog.LogDebug("CancelGameCallback received for id={0} but is not the current gameRequest={1}, ignoring it.", new object[]
                        {
                            this.m_gameRequestId,
                            battleNetCSharp.Games.CurrentGameRequest
                        });
                    }
                    else
                    {
                        battleNetCSharp.Games.CurrentGameRequest = 0UL;
                        battleNetCSharp.Games.AddQueueEvent(QueueEvent.Type.QUEUE_CANCEL, 0, 0, 0, null);
                    }
                }
                else
                {
                    battleNetCSharp.EnqueueErrorInfo(BnetFeature.Games, BnetFeatureEvent.Games_OnCancelGame, status, 0);
                }
            }
Beispiel #7
0
        public void MatchMakerEndHandler(Notification notification)
        {
            BattleNetErrors battleNetErrors = (BattleNetErrors)ProtocolHelper.GetUintAttribute(notification.AttributeList, "error", 0UL, null);
            ulong           uintAttribute   = ProtocolHelper.GetUintAttribute(notification.AttributeList, "game_request_id", 0UL, null);

            base.ApiLog.LogDebug("MM_END requestId={0} code={1}", new object[]
            {
                uintAttribute,
                (uint)battleNetErrors
            });
            QueueEvent.Type type;
            if (battleNetErrors == BattleNetErrors.ERROR_OK)
            {
                type = QueueEvent.Type.QUEUE_LEAVE;
            }
            else if (battleNetErrors == BattleNetErrors.ERROR_GAME_MASTER_GAME_ENTRY_CANCELLED)
            {
                type = QueueEvent.Type.QUEUE_CANCEL;
            }
            else if (battleNetErrors == BattleNetErrors.ERROR_GAME_MASTER_GAME_ENTRY_ABORTED_CLIENT_DROPPED)
            {
                type = QueueEvent.Type.ABORT_CLIENT_DROPPED;
            }
            else
            {
                type = QueueEvent.Type.QUEUE_AMM_ERROR;
            }
            base.ApiLog.LogDebug("MatchMakerEndHandler event={0} code={1}", new object[]
            {
                type,
                (uint)battleNetErrors
            });
            this.AddQueueEvent(type, 0, 0, (int)battleNetErrors, null);
        }
    public void MatchMakerEndHandler(bnet.protocol.notification.Notification notification)
    {
        BattleNetErrors errors = (BattleNetErrors)((uint)ProtocolHelper.GetUintAttribute(notification.AttributeList, "error", 0L, null));
        ulong           num    = ProtocolHelper.GetUintAttribute(notification.AttributeList, "game_request_id", 0L, null);

        object[] args = new object[] { num, (uint)errors };
        base.ApiLog.LogDebug("MM_END requestId={0} code={1}", args);
        BattleNet.QueueEvent.Type queueType = BattleNet.QueueEvent.Type.QUEUE_LEAVE;
        switch (errors)
        {
        case BattleNetErrors.ERROR_OK:
            queueType = BattleNet.QueueEvent.Type.QUEUE_LEAVE;
            break;

        case BattleNetErrors.ERROR_GAME_MASTER_GAME_ENTRY_CANCELLED:
            queueType = BattleNet.QueueEvent.Type.QUEUE_CANCEL;
            break;

        case BattleNetErrors.ERROR_GAME_MASTER_GAME_ENTRY_ABORTED_CLIENT_DROPPED:
            queueType = BattleNet.QueueEvent.Type.ABORT_CLIENT_DROPPED;
            break;

        default:
            queueType = BattleNet.QueueEvent.Type.QUEUE_AMM_ERROR;
            break;
        }
        object[] objArray2 = new object[] { queueType, (uint)errors };
        base.ApiLog.LogDebug("MatchMakerEndHandler event={0} code={1}", objArray2);
        this.AddQueueEvent(queueType, 0, 0, (int)errors, null);
    }
 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());
             }
         }
     }
 }
        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;
                }
            }
        }
    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");
            }
        }
    }
Beispiel #12
0
 public void CopyFrom(BattleNet.DllErrorInfo src)
 {
     this.m_feature       = (BnetFeature)src.feature;
     this.m_featureEvent  = (BnetFeatureEvent)src.featureEvent;
     this.m_error         = (BattleNetErrors)src.code;
     this.m_clientContext = src.context;
 }
Beispiel #13
0
 private void OnDisconnectCallback(BattleNetErrors error)
 {
     if (this.m_onDisconnectHandler != null)
     {
         this.m_onDisconnectHandler(error);
     }
 }
    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);
        }
    }
 private void OnDisconnect(BattleNetErrors error)
 {
     if (this.ShouldHandleDisconnect() && (error == BattleNetErrors.ERROR_RPC_PEER_DISCONNECTED))
     {
         Network.Get().RemoveGameServerDisconnectEventListener(new Network.GameServerDisconnectEvent(this.OnDisconnect));
         this.HandleDisconnect();
     }
 }
Beispiel #16
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 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);
                this.m_battleNet.EnqueueErrorInfo(BnetFeature.Whisper, BnetFeatureEvent.Whisper_OnSend, status, context.Context);
            }
        }
Beispiel #18
0
        private void SubscribeToAccountServiceCallback(RPCContext context)
        {
            BattleNetErrors status = (BattleNetErrors)context.Header.Status;

            if (status != BattleNetErrors.ERROR_OK)
            {
                base.ApiLog.LogError("SubscribeToAccountServiceCallback: " + status.ToString());
                return;
            }
            base.ApiLog.LogDebug("SubscribeToAccountServiceCallback, status=" + status.ToString());
        }
Beispiel #19
0
 private void AddDisconnectEvent(BattleNetErrors error)
 {
     ClientConnection <PacketType> .ConnectionEvent connectionEvent = new ClientConnection <PacketType> .ConnectionEvent()
     {
         Type = ClientConnection <PacketType> .ConnectionEventTypes.OnDisconnected
     };
     lock (error)
     {
         this.m_connectionEvents.Add(connectionEvent);
     }
 }
Beispiel #20
0
        public bool CheckRPCCallback(string name, RPCContext context)
        {
            BattleNetErrors status = (BattleNetErrors)context.Header.Status;

            BattleNetAPI.LogDelegate mLogDelegates = this.m_logDelegates[(status != BattleNetErrors.ERROR_OK ? 1 : 0)];
            object[] objArray = new object[] { status, null, null };
            objArray[1] = (!string.IsNullOrEmpty(name) ? name : "<null>");
            objArray[2] = (context.Request == null ? "<null>" : context.Request.ToString());
            mLogDelegates("Callback invoked, status = {0}, name = {1}, request = {2}", objArray);
            return(status == BattleNetErrors.ERROR_OK);
        }
Beispiel #21
0
 private void TriggerOnDisconnectHandler(BattleNetErrors error)
 {
     SslClientConnection.ConnectionEvent connectionEvent = new SslClientConnection.ConnectionEvent()
     {
         Type = SslClientConnection.ConnectionEventTypes.OnDisconnected
     };
     lock (error)
     {
         this.m_connectionEvents.Add(connectionEvent);
     }
 }
 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);
         }
     }
 }
        private void GetAccountStateCallback(RPCContext context)
        {
            if (context == null || context.Payload == null)
            {
                base.ApiLog.LogWarning("GetAccountLevelInfo invalid context!");
                return;
            }
            BattleNetErrors status = (BattleNetErrors)context.Header.Status;

            if (status != BattleNetErrors.ERROR_OK)
            {
                base.ApiLog.LogError("GetAccountLevelInfo failed with error={0}", new object[] { status.ToString() });
                return;
            }
            GetAccountStateResponse getAccountStateResponse = GetAccountStateResponse.ParseFrom(context.Payload);

            if (getAccountStateResponse == null || !getAccountStateResponse.IsInitialized)
            {
                base.ApiLog.LogWarning("GetAccountStateCallback unable to parse response!");
                return;
            }
            if (!getAccountStateResponse.HasState || !getAccountStateResponse.State.HasAccountLevelInfo)
            {
                base.ApiLog.LogWarning("GetAccountStateCallback response has no data!");
                return;
            }
            GetAccountStateRequest request = (GetAccountStateRequest)context.Request;

            if (request != null && request.EntityId == this.m_battleNet.AccountId)
            {
                AccountLevelInfo accountLevelInfo = getAccountStateResponse.State.AccountLevelInfo;
                this.m_preferredRegion = accountLevelInfo.PreferredRegion;
                this.m_accountCountry  = accountLevelInfo.Country;
                base.ApiLog.LogDebug("Region (preferred): {0}", new object[] { this.m_preferredRegion });
                base.ApiLog.LogDebug("Country (account): {0}", new object[] { this.m_accountCountry });
                if (accountLevelInfo.LicensesList.Count <= 0)
                {
                    base.ApiLog.LogWarning("No licenses found!");
                }
                else
                {
                    this.m_licenses.Clear();
                    base.ApiLog.LogDebug("Found {0} licenses.", new object[] { accountLevelInfo.LicensesList.Count });
                    for (int i = 0; i < accountLevelInfo.LicensesList.Count; i++)
                    {
                        AccountLicense item = accountLevelInfo.LicensesList[i];
                        this.m_licenses.Add(item);
                        base.ApiLog.LogDebug("Adding license id={0}", new object[] { item.Id });
                    }
                }
            }
            base.ApiLog.LogDebug(string.Concat("GetAccountLevelInfo, status=", status.ToString()));
        }
Beispiel #24
0
 private void AddConnectEvent(BattleNetErrors error, Exception exception = null)
 {
     ClientConnection <PacketType> .ConnectionEvent connectionEvent = new ClientConnection <PacketType> .ConnectionEvent()
     {
         Type  = ClientConnection <PacketType> .ConnectionEventTypes.OnConnected,
         Error = error
     };
     lock (exception)
     {
         this.m_connectionEvents.Add(connectionEvent);
     }
 }
Beispiel #25
0
 public void OnConnectHandlerCallback(BattleNetErrors error)
 {
     if (error != BattleNetErrors.ERROR_OK)
     {
         this.SwitchToState(BattleNetCSharp.ConnectionState.Error);
         this.EnqueueErrorInfo(BnetFeature.Bnet, BnetFeatureEvent.Bnet_OnConnected, error, 0);
     }
     foreach (BattleNetAPI battleNetAPI in this.m_apiList)
     {
         battleNetAPI.OnConnected(error);
     }
 }
        private void TriggerOnDisconnectHandler(BattleNetErrors error)
        {
            SslClientConnection.ConnectionEvent connectionEvent = new SslClientConnection.ConnectionEvent();
            connectionEvent.Type  = SslClientConnection.ConnectionEventTypes.OnDisconnected;
            connectionEvent.Error = error;
            object connectionEvents = this.m_connectionEvents;

            lock (connectionEvents)
            {
                this.m_connectionEvents.Add(connectionEvent);
            }
        }
Beispiel #27
0
        private void GetAllValuesForAttributeCallback(RPCContext context)
        {
            BattleNetErrors status = (BattleNetErrors)context.Header.Status;

            if (status != BattleNetErrors.ERROR_OK)
            {
                this.m_battleNet.EnqueueErrorInfo(BnetFeature.Games, BnetFeatureEvent.Games_OnGetAllValuesForAttribute, status, 0);
                return;
            }
            GetAllValuesForAttributeResponse response = ProtobufUtil.ParseFrom <GetAllValuesForAttributeResponse>(context.Payload, 0, -1);

            this.m_getAllValuesForAttributeResults.Enqueue(new GamesAPI.GetAllValuesForAttributeResult(response, context.Context));
        }
Beispiel #28
0
    private void AddDisconnectEvent(BattleNetErrors error)
    {
        ConnectionEvent <PacketType> item = new ConnectionEvent <PacketType> {
            Type  = ConnectionEventTypes <PacketType> .OnDisconnected,
            Error = error
        };
        object mutex = this.m_mutex;

        lock (mutex)
        {
            this.m_connectionEvents.Add(item);
        }
    }
Beispiel #29
0
        public void QueueExitHandler(Notification notification)
        {
            BattleNetErrors uintAttribute = (BattleNetErrors)((uint)ProtocolHelper.GetUintAttribute(notification.AttributeList, "error", (ulong)0, null));
            ulong           num           = ProtocolHelper.GetUintAttribute(notification.AttributeList, "game_request_id", (ulong)0, null);

            base.ApiLog.LogDebug("QueueExitHandler: requestId={0} code={1}", new object[] { num, (uint)uintAttribute });
            if (uintAttribute != BattleNetErrors.ERROR_OK)
            {
                QueueEvent.Type type = QueueEvent.Type.QUEUE_DELAY_ERROR;
                base.ApiLog.LogDebug("QueueExitHandler event={0} code={1}", new object[] { type, (uint)uintAttribute });
                this.AddQueueEvent(type, 0, 0, (int)uintAttribute, null);
            }
        }
    private void AddDisconnectEvent(BattleNetErrors error)
    {
        ClientConnection <PacketType> .ConnectionEvent connectionEvent = new ClientConnection <PacketType> .ConnectionEvent();

        connectionEvent.Type  = ClientConnection <PacketType> .ConnectionEventTypes.OnDisconnected;
        connectionEvent.Error = error;
        object mutex = this.m_mutex;

        lock (mutex)
        {
            this.m_connectionEvents.Add(connectionEvent);
        }
    }