public static ConnectionInfo CreateConnectionInfo(this ISftpConnectionInfo info) { var authenticationMethods = new List <AuthenticationMethod>(); if (!string.IsNullOrWhiteSpace(info.Password)) { authenticationMethods.Add(new PasswordAuthenticationMethod(info.Login, info.Password)); } if (!string.IsNullOrWhiteSpace(info.PrivateKey)) { var privateKeyStream = info.PrivateKey.ToStream(); if (string.IsNullOrWhiteSpace(info.PrivateKeyPassPhrase)) { authenticationMethods.Add(new PrivateKeyAuthenticationMethod(info.Login, new PrivateKeyFile(privateKeyStream))); } else { authenticationMethods.Add(new PrivateKeyAuthenticationMethod(info.Login, new PrivateKeyFile(privateKeyStream, info.PrivateKeyPassPhrase))); } } return(new ConnectionInfo( info.Server, info.PortNumber, info.Login, authenticationMethods.ToArray() )); }
public SftpFileValue(ISftpConnectionInfo connectionInfo, string folder, string fileName, string connectorCode, string connectionName, string connectorName) : base(new SftpFileValueMetadata { Server = connectionInfo.Server, Folder = folder, Name = fileName, ConnectorCode = connectorCode, ConnectionName = connectionName, ConnectorName = connectorName }) => (Name, _folder, _connectionInfo) = (fileName, folder, connectionInfo);
public SftpFileValue(ISftpConnectionInfo connectionInfo, string folder, string fileName) : this(connectionInfo, folder, fileName, null, null, null) { }