private Dictionary <Guid, byte[]> GetThumbnailData <T>(IEnumerable <T> entities, string entityAuthority, Func <T, Guid> getSystemId) where T : class { var thumbnailData = new Dictionary <Guid, byte[]>(); foreach (var item in entities) { var systemId = getSystemId(item); var container = _blobService.Create(entityAuthority, systemId); var blob = container.GetDefault(); if (!blob.Exists) { continue; } thumbnailData[systemId] = GetPhysicalFileContent(blob); } return(thumbnailData); }
protected virtual void ImportFiles(StructureInfo structureInfo, Folder folder, Guid parentId) { foreach (var fileCarrier in structureInfo.MediaArchive.Files.Where(x => x.FolderSystemId == parentId).OrderBy(x => x.Name)) { using (var stream = new MemoryStream(structureInfo.MediaArchive.FileData[fileCarrier.SystemId])) { var blobContainer = _blobService.Create(ModuleName); using (var blobStream = blobContainer.GetDefault().OpenWrite()) { stream.CopyTo(blobStream); } var template = _fieldTemplateService.FindFileTemplate(fileCarrier.GetFileExtension()); var fileObject = new File(template.SystemId, folder.SystemId, blobContainer.Uri, fileCarrier.Name) { SystemId = structureInfo.Id(fileCarrier.SystemId), LastWriteTimeUtc = DateTimeOffset.UtcNow }; _fileMetadataExtractorService.UpdateMetadata(template, fileObject, null, blobContainer.Uri); fileObject.AccessControlList = folder.AccessControlList; _fileService.Create(fileObject); } } }