Example #1
0
        // Token: 0x0600002C RID: 44 RVA: 0x00002A94 File Offset: 0x00000C94
        private async Task BlockOrUnblockSelected(PrivacyOperation operation)
        {
            this.PerformingPeopleAction = true;
            await this.privacyDAL.UpdateUsers(this.ListNowFollowing.ToUserList(), operation);

            this.PerformingPeopleAction = false;
            await this.RefreshAsync();
        }
		// Token: 0x06000089 RID: 137 RVA: 0x00004768 File Offset: 0x00002968
		private async Task BatchPrivacyCallAsync(List<User> PrivacyXuidBatch, PrivacyOperation operation)
		{
			bool flag = PrivacyXuidBatch.Count > 10;
			bool flag2 = flag;
			bool flag3 = flag2;
			if (flag3)
			{
				throw new ArgumentException("PrivacyXuidBatch can only update " + 10.ToString() + " users at a time");
			}
			string operationStr = (operation == PrivacyOperation.Block) ? "Add" : "Remove";
			PrivacyRequestContract privacyRequestData = new PrivacyRequestContract
			{
				Operation = operationStr,
				Users = PrivacyXuidBatch.ToPrivacyUserArray()
			};
			string body = JsonConvert.SerializeObject(privacyRequestData);
			this.logger.LogToOutputWindow("Attempting to update block list status for " + PrivacyXuidBatch.Count + " xuids...");
			Response response = await XBLCall.PostAsync(this.PrivacyBaseURI + "/users/xuid(" + this.TokenManager.xuid + ")/people/never", body, this.TokenManager.userHash, this.TokenManager.XToken, "2");
		}
		// Token: 0x06000088 RID: 136 RVA: 0x00004710 File Offset: 0x00002910
		public async Task UpdateUsers(List<User> users, PrivacyOperation operation)
		{
			try
			{
				for (int i = 0; i < users.Count; i += 10)
				{
					List<User> batch = users.Skip(i).Take(10).ToList<User>();
					await this.BatchPrivacyCallAsync(batch, operation);
					batch = null;
					batch = null;
					batch = null;
				}
				this.logger.LogToOutputWindow("Operation complete.");
			}
			catch (Exception ex)
			{
				this.logger.LogToOutputWindow("Error " + ex.Message, Colors.Red);
			}
		}