/// <summary> /// Initializes a new instance of the <see cref="PasswordConnectionInfo"/> class. /// </summary> /// <param name="host">Connection host.</param> /// <param name="port">The port.</param> /// <param name="username">Connection username.</param> /// <param name="password">Connection password.</param> /// <param name="proxyType">Type of the proxy.</param> /// <param name="proxyHost">The proxy host.</param> /// <param name="proxyPort">The proxy port.</param> /// <param name="proxyUsername">The proxy username.</param> /// <param name="proxyPassword">The proxy password.</param> public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword) : base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PasswordAuthenticationMethod(username, password)) { foreach (var authenticationMethod in AuthenticationMethods.OfType <PasswordAuthenticationMethod>()) { authenticationMethod.PasswordExpired += AuthenticationMethod_PasswordExpired; } }
/// <summary> /// Initializes a new instance of the <see cref="KeyboardInteractiveConnectionInfo"/> class. /// </summary> /// <param name="host">Connection host.</param> /// <param name="port">Connection port.</param> /// <param name="username">Connection username.</param> /// <param name="proxyType">Type of the proxy.</param> /// <param name="proxyHost">The proxy host.</param> /// <param name="proxyPort">The proxy port.</param> /// <param name="proxyUsername">The proxy username.</param> /// <param name="proxyPassword">The proxy password.</param> public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword) : base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new KeyboardInteractiveAuthenticationMethod(username)) { foreach (var authenticationMethod in AuthenticationMethods.OfType <KeyboardInteractiveAuthenticationMethod>()) { authenticationMethod.AuthenticationPrompt += AuthenticationMethod_AuthenticationPrompt; } }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (_isDisposed) { return; } if (disposing) { if (AuthenticationMethods != null) { foreach (var authenticationMethods in AuthenticationMethods.OfType <IDisposable>()) { authenticationMethods.Dispose(); } } _isDisposed = true; } }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!_isDisposed) { // If disposing equals true, dispose all managed // and unmanaged resources. if (disposing) { // Dispose managed resources. if (AuthenticationMethods != null) { foreach (var authenticationMethods in AuthenticationMethods.OfType <IDisposable>()) { authenticationMethods.Dispose(); } } } // Note disposing has been done. _isDisposed = true; } }