public SharpZipArchiver( ITempFileStreamFactory tempFileStreamFactory, TempFileOptions tempFileOptions) { _tempFileStreamFactory = tempFileStreamFactory; _tempFileOptions = tempFileOptions; _arrayPool = ArrayPool <byte> .Create(); }
public SftpClient( SftpClientOptions options, ITempFileStreamFactory tempFileStreamFactory, ILoggerFactory loggerFactory) { _tempFileStreamFactory = tempFileStreamFactory ?? throw new ArgumentNullException(nameof(tempFileStreamFactory)); if (loggerFactory == null) { throw new ArgumentNullException(nameof(loggerFactory)); } _logger = loggerFactory.CreateLogger <SftpClient>(); if (options == null) { throw new ArgumentNullException(nameof(options)); } var timeout = TimeSpan.FromSeconds(options.RetryTimeoutSec); var policyBase = Policy .Handle <SocketException>() .Or <SshConnectionException>() .Or <SshException>() .Or <ProxyException>(); _retryAsyncPolicy = policyBase .WaitAndRetryAsync( options.RetryCount, i => timeout, (ex, innerTimeout, retryCount, context) => { _logger.LogWarning( $"Error occured while uploading to CDN. Retry # {retryCount} will started after {innerTimeout.TotalSeconds} sec"); }); _retryPolicy = policyBase .WaitAndRetry( options.RetryCount, i => timeout, (ex, innerTimeout, retryCount, context) => { _logger.LogWarning( $"Error occured while uploading to CDN. Retry # {retryCount} will started after {innerTimeout.TotalSeconds} sec"); }); var authMethods = ComposeAuthMethods(options); var connectionInfo = new ConnectionInfo( host: options.SshServer, port: options.SshPort, username: options.SshLogin, authenticationMethods: authMethods); _sftpClient = new Renci.SshNet.SftpClient(connectionInfo); }
public SftpClientFactory( SftpClientOptions options, ITempFileStreamFactory tempFileStreamFactory, ILoggerFactory loggerFactory) { _options = options ?? throw new ArgumentNullException(nameof(options)); _options.AssertValid(); _tempFileStreamFactory = tempFileStreamFactory ?? throw new ArgumentNullException(nameof(tempFileStreamFactory)); _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); }