Exemplo n.º 1
0
 private static string GetChunkFilePath(FlowRequestContext context, FlowRequest request)
 {
     return string.Concat(
         context.GetChunkPathFunc(request),
         "/",
         context.GetChunkFileName(request));
 }
Exemplo n.º 2
0
 private static string GetChunkFilePath(FlowRequestContext context, FlowRequest request)
 {
     return(string.Concat(
                context.GetChunkPathFunc(request),
                "/",
                context.GetChunkFileName(request)));
 }
Exemplo n.º 3
0
        private async Task CombineAsync(FlowRequestContext context, FlowRequest request)
        {
            var filePath = string.Concat(
                context.GetFilePathFunc(request),
                "/",
                context.GetFileName(request));

            var chunkPath      = context.GetChunkPathFunc(request);
            var chunkFilePaths = await _fileSystem.ListDirectoryAsync(chunkPath).ConfigureAwait(false);

            using (var fileStream = await _fileSystem.OpenWriteAsync(filePath).ConfigureAwait(false))
            {
                foreach (var file in chunkFilePaths)
                {
                    using (var sourceStream = await _fileSystem.OpenReadAsync(file).ConfigureAwait(false))
                    {
                        await sourceStream.CopyToAsync(fileStream).ConfigureAwait(false);
                    }
                }

                await fileStream.FlushAsync().ConfigureAwait(false);
            }

            await _fileSystem.DeleteDirectoryAsync(chunkPath).ConfigureAwait(false);
        }
Exemplo n.º 4
0
        private async Task CombineAsync(FlowRequestContext context, FlowRequest request)
        {
            var filePath = string.Concat(
                context.GetFilePathFunc(request),
                "/",
                context.GetFileName(request));

            var chunkPath = context.GetChunkPathFunc(request);
            var chunkFilePaths = await _fileSystem.ListDirectoryAsync(chunkPath);

            using (var fileStream = await _fileSystem.OpenWriteAsync(filePath))
            {
                foreach (var file in chunkFilePaths)
                {
                    using (var sourceStream = await _fileSystem.OpenReadAsync(file))
                    {
                        await sourceStream.CopyToAsync(fileStream);
                    }
                }

                await fileStream.FlushAsync();
            }

            await _fileSystem.DeleteDirectoryAsync(chunkPath);
        }