public void SendFriendInvite(string sender, string target, bool byEmail)
 {
     if (this.m_state == FriendsAPIState.INITIALIZED)
     {
         SendInvitationRequest request = new SendInvitationRequest();
         EntityId val = new EntityId();
         val.SetLow(0L);
         val.SetHigh(0L);
         request.SetTargetId(val);
         InvitationParams       @params = new InvitationParams();
         FriendInvitationParams params2 = new FriendInvitationParams();
         if (byEmail)
         {
             params2.SetTargetEmail(target);
             params2.AddRole(2);
         }
         else
         {
             params2.SetTargetBattleTag(target);
             params2.AddRole(1);
         }
         @params.SetFriendParams(params2);
         request.SetParams(@params);
         SendInvitationRequest message = request;
         if (!message.IsInitialized)
         {
             base.ApiLog.LogWarning("Battle.net Friends API C#: Failed to SendFriendInvite.");
         }
         else
         {
             base.m_rpcConnection.QueueRequest(this.m_friendsService.Id, 2, message, new RPCContextDelegate(this.SendInvitationCallback), 0);
         }
     }
 }
Пример #2
0
        public void SendFriendInvite(string sender, string target, bool byEmail)
        {
            if (this.m_state != FriendsAPI.FriendsAPIState.INITIALIZED)
            {
                return;
            }
            SendInvitationRequest sendInvitationRequest = new SendInvitationRequest();

            bnet.protocol.EntityId entityId = new bnet.protocol.EntityId();
            entityId.SetLow((ulong)0);
            entityId.SetHigh((ulong)0);
            sendInvitationRequest.SetTargetId(entityId);
            InvitationParams       invitationParam       = new InvitationParams();
            FriendInvitationParams friendInvitationParam = new FriendInvitationParams();

            if (!byEmail)
            {
                friendInvitationParam.SetTargetBattleTag(target);
                friendInvitationParam.AddRole(1);
            }
            else
            {
                friendInvitationParam.SetTargetEmail(target);
                friendInvitationParam.AddRole(2);
            }
            invitationParam.SetFriendParams(friendInvitationParam);
            sendInvitationRequest.SetParams(invitationParam);
            SendInvitationRequest sendInvitationRequest1 = sendInvitationRequest;

            if (!sendInvitationRequest1.IsInitialized)
            {
                base.ApiLog.LogWarning("Battle.net Friends API C#: Failed to SendFriendInvite.");
                return;
            }
            this.m_rpcConnection.QueueRequest(this.m_friendsService.Id, 2, sendInvitationRequest1, new RPCContextDelegate(this.SendInvitationCallback), 0);
        }