// Token: 0x0600020B RID: 523 RVA: 0x000080D7 File Offset: 0x000062D7
 internal static CamlQuery CreatePagedCamlDataQuery(string location, AttachmentItemsSort sort, ListItemCollectionPosition listItemCollectionPosition, int numberOfItems)
 {
     return(OneDriveProUtilities.CreatePagedCamlQuery(location, sort, listItemCollectionPosition, numberOfItems, "<View>\r\n                                                <Query>\r\n                                                    <OrderBy>\r\n                                                        <FieldRef Name='FSObjType' Ascending='FALSE' />\r\n                                                        <FieldRef Name='{0}' Ascending='{1}' />\r\n                                                    </OrderBy>\r\n                                                </Query>\r\n                                                <ViewFields>\r\n                                                    <FieldRef Name='ID' />\r\n                                                    <FieldRef Name='FileLeafRef' />\r\n                                                    <FieldRef Name='FSObjType' />\r\n                                                    <FieldRef Name='FileRef' />\r\n                                                    <FieldRef Name='File_x0020_Size' />\r\n                                                    <FieldRef Name='Modified' />\r\n                                                    <FieldRef Name='Editor' />\r\n                                                    <FieldRef Name='ItemChildCount' />\r\n                                                    <FieldRef Name='FolderChildCount' />\r\n                                                    <FieldRef Name='ProgId' />\r\n                                                </ViewFields><RowLimit>{2}</RowLimit></View>"));
 }
 // Token: 0x0600020C RID: 524 RVA: 0x000080E7 File Offset: 0x000062E7
 internal static CamlQuery CreateCamlDataQuery(string location, AttachmentItemsSort sort)
 {
     return(OneDriveProUtilities.CreateCamlQuery(location, null, string.Format("<View>\r\n                                                <Query>\r\n                                                    <OrderBy>\r\n                                                        <FieldRef Name='FSObjType' Ascending='FALSE' />\r\n                                                        <FieldRef Name='{0}' Ascending='{1}' />\r\n                                                    </OrderBy>\r\n                                                </Query>\r\n                                                <ViewFields>\r\n                                                    <FieldRef Name='ID' />\r\n                                                    <FieldRef Name='FileLeafRef' />\r\n                                                    <FieldRef Name='FSObjType' />\r\n                                                    <FieldRef Name='FileRef' />\r\n                                                    <FieldRef Name='File_x0020_Size' />\r\n                                                    <FieldRef Name='Modified' />\r\n                                                    <FieldRef Name='Editor' />\r\n                                                    <FieldRef Name='ItemChildCount' />\r\n                                                    <FieldRef Name='FolderChildCount' />\r\n                                                    <FieldRef Name='ProgId' />\r\n                                                </ViewFields></View>", OneDriveProUtilities.GetSortColumn(sort.SortColumn), OneDriveProUtilities.GetSortOrder(sort.SortOrder))));
 }
 // Token: 0x0600020A RID: 522 RVA: 0x000080C7 File Offset: 0x000062C7
 internal static CamlQuery CreatePagedCamlPageQuery(string location, AttachmentItemsSort sort, ListItemCollectionPosition listItemCollectionPosition, int numberOfItems)
 {
     return(OneDriveProUtilities.CreatePagedCamlQuery(location, sort, listItemCollectionPosition, numberOfItems, "<View>\r\n                                                    <Query>\r\n                                                        <OrderBy>\r\n                                                            <FieldRef Name='FSObjType' Ascending='FALSE' />\r\n                                                            <FieldRef Name='{0}' Ascending='{1}' />\r\n                                                        </OrderBy>\r\n                                                    </Query>\r\n                                                    <ViewFields>\r\n                                                        <FieldRef Name='ID' />\r\n                                                        <FieldRef Name='FileLeafRef' />\r\n                                                        <FieldRef Name='FSObjType' />\r\n                                                        <FieldRef Name='SortBehavior' />\r\n                                                    </ViewFields>\r\n                                                    <RowLimit>{2}</RowLimit>\r\n                                                </View>"));
 }
 // Token: 0x06000216 RID: 534 RVA: 0x000086F5 File Offset: 0x000068F5
 private static CamlQuery CreatePagedCamlQuery(string location, AttachmentItemsSort sort, ListItemCollectionPosition listItemCollectionPosition, int numberOfItems, string viewXmlFormat)
 {
     return(OneDriveProUtilities.CreateCamlQuery(location, listItemCollectionPosition, string.Format(viewXmlFormat, OneDriveProUtilities.GetSortColumn(sort.SortColumn), OneDriveProUtilities.GetSortOrder(sort.SortOrder), numberOfItems)));
 }
        // 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);
        }
        // Token: 0x0600223E RID: 8766 RVA: 0x0007EA08 File Offset: 0x0007CC08
        private CamlQuery GetCamlDataQuery(string location, IndexedPageView requestedData, ListItemCollectionPosition position, AttachmentItemsSort sort)
        {
            int numberOfItems = requestedData.Offset % 200 + requestedData.MaxRows;

            return(OneDriveProUtilities.CreatePagedCamlDataQuery(location, sort, position, numberOfItems));
        }