Exemplo n.º 1
0
        private void Transform(FileSplitter originalFileSplitter, FileAssembler convertedFileAssembler, IMemoryDataConverter dataConverter)
        {
            var taskPool = PriorityTaskPool.Instance;
            var fileConverter = new FileConverter(dataConverter, convertedFileAssembler, taskPool);

            foreach (var fileChunk in originalFileSplitter.GetFileChunks())
            {
                taskPool.AddTask(new ReadFileChunkTask(fileChunk, fileConverter), 0);
            }
            taskPool.Start();
            taskPool.WaitForCompleting();
            if (taskPool.Exception != null)
            {
                throw taskPool.Exception;
            }
        }
 public ConvertFileChunkTask(IMemoryDataConverter converter, FileChunk originalFileChunk, FileAssembler archiveAssembler)
 {
     _converter = converter;
     _originalFileChunk = originalFileChunk;
     _archiveAssembler = archiveAssembler;
 }
Exemplo n.º 3
0
 public FileConverter(IMemoryDataConverter converter, FileAssembler fileAssembler, ITaskConsumer taskPool)
 {
     _converter = converter;
     _fileAssembler = fileAssembler;
     _taskPool = taskPool;
 }