public IEnumerable <FileSystemInfoContract> GetChildItem(DirectoryInfoContract parent) { return(ExecuteInSemaphore(() => { return gateway.GetChildItem(rootName, parent.Id).Select(item => { FixupSize(item, id => gateway.GetContent(rootName, id)); return item; }); }, nameof(GetChildItem))); }
public Stream GetContent(FileInfoContract source) { return(ExecuteInSemaphore(() => { var gatewayContent = gateway.GetContent(rootName, source.Id).ToSeekableStream(); var content = gatewayContent.DecryptOrPass(encryptionKey); #if DEBUG CompositionInitializer.SatisfyImports(content = new TraceStream(nameof(source), source.Name, content)); #endif return content; }, nameof(GetContent))); }
public Stream GetContent(FileInfoContract source) { return(ExecuteInSemaphore(() => { var gatewayContent = _gateway.GetContent(_rootName, source.Id).ToSeekableStream(); var content = gatewayContent.DecryptOrPass(_encryptionKey); if (content != gatewayContent) { gatewayContent.Close(); } source.Size = (FileSize)content.Length; //#if DEBUG // CompositionInitializer.SatisfyImports(content = new TraceStream(nameof(source), source.Name, content)); //#endif return content; }, nameof(GetContent))); }
public Stream GetContent(FileInfoContract source, ProgressProxy progress) { var result = gateway.GetContent(rootName, source.Id); if (!result.CanSeek) { var bufferStream = new MemoryStream(); result.CopyTo(bufferStream, MAX_BULKDOWNLOAD_SIZE); bufferStream.Seek(0, SeekOrigin.Begin); result.Dispose(); result = bufferStream; } result = new ProgressStream(result, progress); if (!string.IsNullOrEmpty(encryptionKey)) { result = result.Decrypt(encryptionKey); } return(result); }