public Sftp(string host, string user, string password, string identityFile, string identityThumbprint, int port, string passphrase, bool debugTrace, string proxyHost, int proxyPort, string proxyUserName, string proxyPassword) { if (string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(identityFile)) { password = null; } this._applicationStorage = ApplicationStorageHelper.Load(); this._sftp = new SshTransfer(host, user, password); this._identityFile = identityFile; this._identityThumbprint = identityThumbprint; this._host = host; this._user = user; this._password = password; this._port = port; this._passphrase = passphrase; this.DebugTrace = debugTrace; this._proxyHost = proxyHost; this._proxyPort = proxyPort; this._proxyUserName = proxyUserName; this._proxyPassword = proxyPassword; }
/// <summary> /// Disconnects from sever /// </summary> public void Disconnect() { if (this.DebugTrace) { Trace.WriteLine("[SftpConnectionPool] Disconnecting from " + _host); } try { if (this._sftp.Connected) { this._sftp.Close(); this._sftp = new SshTransfer(this._host, this._user, this._password); } } catch (Exception ex) { throw ExceptionHandling.HandleComponentException(System.Reflection.MethodBase.GetCurrentMethod(), ex); } finally { RaiseOnDisconnect(); } }