public Ftp(XElement xe, Workflow wf) : base(xe, wf) { string server = this.GetSetting("server"); int port = int.Parse(this.GetSetting("port")); string user = this.GetSetting("user"); string password = this.GetSetting("password"); string path = this.GetSetting("path"); Protocol protocol = (Protocol)Enum.Parse(typeof(Protocol), this.GetSetting("protocol"), true); switch (protocol) { case Protocol.FTP: _plugin = new PluginFTP(this, server, port, user, password, path); break; case Protocol.FTPS: EncryptionMode encryptionMode = (EncryptionMode)Enum.Parse(typeof(EncryptionMode), this.GetSetting("encryption"), true); _plugin = new PluginFTPS(this, server, port, user, password, path, encryptionMode); break; case Protocol.SFTP: string privateKeyPath = this.GetSetting("privateKeyPath", string.Empty); string passphrase = this.GetSetting("passphrase", string.Empty); _plugin = new PluginSFTP(this, server, port, user, password, path, privateKeyPath, passphrase); break; } this._cmd = (FtpCommad)Enum.Parse(typeof(FtpCommad), this.GetSetting("command"), true); this._retryCount = int.Parse(this.GetSetting("retryCount", "3")); this._retryTimeout = int.Parse(this.GetSetting("retryTimeout", "1500")); }
public Ftp(XElement xe, Workflow wf) : base(xe, wf) { var server = GetSetting("server"); var port = int.Parse(GetSetting("port")); var user = GetSetting("user"); var password = GetSetting("password"); var path = GetSetting("path"); var protocol = (Protocol)Enum.Parse(typeof(Protocol), GetSetting("protocol"), true); switch (protocol) { case Protocol.Ftp: _plugin = new PluginFtp(this, server, port, user, password, path); break; case Protocol.Ftps: var encryptionMode = (EncryptionMode)Enum.Parse(typeof(EncryptionMode), GetSetting("encryption"), true); _plugin = new PluginFtps(this, server, port, user, password, path, encryptionMode); break; case Protocol.Sftp: var privateKeyPath = GetSetting("privateKeyPath", string.Empty); var passphrase = GetSetting("passphrase", string.Empty); _plugin = new PluginSftp(this, server, port, user, password, path, privateKeyPath, passphrase); break; } _cmd = (FtpCommad)Enum.Parse(typeof(FtpCommad), GetSetting("command"), true); _retryCount = int.Parse(GetSetting("retryCount", "3")); _retryTimeout = int.Parse(GetSetting("retryTimeout", "1500")); SmbComputerName = GetSetting("smbComputerName"); SmbDomain = GetSetting("smbDomain"); SmbUsername = GetSetting("smbUsername"); SmbPassword = GetSetting("smbPassword"); }
public ProtocolBase(Protocol protocol, FtpCommad cmd) { string server = ConfigurationManager.AppSettings["FtpServer"]; int port = int.Parse(ConfigurationManager.AppSettings["FtpPort"]); string user = ConfigurationManager.AppSettings["FtpUser"]; string password = ConfigurationManager.AppSettings["FtpPassword"]; string path = ConfigurationManager.AppSettings["FtpPart"]; switch (protocol) { case Protocol.Ftp: _ftp = new ProtocolFTP(server, port, user, password, path); break; case Protocol.Ftps: EncryptionMode encryptionMode = (EncryptionMode)Enum.Parse(typeof(EncryptionMode), ConfigurationManager.AppSettings["FtpEncryption"], true); _ftp = new ProtocolFTPS(server, port, user, password, path, encryptionMode); break; case Protocol.Sftp: string privateKeyPath = ConfigurationManager.AppSettings["FtpPrivateKeyPath"]; string passphrase = ConfigurationManager.AppSettings["FtpPassphrase"]; _ftp = new ProtocolSFTP(server, port, user, password, path, privateKeyPath, passphrase); break; } _cmd = cmd; _retryCount = int.Parse(ConfigurationManager.AppSettings["FtpRetry"]); _retryTimeout = int.Parse(ConfigurationManager.AppSettings["FtpTimeout"]); }