示例#1
0
        private void HandleFriendsList(ParseData pd)
        {
            DataReader dr = new DataReader(pd.Data);
            int numEntries = dr.ReadByte();
            FriendUser[] list = new FriendUser[numEntries];
            for (int i = 0; i < numEntries; i++)
            {
                FriendUser friend = __ParseNewFriend(dr, i);
                list[i] = friend;
            }

            m_friendsList.AddRange(list);

            Debug.WriteLine("Received friends list; " + list.Length + " user on it.");

            FriendListReceivedEventArgs args = new FriendListReceivedEventArgs(list) { EventData = pd };
            OnFriendListReceived(args);
        }
        private static FriendUser __ParseNewFriend(DataReader dr, int i)
        {
            string acct = dr.ReadCString();
            FriendStatus status = (FriendStatus)dr.ReadByte();
            FriendLocation location = (FriendLocation)dr.ReadByte();
            string productID = dr.ReadDwordString(0);
            Product prod = null;
            string locationName = string.Empty;
            if (location == FriendLocation.Offline)
            {
                dr.Seek(1);
            }
            else
            {
                prod = Product.GetByProductCode(productID);
                locationName = dr.ReadCString();
            }

            FriendUser friend = new FriendUser(i, acct, status, location, prod, locationName);
            return friend;
        }
 /// <summary>
 /// Creates a new <see>FriendUpdatedEventArgs</see>.
 /// </summary>
 /// <param name="updatedFriend">The friend that was updated.</param>
 public FriendUpdatedEventArgs(FriendUser updatedFriend)
 {
     m_updated = updatedFriend;
 }
 /// <summary>
 /// Creates a new <see>FriendListReceivedEventArgs</see>.
 /// </summary>
 /// <param name="friends">The list of friends received from Battle.net.</param>
 public FriendListReceivedEventArgs(FriendUser[] friends)
 {
     m_friends = friends;
 }
示例#5
0
 /// <summary>
 /// Creates a new <see>FriendRemovedEventArgs</see>.
 /// </summary>
 /// <param name="friend">The friend who was removed.</param>
 public FriendRemovedEventArgs(FriendUser friend)
 {
     m_removed = friend;
 }
 /// <summary>
 /// Creates a new <see>FriendAddedEventArgs</see>.
 /// </summary>
 /// <param name="newFriend">The friend that was added to the list.</param>
 public FriendAddedEventArgs(FriendUser newFriend)
 {
     m_newFriend = newFriend;
 }
 /// <summary>
 /// Creates a new <see>FriendUpdatedEventArgs</see>.
 /// </summary>
 /// <param name="updatedFriend">The friend that was updated.</param>
 public FriendUpdatedEventArgs(FriendUser updatedFriend)
 {
     m_updated = updatedFriend;
 }
示例#8
0
 /// <summary>
 /// Creates a new <see>FriendAddedEventArgs</see>.
 /// </summary>
 /// <param name="newFriend">The friend that was added to the list.</param>
 public FriendAddedEventArgs(FriendUser newFriend)
 {
     m_newFriend = newFriend;
 }
 /// <summary>
 /// Creates a new <see>FriendMovedEventArgs</see>.
 /// </summary>
 /// <param name="friend">The friend whose position changed.</param>
 /// <param name="newIndex">The new 0-based index of the friend's position.</param>
 public FriendMovedEventArgs(FriendUser friend, int newIndex)
 {
     m_user     = friend;
     m_newIndex = newIndex;
 }
示例#10
0
 /// <summary>
 /// Creates a new <see>FriendMovedEventArgs</see>.
 /// </summary>
 /// <param name="friend">The friend whose position changed.</param>
 /// <param name="newIndex">The new 0-based index of the friend's position.</param>
 public FriendMovedEventArgs(FriendUser friend, int newIndex)
 {
     m_user = friend;
     m_newIndex = newIndex;
 }
 /// <summary>
 /// Creates a new <see>FriendRemovedEventArgs</see>.
 /// </summary>
 /// <param name="friend">The friend who was removed.</param>
 public FriendRemovedEventArgs(FriendUser friend)
 {
     m_removed = friend;
 }