Ejemplo n.º 1
0
        /// <summary>
        /// De-Serializes WaitForTime properties from XmlElement
        /// </summary>
        /// <param name="node"></param>
        /// <param name="infoEvents"></param>
        void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name == "WaitForTimeData")
            {
                if (node.HasAttributes) //new format
                {
                    TimeSpan ts;
                    if (TimeSpan.TryParse(node.GetAttribute("waitTime"), out ts))
                    {
                        WaitTime = ts;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForTimeTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "WaitTime", node.GetAttribute("checkType")), string.Empty, 0);
                    }

                    bool wnd;
                    if (bool.TryParse(node.GetAttribute("waitNextDayIfTimePassed"), out wnd))
                    {
                        WaitNextDayIfTimePassed = wnd;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForTimeTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "WaitNextDayIfTimePassed", node.GetAttribute("waitNextDayIfTimePassed")), string.Empty, 0);
                    }
                }
                else //old format
                {
                    foreach (XmlNode nd in node.ChildNodes)
                    {
                        switch (nd.Name)
                        {
                        case "waitTime":
                            TimeSpan ts;
                            if (TimeSpan.TryParse(nd.InnerText, out ts))
                            {
                                WaitTime = ts;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForTimeTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "WaitTime", nd.InnerText), string.Empty, 0);
                            }
                            break;

                        case "waitNextDayIfTimePassed":
                            bool wnd;
                            if (bool.TryParse(nd.InnerText, out wnd))
                            {
                                WaitNextDayIfTimePassed = wnd;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForTimeTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "WaitNextDayIfTimePassed", nd.InnerText), string.Empty, 0);
                            }
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            if (string.IsNullOrWhiteSpace(UserName))
              {
            infoEvents.FireError(0, "HDFS", "No UserName specified", string.Empty, 0);
            return DTSExecResult.Failure;
              }
              if (string.IsNullOrWhiteSpace(Host))
              {
            infoEvents.FireError(0, "HDFS", "No Host specified", string.Empty, 0);
            return DTSExecResult.Failure;
              }
              if (Port <= 0)
              {
            infoEvents.FireError(0, "HDFS", "No Port specified", string.Empty, 0);
            return DTSExecResult.Failure;
              }
              if (string.IsNullOrWhiteSpace(ConnectionString))
              {
            infoEvents.FireError(0, "HDFS", "Invalid ConnectionString", string.Empty, 0);
            return DTSExecResult.Failure;
              }

              return DTSExecResult.Success;
        }
Ejemplo n.º 3
0
        public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            if (string.IsNullOrWhiteSpace(UserName))
            {
                infoEvents.FireError(0, "HDFS", "No UserName specified", string.Empty, 0);
                return(DTSExecResult.Failure);
            }
            if (string.IsNullOrWhiteSpace(Host))
            {
                infoEvents.FireError(0, "HDFS", "No Host specified", string.Empty, 0);
                return(DTSExecResult.Failure);
            }
            if (Port <= 0)
            {
                infoEvents.FireError(0, "HDFS", "No Port specified", string.Empty, 0);
                return(DTSExecResult.Failure);
            }
            if (string.IsNullOrWhiteSpace(ConnectionString))
            {
                infoEvents.FireError(0, "HDFS", "Invalid ConnectionString", string.Empty, 0);
                return(DTSExecResult.Failure);
            }

            return(DTSExecResult.Success);
        }
Ejemplo n.º 4
0
        public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            // プロパティが一つでも空だったらエラーとする
            if (!PropertiesValidate(infoEvents, URL, Domain, UserName, Password))
            {
                return(DTSExecResult.Failure);
            }

            // 接続テスト
            try
            {
                var con = CrmConnection.Parse(ConnectionString);
                con.Timeout = TimeSpan.FromSeconds(30);
                using (var service = new OrganizationService(con))
                {
                    service.Execute <WhoAmIResponse>(new WhoAmIRequest());
                }
            }
            catch (Exception e)
            {
                infoEvents.FireError(0, "Dynamics CRM 2011 接続マネージャー", e.Message, string.Empty, 0);
                return(DTSExecResult.Failure);
            }


            return(DTSExecResult.Success);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Loads settings from XML.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="infoEvents">The info events.</param>
 /// <exception cref="System.Exception"></exception>
 void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     try
     {
         //    This might occur if the task's XML has been modified outside of the Business Intelligence
         //    Or SQL Server Workbenches.
         if (node.Name != "ZipTask")
         {
             throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "ZipTask"));
         }
         else
         {
             // let error bubble up
             // populate the private property variables with values from the DTS node.
             this.fileAction          = (ZipFileAction)Enum.Parse(typeof(ZipFileAction), node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEACTION).Value);
             this.compressionType     = (CompressionType)Enum.Parse(typeof(CompressionType), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONTYPE).Value);
             this.zipCompressionLevel = (ZipCompressionLevel)Enum.Parse(typeof(ZipCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONLEVEL).Value);
             this.tarCompressionLevel = (TarCompressionLevel)Enum.Parse(typeof(TarCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.TARCOMPRESSIONLEVEL).Value);
             this.sourceFile          = node.Attributes.GetNamedItem(CONSTANTS.ZIPSOURCE).Value;
             this.zipPassword         = node.Attributes.GetNamedItem(CONSTANTS.ZIPPASSWORD).Value;
             this.targetFile          = node.Attributes.GetNamedItem(CONSTANTS.ZIPTARGET).Value;
             this.removeSource        = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPREMOVESOURCE).Value);
             this.recursive           = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPRECURSIVE).Value);
             this.overwriteTarget     = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPOVERWRITE).Value);
             this.fileFilter          = node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEFILTER).Value;
             this.logLevel            = (LogLevel)Enum.Parse(typeof(LogLevel), node.GetAttribute(CONSTANTS.SFTPLOGLEVEL, String.Empty));
         }
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Load From XML: ", ex.Message, "", 0);
     }
 }
        public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            // プロパティが一つでも空だったらエラーとする
            if (!PropertiesValidate(infoEvents, URL, Domain, UserName, Password))
            {
                return DTSExecResult.Failure;
            }

            // 接続テスト
            try
            {
                var con = CrmConnection.Parse(ConnectionString);
                con.Timeout = TimeSpan.FromSeconds(30);
                using (var service = new OrganizationService(con))
                {
                    service.Execute<WhoAmIResponse>(new WhoAmIRequest());
                }
            }
            catch (Exception e)
            {
                infoEvents.FireError(0, "Dynamics CRM 2011 接続マネージャー", e.Message, string.Empty, 0);
                return DTSExecResult.Failure;
            }


            return DTSExecResult.Success;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Saves settings to XML.
 /// </summary>
 /// <param name="doc">The doc.</param>
 /// <param name="infoEvents">The info events.</param>
 void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
 {
     try
     {
         //create node in the package xml document
         XmlElement taskElement = doc.CreateElement(string.Empty, "SFTPTask", string.Empty);
         doc.AppendChild(taskElement);
         taskElement.SetAttribute(CONSTANTS.SFTPLOCALFILE, null, this.localFile);
         taskElement.SetAttribute(CONSTANTS.SFTPREMOTEFILE, null, this.remoteFile);
         taskElement.SetAttribute(CONSTANTS.SFTPFILEACTION, null, this.fileAction.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPFILEINFO, null, this.fileInfo);
         taskElement.SetAttribute(CONSTANTS.SFTPOVERWRITEDEST, null, this.overwriteDest.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPREMOVESOURCE, null, this.removeSource.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPISRECURSIVE, null, this.isRecursive.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPFILEFILTER, null, this.fileFilter);
         //taskElement.SetAttribute(CONSTANTS.SFTPRETRIES, null, this.reTries.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPHOST, null, this.hostName);
         taskElement.SetAttribute(CONSTANTS.SFTPPORT, null, this.portNumber);
         taskElement.SetAttribute(CONSTANTS.SFTPUSER, null, this.userName);
         taskElement.SetAttribute(CONSTANTS.SFTPPASSWORD, null, this.passWord);
         taskElement.SetAttribute(CONSTANTS.SFTPSTOPONFAILURE, null, this.stopOnFailure.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPREMOTEFILELISTVAR, null, this.remoteFileListVariable);
         taskElement.SetAttribute(CONSTANTS.SFTPLOGLEVEL, null, this.logLevel.ToString());
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Save To XML: ", ex.Message + Environment.NewLine + ex.StackTrace, "", 0);
     }
 }
Ejemplo n.º 8
0
        public void LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name == "InnerObject") //OldFormat
            {
                foreach (XmlElement child in node.ChildNodes)
                {
                    string val = child.GetAttribute("Value");

                    switch (child.Name)
                    {
                    case "SleepInterval":
                        SleepInterval = int.Parse(val);
                        break;

                    default:
                        break;
                    }
                }
            }
            else if (node.Name == "SleepTaskData") //NewFormat
            {
                if (!int.TryParse(node.GetAttribute("SleepInterval"), out sleepInterval))
                {
                    infoEvents.FireError(0, Resources.SleepTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "SleepInterval", node.GetAttribute("SleepInterval")), string.Empty, 0);
                }
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Loads settings from XML.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="infoEvents">The info events.</param>
 /// <exception cref="System.Exception"></exception>
 void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     try
     {
         //    This might occur if the task's XML has been modified outside of the Business Intelligence
         //    Or SQL Server Workbenches.
         if (node.Name != "PGPTask")
         {
             throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "PGPTask"));
         }
         else
         {
             // let error bubble up
             // populate the private property variables with values from the DTS node.
             this.sourceFile      = node.Attributes.GetNamedItem(CONSTANTS.PGPSOURCEFILE).Value;
             this.targetFile      = node.Attributes.GetNamedItem(CONSTANTS.PGPTARGETFILE).Value;
             this.publicKey       = node.Attributes.GetNamedItem(CONSTANTS.PGPPUBLICKEY).Value;
             this.privateKey      = node.Attributes.GetNamedItem(CONSTANTS.PGPPRIVATEKEY).Value;
             this.passPhrase      = node.Attributes.GetNamedItem(CONSTANTS.PGPPASSPHRASE).Value;
             this.fileAction      = (PGPFileAction)Enum.Parse(typeof(PGPFileAction), node.Attributes.GetNamedItem(CONSTANTS.PGPFILEACTION).Value);
             this.overwriteTarget = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPOVERWRITETARGET).Value);
             this.removeSource    = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPREMOVESOURCE).Value);
             this.isArmored       = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPARMORED).Value);
         }
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Load From XML: ", ex.Message, "", 0);
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Saves settings to XML.
        /// </summary>
        /// <param name="doc">The doc.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            try
            {
                XmlElement taskElement = doc.CreateElement(string.Empty, "ZipTask", string.Empty);
                doc.AppendChild(taskElement);

                taskElement.SetAttribute(CONSTANTS.ZIPFILEACTION, null, this.fileAction.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPCOMPRESSIONTYPE, null, this.compressionType.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPCOMPRESSIONLEVEL, null, this.zipCompressionLevel.ToString());
                taskElement.SetAttribute(CONSTANTS.TARCOMPRESSIONLEVEL, null, this.tarCompressionLevel.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPPASSWORD, null, this.zipPassword);
                taskElement.SetAttribute(CONSTANTS.ZIPSOURCE, null, this.sourceFile);
                taskElement.SetAttribute(CONSTANTS.ZIPTARGET, null, this.targetFile);
                taskElement.SetAttribute(CONSTANTS.ZIPREMOVESOURCE, null, this.removeSource.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPRECURSIVE, null, this.recursive.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPOVERWRITE, null, this.overwriteTarget.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPFILEFILTER, null, this.fileFilter);
                taskElement.SetAttribute(CONSTANTS.ZIPLOGLEVEL, null, this.logLevel.ToString());
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Save To XML: ", ex.Message + ex.StackTrace, "", 0);
            }
        }
Ejemplo n.º 11
0
        public override Microsoft.SqlServer.Dts.Runtime.DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            if (string.IsNullOrEmpty(this._OGRConnectionString))
            {
                infoEvents.FireError(0, "OGR Connection Manager", "No connection information specified", string.Empty, 0);
                return DTSExecResult.Failure;
            }

            return DTSExecResult.Success;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// プロパティ値検証
        /// </summary>
        /// <param name="infoEvents"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        private static bool PropertiesValidate(IDTSInfoEvents infoEvents, params string[] properties)
        {
            if (properties.Any(x => string.IsNullOrEmpty(x)))
            {
                infoEvents.FireError(0, "Dynamics CRM 2011 接続マネージャー", "全てのプロパティに値を入力してください。", string.Empty, 0);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Saves settings to XML.
        /// </summary>
        /// <param name="doc">The doc.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            try
            {
                //create node in the package xml document
                XmlElement taskElement = doc.CreateElement(string.Empty, "PGPTask", string.Empty);

                XmlAttribute sourceAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPSOURCEFILE, string.Empty);
                sourceAttr.Value = this.sourceFile;
                taskElement.Attributes.Append(sourceAttr);

                XmlAttribute targetAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPTARGETFILE, string.Empty);
                targetAttr.Value = this.targetFile;
                taskElement.Attributes.Append(targetAttr);

                XmlAttribute publicAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPUBLICKEY, string.Empty);
                publicAttr.Value = this.publicKey;
                taskElement.Attributes.Append(publicAttr);

                XmlAttribute privateAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPRIVATEKEY, string.Empty);
                privateAttr.Value = this.privateKey;
                taskElement.Attributes.Append(privateAttr);

                XmlAttribute passAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPASSPHRASE, string.Empty);
                passAttr.Value = this.passPhrase;
                taskElement.Attributes.Append(passAttr);

                XmlAttribute fileActionAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPFILEACTION, string.Empty);
                fileActionAttr.Value = this.fileAction.ToString();
                taskElement.Attributes.Append(fileActionAttr);

                XmlAttribute overwriteRemoteAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPOVERWRITETARGET, string.Empty);
                overwriteRemoteAttr.Value = this.overwriteTarget.ToString();
                taskElement.Attributes.Append(overwriteRemoteAttr);

                XmlAttribute removeAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPREMOVESOURCE, string.Empty);
                removeAttr.Value = this.removeSource.ToString();
                taskElement.Attributes.Append(removeAttr);

                XmlAttribute armoredAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPARMORED, string.Empty);
                armoredAttr.Value = this.isArmored.ToString();
                taskElement.Attributes.Append(armoredAttr);

                //add the new element to the package document
                doc.AppendChild(taskElement);
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Save To XML: ", ex.Message + ex.StackTrace, "", 0);
            }
        }
 public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
 {
     if (StringUtil.NullOrEmpty(_host))
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Host cannot be null or empty.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     if (StringUtil.NullOrEmpty(_username))
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Username cannot be null or empty.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     if (StringUtil.NullOrEmpty(_password))
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Password cannot be null or empty.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     if (_port < 0 || _port > 65535)
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Password cannot be null or empty.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     return base.Validate(infoEvents);
 }
Ejemplo n.º 15
0
 public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
 {
     if (StringUtil.NullOrEmpty(_host))
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Host cannot be null or empty.", string.Empty, 0);
         return(DTSExecResult.Failure);
     }
     if (StringUtil.NullOrEmpty(_username))
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Username cannot be null or empty.", string.Empty, 0);
         return(DTSExecResult.Failure);
     }
     if (StringUtil.NullOrEmpty(_password))
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Password cannot be null or empty.", string.Empty, 0);
         return(DTSExecResult.Failure);
     }
     if (_port < 0 || _port > 65535)
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Password cannot be null or empty.", string.Empty, 0);
         return(DTSExecResult.Failure);
     }
     return(base.Validate(infoEvents));
 }
Ejemplo n.º 16
0
        private static void LogCore(IDTSInfoEvents source, LogInfo info)
        {
            switch (info.Type)
            {
            case LogType.Error: source.FireError(info.Code, info.Component, info.MessageAndException(), null, 0); break;

            case LogType.Warning: source.FireWarning(info.Code, info.Component, info.MessageAndException(), null, 0); break;

            case LogType.Information:
            {
                bool fireAgain = false;
                source.FireInformation(info.Code, info.Component, info.MessageAndException(), null, 0, ref fireAgain);
                break;
            };
            }
            ;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Loads settings from XML.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="infoEvents">The info events.</param>
        /// <exception cref="System.Exception"></exception>
        void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
        {
            //TaskProperties prop = this.Properties;

            try
            {
                //    This might occur if the task's XML has been modified outside of the Business Intelligence
                //    Or SQL Server Workbenches.
                if (node.Name != "SFTPTask")
                {
                    throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "SFTPTask"));
                }
                else
                {
                    // let error bubble up
                    // populate the private property variables with values from the DTS node.
                    this.localFile     = node.GetAttribute(CONSTANTS.SFTPLOCALFILE, String.Empty);
                    this.remoteFile    = node.GetAttribute(CONSTANTS.SFTPREMOTEFILE, String.Empty);
                    this.fileAction    = (SFTPFileAction)Enum.Parse(typeof(SFTPFileAction), node.GetAttribute(CONSTANTS.SFTPFILEACTION, String.Empty));
                    this.fileInfo      = node.GetAttribute(CONSTANTS.SFTPFILEINFO, String.Empty);
                    this.overwriteDest = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPOVERWRITEDEST, String.Empty));
                    this.removeSource  = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPREMOVESOURCE, String.Empty));
                    this.isRecursive   = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPISRECURSIVE, String.Empty));
                    this.fileFilter    = node.GetAttribute(CONSTANTS.SFTPFILEFILTER, String.Empty);
                    //this.reTries = Convert.ToInt32(node.GetAttribute(CONSTANTS.SFTPRETRIES, String.Empty));
                    this.hostName               = node.GetAttribute(CONSTANTS.SFTPHOST, String.Empty);
                    this.portNumber             = node.GetAttribute(CONSTANTS.SFTPPORT, String.Empty);
                    this.userName               = node.GetAttribute(CONSTANTS.SFTPUSER, String.Empty);
                    this.passWord               = node.GetAttribute(CONSTANTS.SFTPPASSWORD, String.Empty);
                    this.stopOnFailure          = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPSTOPONFAILURE, String.Empty));
                    this.remoteFileListVariable = node.GetAttribute(CONSTANTS.SFTPREMOTEFILELISTVAR, String.Empty);
                    this.logLevel               = (LogLevel)Enum.Parse(typeof(LogLevel), node.GetAttribute(CONSTANTS.SFTPLOGLEVEL, String.Empty));
                }
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Load From XML: ", ex.Message + Environment.NewLine + ex.StackTrace, "", 0);
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Simple validation. Runtime only!
 /// </summary>
 /// <param name="infoEvents"></param>
 /// <returns></returns>
 public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
 {
     if (string.IsNullOrEmpty(this.HostName) || string.IsNullOrEmpty(this.UserName) || string.IsNullOrEmpty(this.Password))
     {
         infoEvents.FireError(0, "WinSCP Connection Manager", "Hostname, username and password are mandatory.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     else
     {
         return DTSExecResult.Success;
     }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Saves settings to XML.
        /// </summary>
        /// <param name="doc">The doc.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            try
            {
                //create node in the package xml document
                XmlElement taskElement = doc.CreateElement(string.Empty, "PGPTask", string.Empty);

                XmlAttribute sourceAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPSOURCEFILE, string.Empty);
                sourceAttr.Value = this.sourceFile;
                taskElement.Attributes.Append(sourceAttr);

                XmlAttribute targetAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPTARGETFILE, string.Empty);
                targetAttr.Value = this.targetFile;
                taskElement.Attributes.Append(targetAttr);

                XmlAttribute publicAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPUBLICKEY, string.Empty);
                publicAttr.Value = this.publicKey;
                taskElement.Attributes.Append(publicAttr);

                XmlAttribute privateAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPRIVATEKEY, string.Empty);
                privateAttr.Value = this.privateKey;
                taskElement.Attributes.Append(privateAttr);

                XmlAttribute passAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPASSPHRASE, string.Empty);
                passAttr.Value = this.passPhrase;
                taskElement.Attributes.Append(passAttr);

                XmlAttribute fileActionAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPFILEACTION, string.Empty);
                fileActionAttr.Value = this.fileAction.ToString();
                taskElement.Attributes.Append(fileActionAttr);

                XmlAttribute overwriteRemoteAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPOVERWRITETARGET, string.Empty);
                overwriteRemoteAttr.Value = this.overwriteTarget.ToString();
                taskElement.Attributes.Append(overwriteRemoteAttr);

                XmlAttribute removeAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPREMOVESOURCE, string.Empty);
                removeAttr.Value = this.removeSource.ToString();
                taskElement.Attributes.Append(removeAttr);

                XmlAttribute armoredAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPARMORED, string.Empty);
                armoredAttr.Value = this.isArmored.ToString();
                taskElement.Attributes.Append(armoredAttr);

                //add the new element to the package document
                doc.AppendChild(taskElement);
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Save To XML: ", ex.Message + ex.StackTrace, "", 0);
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Loads settings from XML.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="infoEvents">The info events.</param>
 /// <exception cref="System.Exception"></exception>
 void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     try
     {
         //    This might occur if the task's XML has been modified outside of the Business Intelligence
         //    Or SQL Server Workbenches.
         if (node.Name != "PGPTask")
         {
             throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "PGPTask"));
         }
         else
         {
             // let error bubble up
             // populate the private property variables with values from the DTS node.
             this.sourceFile = node.Attributes.GetNamedItem(CONSTANTS.PGPSOURCEFILE).Value;
             this.targetFile = node.Attributes.GetNamedItem(CONSTANTS.PGPTARGETFILE).Value;
             this.publicKey = node.Attributes.GetNamedItem(CONSTANTS.PGPPUBLICKEY).Value;
             this.privateKey = node.Attributes.GetNamedItem(CONSTANTS.PGPPRIVATEKEY).Value;
             this.passPhrase = node.Attributes.GetNamedItem(CONSTANTS.PGPPASSPHRASE).Value;
             this.fileAction = (PGPFileAction)Enum.Parse(typeof(PGPFileAction), node.Attributes.GetNamedItem(CONSTANTS.PGPFILEACTION).Value);
             this.overwriteTarget = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPOVERWRITETARGET).Value);
             this.removeSource = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPREMOVESOURCE).Value);
             this.isArmored = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPARMORED).Value);
         }
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Load From XML: ", ex.Message, "", 0);
     }
 }
Ejemplo n.º 21
0
        public override Microsoft.SqlServer.Dts.Runtime.DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            if (string.IsNullOrEmpty(this._OGRConnectionString))
            {
                infoEvents.FireError(0, "OGR Connection Manager", "No connection information specified", string.Empty, 0);
                return DTSExecResult.Failure;
            }

            return DTSExecResult.Success;
        }
Ejemplo n.º 22
0
        public void LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name == "InnerObject") //OldFormat
            {
                foreach (XmlElement child in node.ChildNodes)
                {
                    string val = child.GetAttribute("Value");

                    switch (child.Name)
                    {
                    case "ExportBinaryData":
                        ExportBinaryData = val == "0" ? false : true;
                        break;

                    case "ExportDataType":
                        ExportDataType = val == "0" ? false : true;
                        break;

                    case "ExportDescription":
                        ExportDescription = val == "0" ? false : true;
                        break;

                    case "ExportValueDataType":
                        ExportValueDataType = val == "0" ? false : true;
                        break;

                    case "ExportVariablePath":
                        ExportVariablePath = val == "0" ? false : true;
                        break;

                    case "RootElementName":
                        RootElementName = val;
                        break;

                    case "VariableElementName":
                        VariableElementName = val;
                        break;

                    case "VariablesToExport":
                        VariablesToExport = val;
                        break;

                    case "XmlSaveOptions":
                        XmlSaveOptions = (SaveOptions)int.Parse(val);
                        break;

                    case "XmlVariable":
                        XmlVariable = val;
                        break;

                    default:
                        break;
                    }
                }
            }
            else if (node.Name == "VaiablesToXmlData") //NewFormat
            {
                if (!bool.TryParse(node.GetAttribute("ExportBinaryData"), out _exportBinaryData))
                {
                    infoEvents.FireError(0, Resources.VariablesToXmlTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "ExportBinaryData", node.GetAttribute("ExportBinaryData")), string.Empty, 0);
                }
                if (!bool.TryParse(node.GetAttribute("ExportDataType"), out _exportDataType))
                {
                    infoEvents.FireError(0, Resources.VariablesToXmlTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "ExportDataType", node.GetAttribute("ExportDataType")), string.Empty, 0);
                }
                if (!bool.TryParse(node.GetAttribute("ExportDescription"), out _exportDescription))
                {
                    infoEvents.FireError(0, Resources.VariablesToXmlTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "ExportDescription", node.GetAttribute("ExportDescription")), string.Empty, 0);
                }
                if (!bool.TryParse(node.GetAttribute("ExportValueDataType"), out _exportValueDataType))
                {
                    infoEvents.FireError(0, Resources.VariablesToXmlTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "ExportValueDataType", node.GetAttribute("ExportValueDataType")), string.Empty, 0);
                }
                if (!bool.TryParse(node.GetAttribute("ExportVariablePath"), out _exportVariablePath))
                {
                    infoEvents.FireError(0, Resources.VariablesToXmlTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "ExportVariablePath", node.GetAttribute("ExportVariablePath")), string.Empty, 0);
                }

                try
                {
                    XmlSaveOptions = (SaveOptions)Enum.Parse(typeof(SaveOptions), node.GetAttribute("XmlSaveOptions"));
                }
                catch
                {
                    infoEvents.FireError(0, Resources.VariablesToXmlTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "XmlSaveOptions", node.GetAttribute("XmlSaveOptions")), string.Empty, 0);
                }

                RootElementName     = node.GetAttribute("RootElementName");
                VariableElementName = node.GetAttribute("VariableElementName");
                VariablesToExport   = node.GetAttribute("VariablesToExport");
                XmlVariable         = node.GetAttribute("XmlVariable");
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Deserializes teh WaitForFile settings from XML
        /// </summary>
        /// <param name="node"></param>
        /// <param name="infoEvents"></param>
        void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name == "WaitForFilesData")
            {
                if (node.HasAttributes) // new Format;
                {
                    WaitForFile.ChekFileType chType;
                    if (Enum.TryParse <WaitForFile.ChekFileType>(node.GetAttribute("checkType"), out chType))
                    {
                        this.CheckType = chType;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckType", node.GetAttribute("checkType")), string.Empty, 0);
                    }

                    WaitForFile.FileExistenceType existenceType;

                    if (Enum.TryParse <WaitForFile.FileExistenceType>(node.GetAttribute("existenceType"), out existenceType))
                    {
                        this.ExistenceType = existenceType;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "ExistenceType", node.GetAttribute("existenceType")), string.Empty, 0);
                    }

                    TimeSpan ts;
                    if (TimeSpan.TryParse(node.GetAttribute("checkTimeoutInterval"), out ts))
                    {
                        this.checkTimeoutInterval = ts;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckTimeout", node.GetAttribute("checkTimeoutInterval")), string.Empty, 0);
                    }

                    TimeSpan tst;
                    if (TimeSpan.TryParse(node.GetAttribute("checkTimeoutTime"), out tst))
                    {
                        this.checkTimeoutTime = tst;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckTimeout", node.GetAttribute("checkTimeoutTime")), string.Empty, 0);
                    }

                    int chkInterval;

                    if (int.TryParse(node.GetAttribute("checkInterval"), out chkInterval))
                    {
                        this.CheckInterval = chkInterval;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckInterval", node.GetAttribute("checkInterval")), string.Empty, 0);
                    }


                    bool timeoutNextDay;
                    if (bool.TryParse(node.GetAttribute("timeoutNextDayIfTimePassed"), out timeoutNextDay))
                    {
                        this.TimeoutNextDayIfTimePassed = timeoutNextDay;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "TimeoutNextDayIfTimePassed", node.GetAttribute("timeoutNextDayIfTimePassed")), string.Empty, 0);
                    }


                    foreach (XmlElement nodeData in node.ChildNodes)
                    {
                        if (nodeData.Name == "checkFiles")
                        {
                            List <string> fls = new List <string>();
                            foreach (XmlElement nd in nodeData.ChildNodes)
                            {
                                if (nd.Name == "file")
                                {
                                    fls.Add(nd.GetAttribute("name"));
                                }
                            }

                            FilesToCheck = string.Join <string>("|", fls);
                        }
                    }
                }
                else //old format
                {
                    foreach (XmlNode nodeData in node.ChildNodes)
                    {
                        switch (nodeData.Name)
                        {
                        case "checkType":
                            WaitForFile.ChekFileType chType;
                            if (Enum.TryParse <WaitForFile.ChekFileType>(nodeData.InnerText, out chType))
                            {
                                this.CheckType = chType;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckType", node.InnerText), string.Empty, 0);
                            }
                            break;

                        case "existenceType":
                            WaitForFile.FileExistenceType existenceType;

                            if (Enum.TryParse <WaitForFile.FileExistenceType>(nodeData.InnerText, out existenceType))
                            {
                                this.ExistenceType = existenceType;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "ExistenceType", node.InnerText), string.Empty, 0);
                            }
                            break;

                        case "checkTimeoutInterval":
                            TimeSpan ts;
                            if (TimeSpan.TryParse(nodeData.InnerText, out ts))
                            {
                                this.checkTimeoutInterval = ts;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckTimeout", node.InnerText), string.Empty, 0);
                            }
                            break;

                        case "checkTimeoutTime":
                            TimeSpan tst;
                            if (TimeSpan.TryParse(nodeData.InnerText, out tst))
                            {
                                this.checkTimeoutTime = tst;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckTimeout", node.InnerText), string.Empty, 0);
                            }
                            break;

                        case "checkInterval":
                            int chkInterval;

                            if (int.TryParse(nodeData.InnerText, out chkInterval))
                            {
                                this.CheckInterval = chkInterval;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckInterval", node.InnerText), string.Empty, 0);
                            }
                            break;

                        case "timeoutNextDayIfTimePassed":
                            bool timeoutNextDay;
                            if (bool.TryParse(nodeData.InnerText, out timeoutNextDay))
                            {
                                this.TimeoutNextDayIfTimePassed = timeoutNextDay;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "TimeoutNextDayIfTimePassed", node.InnerText), string.Empty, 0);
                            }
                            break;

                        case "checkFiles":
                            List <string> fls = new List <string>();
                            foreach (XmlNode nd in nodeData.ChildNodes)
                            {
                                if (nd.Name == "file")
                                {
                                    fls.Add(nd.InnerText);
                                }
                            }

                            FilesToCheck = string.Join <string>("|", fls);
                            break;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// プロパティ値検証
        /// </summary>
        /// <param name="infoEvents"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        private static bool PropertiesValidate(IDTSInfoEvents infoEvents, params string[] properties)
        {
            if (properties.Any(x => string.IsNullOrEmpty(x)))
            {
                infoEvents.FireError(0, "Dynamics CRM 2011 接続マネージャー", "全てのプロパティに値を入力してください。", string.Empty, 0);
                return false;
            }

            return true;
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Loads settings from XML.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="infoEvents">The info events.</param>
 /// <exception cref="System.Exception"></exception>
 void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     try
     {
         //    This might occur if the task's XML has been modified outside of the Business Intelligence
         //    Or SQL Server Workbenches.
         if (node.Name != "ZipTask")
         {
             throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "ZipTask"));
         }
         else
         {
             // let error bubble up
             // populate the private property variables with values from the DTS node.
             this.fileAction = (ZipFileAction)Enum.Parse(typeof(ZipFileAction), node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEACTION).Value);
             this.compressionType = (CompressionType)Enum.Parse(typeof(CompressionType), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONTYPE).Value);
             this.zipCompressionLevel = (ZipCompressionLevel)Enum.Parse(typeof(ZipCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONLEVEL).Value);
             this.tarCompressionLevel = (TarCompressionLevel)Enum.Parse(typeof(TarCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.TARCOMPRESSIONLEVEL).Value);
             this.sourceFile = node.Attributes.GetNamedItem(CONSTANTS.ZIPSOURCE).Value;
             this.zipPassword = node.Attributes.GetNamedItem(CONSTANTS.ZIPPASSWORD).Value;
             this.targetFile = node.Attributes.GetNamedItem(CONSTANTS.ZIPTARGET).Value;
             this.removeSource = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPREMOVESOURCE).Value);
             this.recursive = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPRECURSIVE).Value);
             this.overwriteTarget = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPOVERWRITE).Value);
             this.fileFilter = node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEFILTER).Value;
             this.logLevel = (LogLevel)Enum.Parse(typeof(LogLevel), node.GetAttribute(CONSTANTS.SFTPLOGLEVEL, String.Empty));
         }
     }
     catch (Exception ex)
     {                
         infoEvents.FireError(0, "Load From XML: ", ex.Message, "", 0);
     }
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Saves settings to XML.
 /// </summary>
 /// <param name="doc">The doc.</param>
 /// <param name="infoEvents">The info events.</param>
 void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
 {
     try
     {
         //create node in the package xml document
         XmlElement taskElement = doc.CreateElement(string.Empty, "SFTPTask", string.Empty);
         doc.AppendChild(taskElement);
         taskElement.SetAttribute(CONSTANTS.SFTPLOCALFILE, null, this.localFile);
         taskElement.SetAttribute(CONSTANTS.SFTPREMOTEFILE, null, this.remoteFile);
         taskElement.SetAttribute(CONSTANTS.SFTPFILEACTION, null, this.fileAction.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPFILEINFO, null, this.fileInfo);
         taskElement.SetAttribute(CONSTANTS.SFTPOVERWRITEDEST, null, this.overwriteDest.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPREMOVESOURCE, null, this.removeSource.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPISRECURSIVE, null, this.isRecursive.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPFILEFILTER, null, this.fileFilter);
         //taskElement.SetAttribute(CONSTANTS.SFTPRETRIES, null, this.reTries.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPHOST, null, this.hostName);
         taskElement.SetAttribute(CONSTANTS.SFTPPORT, null, this.portNumber);
         taskElement.SetAttribute(CONSTANTS.SFTPUSER, null, this.userName);
         taskElement.SetAttribute(CONSTANTS.SFTPPASSWORD, null, this.passWord);
         taskElement.SetAttribute(CONSTANTS.SFTPSTOPONFAILURE, null, this.stopOnFailure.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPREMOTEFILELISTVAR, null, this.remoteFileListVariable);
         taskElement.SetAttribute(CONSTANTS.SFTPLOGLEVEL, null, this.logLevel.ToString());
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Save To XML: ", ex.Message + Environment.NewLine + ex.StackTrace, "", 0);
     }
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Loads settings from XML.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="infoEvents">The info events.</param>
        /// <exception cref="System.Exception"></exception>
        void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
        {
            //TaskProperties prop = this.Properties;

            try
            {
                //    This might occur if the task's XML has been modified outside of the Business Intelligence
                //    Or SQL Server Workbenches.
                if (node.Name != "SFTPTask")
                {
                    throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "SFTPTask"));
                }
                else
                {
                    // let error bubble up
                    // populate the private property variables with values from the DTS node.
                    this.localFile = node.GetAttribute(CONSTANTS.SFTPLOCALFILE, String.Empty);
                    this.remoteFile = node.GetAttribute(CONSTANTS.SFTPREMOTEFILE, String.Empty);
                    this.fileAction = (SFTPFileAction)Enum.Parse(typeof(SFTPFileAction), node.GetAttribute(CONSTANTS.SFTPFILEACTION, String.Empty));
                    this.fileInfo = node.GetAttribute(CONSTANTS.SFTPFILEINFO, String.Empty);
                    this.overwriteDest = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPOVERWRITEDEST, String.Empty));
                    this.removeSource = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPREMOVESOURCE, String.Empty));
                    this.isRecursive = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPISRECURSIVE, String.Empty));
                    this.fileFilter = node.GetAttribute(CONSTANTS.SFTPFILEFILTER, String.Empty);
                    //this.reTries = Convert.ToInt32(node.GetAttribute(CONSTANTS.SFTPRETRIES, String.Empty));
                    this.hostName = node.GetAttribute(CONSTANTS.SFTPHOST, String.Empty);
                    this.portNumber = node.GetAttribute(CONSTANTS.SFTPPORT, String.Empty);
                    this.userName = node.GetAttribute(CONSTANTS.SFTPUSER, String.Empty);
                    this.passWord = node.GetAttribute(CONSTANTS.SFTPPASSWORD, String.Empty);
                    this.stopOnFailure = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPSTOPONFAILURE, String.Empty));
                    this.remoteFileListVariable = node.GetAttribute(CONSTANTS.SFTPREMOTEFILELISTVAR, String.Empty);
                    this.logLevel = (LogLevel)Enum.Parse(typeof(LogLevel), node.GetAttribute(CONSTANTS.SFTPLOGLEVEL, String.Empty));
                }
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Load From XML: ", ex.Message + Environment.NewLine + ex.StackTrace, "", 0);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Saves settings to XML.
        /// </summary>
        /// <param name="doc">The doc.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            try
            {
                XmlElement taskElement = doc.CreateElement(string.Empty, "ZipTask", string.Empty);
                doc.AppendChild(taskElement);

                taskElement.SetAttribute(CONSTANTS.ZIPFILEACTION, null, this.fileAction.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPCOMPRESSIONTYPE, null, this.compressionType.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPCOMPRESSIONLEVEL, null, this.zipCompressionLevel.ToString());
                taskElement.SetAttribute(CONSTANTS.TARCOMPRESSIONLEVEL, null, this.tarCompressionLevel.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPPASSWORD, null, this.zipPassword);
                taskElement.SetAttribute(CONSTANTS.ZIPSOURCE, null, this.sourceFile);
                taskElement.SetAttribute(CONSTANTS.ZIPTARGET, null, this.targetFile);
                taskElement.SetAttribute(CONSTANTS.ZIPREMOVESOURCE, null, this.removeSource.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPRECURSIVE, null, this.recursive.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPOVERWRITE, null, this.overwriteTarget.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPFILEFILTER, null, this.fileFilter);
                taskElement.SetAttribute(CONSTANTS.ZIPLOGLEVEL, null, this.logLevel.ToString());
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Save To XML: ", ex.Message + ex.StackTrace, "", 0);
            }
        }