Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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)));
        }
Ejemplo n.º 3
0
        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);
        }