Пример #1
0
        public void AddConfiguration(string configurationName, string fileName, bool createNew)
        {
            _package.EnableConfigurations = true;

            string configFilePath = ExpressionPathBuilder.PathCleaner(Settings.Default.DetegoPackageConfigurationRoot
                                                                      + Path.DirectorySeparatorChar
                                                                      + fileName);

            Message.Trace(Severity.Debug, "Adding Configuration File {0}", configFilePath);

            if (createNew)
            {
                Message.Trace(Severity.Debug, "XML Says CreateNew: Creating Configuration File {0}", configFilePath);
                _package.ExportConfigurationFile(configFilePath + Resources.ExtensionTempFile);

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(configFilePath + Resources.ExtensionTempFile);

                XmlTextWriter xmlPrettyPrinter = new XmlTextWriter(configFilePath, null);
                xmlPrettyPrinter.Formatting = Formatting.Indented;

                xmlDoc.Save(xmlPrettyPrinter);

                xmlPrettyPrinter.Flush();
                xmlPrettyPrinter.Close();
                File.Delete(configFilePath + Resources.ExtensionTempFile);
            }

            DTS.Configuration config = _package.Configurations.Add();
            config.ConfigurationType = DTS.DTSConfigurationType.ConfigFile;
            config.Name                = configurationName;
            config.Description         = configurationName;
            config.ConfigurationString = configFilePath;
        }
Пример #2
0
        public override void Emit(XPathNavigator patternNavigator)
        {
            if (patternNavigator != null)
            {
                ExpressionPathBuilder epb = new ExpressionPathBuilder(VulcanPackage);
                string relativePath       = patternNavigator.SelectSingleNode("@RelativePath").Value;

                string expression = epb.BuildRelativeExpression(
                    "varRootDir",
                    relativePath
                    );

                relativePath = relativePath.Replace(Path.DirectorySeparatorChar, '_');
                relativePath = relativePath.Replace('.', '_');

                Connection         c   = new Connection(VulcanPackage, relativePath, relativePath, "FILE", expression);
                ExecutePackageTask ept = new ExecutePackageTask(VulcanPackage, relativePath, relativePath, ParentContainer, c);

                this.FirstExecutableGeneratedByPattern = ept.TaskHost;
                this.LastExecutableGeneratedByPattern  = ept.TaskHost;
            }
        }
Пример #3
0
        public FTPTask(
            Packages.VulcanPackage vulcanPackage,
            string name,
            string taskDescription,
            DTS.IDTSSequence parentContainer,
            string serverName,
            string port,
            string userName,
            string password,
            string remotePath,
            bool isRemotePathVariable,
            string localPath,
            bool isLocalPathVariable,
            Microsoft.SqlServer.Dts.Tasks.FtpTask.DTSFTPOp operation
            )
            :
            base(
                vulcanPackage,
                name,
                taskDescription,
                parentContainer
                )
        {
            fTPTask             = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:FTPTask");
            fTPTask.Name        = name;
            fTPTask.Description = taskDescription;
            this.Task.Operation = operation;

            this.Task.IsRemotePathVariable = isRemotePathVariable;
            this.Task.IsLocalPathVariable  = isLocalPathVariable;

            Connection fTPServerConnection = new Connection(vulcanPackage, serverName, serverName, "FTP", String.Format("\"{0}:{1}\"", serverName, port));

            fTPServerConnection.SetProperty("ServerUserName", userName);
            fTPServerConnection.SetProperty("ServerPassword", password);
            this.Task.Connection = fTPServerConnection.ConnectionManager.ID;

            if (this.Task.IsRemotePathVariable == true)
            {
                this.Task.RemotePath = remotePath;
            }
            else
            {
                this.Task.RemotePath = remotePath;
            }

            if (this.Task.IsLocalPathVariable == true)
            {
                this.Task.LocalPath = localPath;
            }
            else
            {
                Connection localConnection  = new Connection(vulcanPackage, localPath, localPath, "File", String.Format("\"{0}\"", ExpressionPathBuilder.EscapeBackslashes(localPath)));
                int        intFileUsageType = 2;
                switch (operation)
                {
                case Microsoft.SqlServer.Dts.Tasks.FtpTask.DTSFTPOp.Send:
                    intFileUsageType = 0;
                    break;

                case Microsoft.SqlServer.Dts.Tasks.FtpTask.DTSFTPOp.Receive:
                    intFileUsageType = 2;
                    break;

                default:
                    intFileUsageType = 2;
                    break;
                }
                localConnection.SetProperty("FileUsageType", intFileUsageType);

                this.Task.LocalPath = localPath;
            }
        }
Пример #4
0
        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;
        }
Пример #5
0
 public string AddFileToProject(string fileName)
 {
     _projectManager.MiscFiles.Add(fileName);
     return(ExpressionPathBuilder.PathCleaner(QualifiedProjectPath + Path.DirectorySeparatorChar + fileName));
 }