public FileSystemTask( Packages.VulcanPackage vulcanPackage, string name, string taskDescription, DTS.IDTSSequence parentContainer, string sourceConnection, string destConnection, Microsoft.SqlServer.Dts.Tasks.FileSystemTask.DTSFileSystemOperation operation ) : base( vulcanPackage, name, taskDescription, parentContainer ) { Connection source = new Connection(vulcanPackage, sourceConnection, sourceConnection, "FILE", String.Format("\"{0}\"", ExpressionPathBuilder.EscapeBackslashes(sourceConnection))); Connection dest = new Connection(vulcanPackage, destConnection, destConnection, "FILE", String.Format("\"{0}\"", ExpressionPathBuilder.EscapeBackslashes(destConnection))); source.SetProperty("FileUsageType", 2); dest.SetProperty("FileUsageType", 2); fileSystemTask = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:FileSystemTask"); fileSystemTask.Name = name; this.Task.Operation = operation; this.Task.Source = source.ConnectionManager.ID; this.Task.Destination = dest.ConnectionManager.ID; }
public override void Emit(XPathNavigator patternNavigator) { if (patternNavigator != null) { string name = patternNavigator.SelectSingleNode("@Name").Value; string sourcePath = patternNavigator.SelectSingleNode("@SourcePath").Value; string destPath = patternNavigator.SelectSingleNode("@DestinationPath").Value; string operationAsString = patternNavigator.SelectSingleNode("@Operation").Value; DTSTasks.FileSystemTask.DTSFileSystemOperation operation = DTSTasks.FileSystemTask.DTSFileSystemOperation.CopyDirectory; switch (operationAsString.ToUpperInvariant()) { case "COPYDIRECTORY": operation = DTSTasks.FileSystemTask.DTSFileSystemOperation.CopyDirectory; break; default: break; } FileSystemTask ft = new FileSystemTask(VulcanPackage, name, name, ParentContainer, sourcePath, destPath, operation); ft.SetExpression("OverwriteDestinationFile", "True"); this.FirstExecutableGeneratedByPattern = ft.TaskHost; this.LastExecutableGeneratedByPattern = ft.TaskHost; } }