예제 #1
0
        // Token: 0x0600002B RID: 43 RVA: 0x00002A44 File Offset: 0x00000C44
        private async Task FavUnFavFollowSelected(SocialGraphOperation operation)
        {
            this.PerformingPeopleAction = true;
            await this.socialGraphDAL.UpdateSocialGraph(this.ListNowFollowing.ToUserList(), operation);

            this.PerformingPeopleAction = false;
            await this.RefreshAsync();
        }
예제 #2
0
        // Token: 0x06000093 RID: 147 RVA: 0x000049E8 File Offset: 0x00002BE8
        public async Task UpdateSocialGraphBatchAsync(List <User> users, SocialGraphOperation operation)
        {
            bool flag  = users.Count > 25;
            bool flag2 = flag;
            bool flag3 = flag2;

            if (flag3)
            {
                throw new ArgumentException("AddFollowers can only add " + 25 + " followers at a time");
            }
            this.logger.LogToOutputWindow("Calling social graph with " + users.Count + " xuids...");
            SocialGraphRequestContract requestBody = new SocialGraphRequestContract
            {
                xuids = users.ToXuidArray()
            };
            string body = JsonConvert.SerializeObject(requestBody);

            try
            {
                switch (operation)
                {
                case SocialGraphOperation.Favorite:
                {
                    Response response = await XBLCall.PostAsync(this.SocialGraphBaseURI + "/users/xuid(" + this.TokenManager.xuid + ")/people/favorites/xuids?method=add", body, this.TokenManager.userHash, this.TokenManager.XToken, "2");

                    break;
                }

                case SocialGraphOperation.Unfavorite:
                {
                    Response response2 = await XBLCall.PostAsync(this.SocialGraphBaseURI + "/users/xuid(" + this.TokenManager.xuid + ")/people/favorites/xuids?method=remove", body, this.TokenManager.userHash, this.TokenManager.XToken, "2");

                    break;
                }

                case SocialGraphOperation.Follow:
                {
                    Response response3 = await XBLCall.PostAsync(this.SocialGraphBaseURI + "/users/xuid(" + this.TokenManager.xuid + ")/people/xuids?method=add", body, this.TokenManager.userHash, this.TokenManager.XToken, "2");

                    break;
                }

                case SocialGraphOperation.Unfollow:
                {
                    Response response4 = await XBLCall.PostAsync(this.SocialGraphBaseURI + "/users/xuid(" + this.TokenManager.xuid + ")/people/xuids?method=remove", body, this.TokenManager.userHash, this.TokenManager.XToken, "2");

                    break;
                }
                }
            }
            catch (Exception ex)
            {
                this.logger.LogToOutputWindow("Failed to update social graph, error: " + ex.Message, Colors.Red);
            }
        }
예제 #3
0
        // Token: 0x06000091 RID: 145 RVA: 0x00004948 File Offset: 0x00002B48
        public async Task UpdateSocialGraph(List <User> users, SocialGraphOperation operation)
        {
            for (int i = 0; i < users.Count; i += 25)
            {
                List <User> batch = (from p in users.Skip(i).Take(25)
                                     where p.xuid != this.TokenManager.xuid
                                     select p).ToList <User>();
                await this.UpdateSocialGraphBatchAsync(batch, operation);

                batch = null;
                batch = null;
                batch = null;
            }
        }