/// <summary> /// Recursively copies /// </summary> /// <param name="sourceFolderNode">Represents the folder that needs to copied.</param> /// <param name="targetFolderPath">The path of the target folder that corresponds to the /// submitted <paramref name="sourceFolderNode"/>.</param> protected virtual void CopyFolderContents(ZipNode sourceFolderNode, string targetFolderPath) { //create the target folder NodeRepository.ZipFile.AddDirectoryByName(targetFolderPath); foreach (var childFile in sourceFolderNode.ChildFiles) { //copy file string path = CreateFilePath(targetFolderPath, childFile.GetLocalName()); //create a deferred stream that extracts the file during writing var ds = new DeferredStream(() => Configuration.TempStreamFactory.CreateTempStream()); NodeRepository.ZipFile.AddEntry(path, s => ds, (s, n) => ds.Dispose()); } foreach (ZipNode childFolder in sourceFolderNode.ChildDirectories) { //create new target folder path and recurse string childPath = CreateFolderPath(targetFolderPath, childFolder.GetLocalName()); CopyFolderContents(childFolder, childPath); } }
public StreamExecutionTask(IOperationContext operationContext, DeferredStream deferredStream) { _operationContext = operationContext; _deferredStream = deferredStream; Context = (IExecutionTaskContext)operationContext; }