public void SetContent(FileInfoContract target, Stream content) { ExecuteInSemaphore(() => { target.Size = content.Length; var gatewayContent = content.EncryptOrPass(encryptionKey); #if DEBUG CompositionInitializer.SatisfyImports(gatewayContent = new TraceStream(nameof(target), target.Name, gatewayContent)); #endif gateway.SetContent(rootName, target.Id, gatewayContent, null); }, nameof(SetContent), true); }
public Stream GetContent(FileInfoContract source) { return(ExecuteInSemaphore(() => { var gatewayContent = gateway.GetContentAsync(rootName, source.Id).Result.ToSeekableStream(); var content = gatewayContent.DecryptOrPass(encryptionKey); #if DEBUG CompositionInitializer.SatisfyImports(content = new TraceStream(nameof(GetContent), source.Name, content)); #endif return content; }, nameof(GetContent))); }
public void SetContent(FileInfoContract target, Stream content) { ExecuteInSemaphore(() => { target.Size = content.Length; var gatewayContent = content.EncryptOrPass(encryptionKey); #if DEBUG CompositionInitializer.SatisfyImports(gatewayContent = new TraceStream(nameof(SetContent), target.Name, gatewayContent)); #endif Func <FileSystemInfoLocator> locator = () => new FileSystemInfoLocator(target); gateway.SetContentAsync(rootName, target.Id, gatewayContent, null, locator).Wait(); }, nameof(SetContent), true); }