// Token: 0x0600223D RID: 8765 RVA: 0x0007E938 File Offset: 0x0007CB38 private OneDriveProItemsPage UpdatePageCache(IClientContext clientContext, UserContext userContext, IList list, string listName, string location, IndexedPageView requestedData, AttachmentItemsSort sort, DataProviderCallLogEvent logEvent) { string changeToken; bool flag; this.GetListItemChangesSinceToken(clientContext, userContext.LogonIdentity, listName, location, out changeToken, out flag, logEvent); this.ChangeToken = changeToken; if (flag) { this.PageMap.Clear(); } int num = this.ComputeStartPageIndex(requestedData); OneDriveProItemsPage nearestPage = this.GetNearestPage(num); int num2 = (nearestPage != null) ? nearestPage.PageIndex : -1; if (nearestPage == null || num != nearestPage.PageIndex) { ListItemCollectionPosition listItemCollectionPosition = this.GetListItemCollectionPosition(nearestPage); CamlQuery query = OneDriveProUtilities.CreatePagedCamlPageQuery(location, sort, listItemCollectionPosition, Math.Abs(num - num2) * 200 + 200); IListItemCollection items = list.GetItems(query); items.Load(clientContext, new Expression <Func <ListItemCollection, object> > [0]); OneDriveProUtilities.ExecuteQueryWithTraces(userContext, clientContext, logEvent, "UpdatePageCache"); this.UpdateCache(items, nearestPage); } OneDriveProItemsPage result; this.PageMap.TryGetValue(num, out result); return(result); }
// Token: 0x0600223B RID: 8763 RVA: 0x0007E7A4 File Offset: 0x0007C9A4 internal IEnumerable <IListItem> GetItems(UserContext userContext, string endPointUrl, string documentLibrary, string location, IndexedPageView requestedData, AttachmentItemsSort sort, out int totalItemCount, DataProviderCallLogEvent logEvent) { IEnumerable <IListItem> result; using (IClientContext clientContext = OneDriveProUtilities.CreateAndConfigureClientContext(userContext.LogonIdentity, endPointUrl)) { totalItemCount = 0; IList documentsLibrary = OneDriveProUtilities.GetDocumentsLibrary(clientContext, documentLibrary); OneDriveProItemsPage page = this.UpdatePageCache(clientContext, userContext, documentsLibrary, documentLibrary, location, requestedData, sort, logEvent); CamlQuery camlDataQuery = this.GetCamlDataQuery(location, requestedData, this.GetListItemCollectionPosition(page), sort); IListItemCollection items = documentsLibrary.GetItems(camlDataQuery); IFolder folder = string.IsNullOrEmpty(location) ? documentsLibrary.RootFolder : clientContext.Web.GetFolderByServerRelativeUrl(location); items.Load(clientContext, new Expression <Func <ListItemCollection, object> > [0]); folder.Load(clientContext, new Expression <Func <Folder, object> >[] { (Folder x) => (object)x.ItemCount }); OneDriveProUtilities.ExecuteQueryWithTraces(userContext, clientContext, logEvent, "GetItems"); int startIndex = requestedData.Offset % 200; int endIndex = startIndex + requestedData.MaxRows; totalItemCount = folder.ItemCount; result = items.ToList <IListItem>().Where((IListItem item, int index) => index >= startIndex && index < endIndex); } return(result); }