private BackupObject GetBackupObject(Action <ExportImportProgressInfo> progressCallback, bool handleBynaryData) { var retVal = new BackupObject(); var progressInfo = new ExportImportProgressInfo(); progressInfo.Description = "cms content loading..."; progressCallback(progressInfo); retVal.MenuLinkLists = _menuService.GetAllLinkLists().Select(x => x.ToWebModel()).ToList(); if (handleBynaryData) { var result = _contentStorageProvider.Search("", null); foreach (var blobFolder in result.Folders.Where(x => _exportedFolders.Contains(x.Name))) { var contentFolder = new ContentFolder { Url = blobFolder.RelativeUrl }; ReadContentFoldersRecurive(contentFolder, progressCallback); retVal.ContentFolders.Add(contentFolder); } } return(retVal); }
private int CountContentItemsRecursive(string folderUrl, IContentBlobStorageProvider _contentStorageProvider, string excludedFolderUrl = null) { var searchResult = _contentStorageProvider.Search(folderUrl, null); var retVal = searchResult.Items.Count + searchResult.Folders .Where(x => excludedFolderUrl == null || !x.RelativeUrl.EndsWith(excludedFolderUrl, StringComparison.InvariantCultureIgnoreCase)) .Select(x => CountContentItemsRecursive(x.RelativeUrl, _contentStorageProvider)) .Sum(); return(retVal); }