public void Dispose() { if (_provider != null) { if (_provider.IsConnected) { _provider.Disconnect(); } _provider.Dispose(); _provider = null; } }
public void Upload() { _logger.Trace(m => m($"Started processing SFTP ")); var adapter = new SftpAdapter(_appSettings.GetAppSettingValue("sftpAdapterName")); _provider = new SftpProvider(adapter); bool deleteSourceFile; Boolean.TryParse(_appSettings.GetAppSettingValue("sftpDeleteSourceFile"), out deleteSourceFile); _logger.Trace(m => m($"Started uploading file from application to SFTP ")); _provider.UploadFolder(_appSettings.SftpFolderLocation, "*.tmp", SearchOption.TopDirectoryOnly, ".", SftpCallbacks.StripFinalExtensionCallback, deleteSourceFile); _logger.Trace(m => m($"Finished SFTP upload")); _logger.Trace(m => m($"Finished processing SFTP ")); }