private void AddInvitationInternal(BattleNet.FriendsUpdate.Action action, Invitation invitation, int reason)
 {
     if (invitation != null)
     {
         BattleNet.FriendsUpdate item = new BattleNet.FriendsUpdate {
             action  = (int)action,
             long1   = invitation.Id,
             entity1 = this.GetBnetEntityIdFromIdentity(invitation.InviterIdentity)
         };
         if (invitation.HasInviterName)
         {
             item.string1 = invitation.InviterName;
         }
         item.entity2 = this.GetBnetEntityIdFromIdentity(invitation.InviteeIdentity);
         if (invitation.HasInviteeName)
         {
             item.string2 = invitation.InviteeName;
         }
         if (invitation.HasInvitationMessage)
         {
             item.string3 = invitation.InvitationMessage;
         }
         item.bool1 = false;
         if (invitation.HasCreationTime)
         {
             item.long2 = invitation.CreationTime;
         }
         if (invitation.HasExpirationTime)
         {
             item.long3 = invitation.ExpirationTime;
         }
         this.m_updateList.Add(item);
     }
 }
 private void AddFriendInternal(BnetEntityId entityId)
 {
     if (entityId != null)
     {
         BattleNet.FriendsUpdate item = new BattleNet.FriendsUpdate {
             action  = 1,
             entity1 = entityId
         };
         this.m_updateList.Add(item);
         base.m_battleNet.Presence.PresenceSubscribe(BnetEntityId.CreateForProtocol(entityId));
         this.m_friendEntityId.Add(entityId, new Map <ulong, EntityId>());
         this.m_friendsCount = (uint)this.m_friendEntityId.Count;
     }
 }
 private void RemoveFriendInternal(BnetEntityId entityId)
 {
     if (entityId != null)
     {
         BattleNet.FriendsUpdate item = new BattleNet.FriendsUpdate {
             action  = 2,
             entity1 = entityId
         };
         this.m_updateList.Add(item);
         base.m_battleNet.Presence.PresenceUnsubscribe(BnetEntityId.CreateForProtocol(entityId));
         if (this.m_friendEntityId.ContainsKey(entityId))
         {
             foreach (EntityId id in this.m_friendEntityId[entityId].Values)
             {
                 base.m_battleNet.Presence.PresenceUnsubscribe(id);
             }
             this.m_friendEntityId.Remove(entityId);
         }
         this.m_friendsCount = (uint)this.m_friendEntityId.Count;
     }
 }
 public static BnetInvitation CreateFromFriendsUpdate(BattleNet.FriendsUpdate src)
 {
     return(new BnetInvitation {
         m_id = new BnetInvitationId(src.long1), m_inviterId = src.entity1.Clone(), m_inviteeId = src.entity2.Clone(), m_inviterName = src.string1, m_inviteeName = src.string2, m_message = src.string3, m_creationTimeMicrosec = src.long2, m_expirationTimeMicrosec = src.long3
     });
 }