Пример #1
0
        public async Task <T> Handle <T>(string path, Stream stream)
        {
            var memory = new MemoryStream();

            stream.CopyTo(memory);
            memory.Position = 0;
            var fullPath = Path.Combine(rootPath, VantageCrawler.GetPath(path));

            Directory.CreateDirectory(Path.GetDirectoryName(fullPath));

            using (var file = File.Create(fullPath))
                await memory.CopyToAsync(file);
            memory.Position = 0;

            return(await inner.Handle <T>(path, memory));
        }
Пример #2
0
        public Task <Stream> Get(string path)
        {
            var fullPath = Path.Combine(rootPath, VantageCrawler.GetPath(path));

            return(Task.FromResult((Stream)File.OpenRead(fullPath)));
        }