浏览代码

Remove this qualifier.
Simplify code.

drieseng 9 年之前
父节点
当前提交
3a48cde559
共有 1 个文件被更改,包括 14 次插入20 次删除
  1. 14 20
      src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs

+ 14 - 20
src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs

@@ -28,7 +28,7 @@ namespace Renci.SshNet
         /// <param name="host">The host.</param>
         /// <param name="host">The host.</param>
         /// <param name="username">The username.</param>
         /// <param name="username">The username.</param>
         public KeyboardInteractiveConnectionInfo(string host, string username)
         public KeyboardInteractiveConnectionInfo(string host, string username)
-            : this(host, ConnectionInfo.DefaultPort, username, ProxyTypes.None, string.Empty, 0, string.Empty, string.Empty)
+            : this(host, DefaultPort, username, ProxyTypes.None, string.Empty, 0, string.Empty, string.Empty)
         {
         {
 
 
         }
         }
@@ -83,7 +83,7 @@ namespace Renci.SshNet
         /// <param name="proxyHost">The proxy host.</param>
         /// <param name="proxyHost">The proxy host.</param>
         /// <param name="proxyPort">The proxy port.</param>
         /// <param name="proxyPort">The proxy port.</param>
         public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort)
         public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort)
-            : this(host, ConnectionInfo.DefaultPort, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
+            : this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
         {
         {
         }
         }
 
 
@@ -97,7 +97,7 @@ namespace Renci.SshNet
         /// <param name="proxyPort">The proxy port.</param>
         /// <param name="proxyPort">The proxy port.</param>
         /// <param name="proxyUsername">The proxy username.</param>
         /// <param name="proxyUsername">The proxy username.</param>
         public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
         public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
-            : this(host, ConnectionInfo.DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
+            : this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
         {
         {
         }
         }
 
 
@@ -112,7 +112,7 @@ namespace Renci.SshNet
         /// <param name="proxyUsername">The proxy username.</param>
         /// <param name="proxyUsername">The proxy username.</param>
         /// <param name="proxyPassword">The proxy password.</param>
         /// <param name="proxyPassword">The proxy password.</param>
         public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
         public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
-            : this(host, ConnectionInfo.DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
+            : this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
         {
         {
         }
         }
 
 
@@ -130,7 +130,7 @@ namespace Renci.SshNet
         public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
         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))
             : base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new KeyboardInteractiveAuthenticationMethod(username))
         {
         {
-            foreach (var authenticationMethod in this.AuthenticationMethods.OfType<KeyboardInteractiveAuthenticationMethod>())
+            foreach (var authenticationMethod in AuthenticationMethods.OfType<KeyboardInteractiveAuthenticationMethod>())
             {
             {
                 authenticationMethod.AuthenticationPrompt += AuthenticationMethod_AuthenticationPrompt;
                 authenticationMethod.AuthenticationPrompt += AuthenticationMethod_AuthenticationPrompt;
             }
             }
@@ -139,9 +139,9 @@ namespace Renci.SshNet
 
 
         private void AuthenticationMethod_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
         private void AuthenticationMethod_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
         {
         {
-            if (this.AuthenticationPrompt != null)
+            if (AuthenticationPrompt != null)
             {
             {
-                this.AuthenticationPrompt(sender, e);
+                AuthenticationPrompt(sender, e);
             }
             }
         }
         }
 
 
@@ -156,7 +156,6 @@ namespace Renci.SshNet
         public void Dispose()
         public void Dispose()
         {
         {
             Dispose(true);
             Dispose(true);
-
             GC.SuppressFinalize(this);
             GC.SuppressFinalize(this);
         }
         }
 
 
@@ -166,24 +165,19 @@ namespace Renci.SshNet
         /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
         /// <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)
         protected virtual void Dispose(bool disposing)
         {
         {
-            // Check to see if Dispose has already been called.
-            if (!this._isDisposed)
+            if (_isDisposed)
+                return;
+
+            if (disposing)
             {
             {
-                // If disposing equals true, dispose all managed
-                // and unmanaged resources.
-                if (disposing)
+                if (AuthenticationMethods != null)
                 {
                 {
-                    // Dispose managed resources.
-                    if (this.AuthenticationMethods != null)
+                    foreach (var authenticationMethods in AuthenticationMethods.OfType<IDisposable>())
                     {
                     {
-                        foreach (var authenticationMethods in this.AuthenticationMethods.OfType<IDisposable>())
-                        {
-                            authenticationMethods.Dispose();
-                        }
+                        authenticationMethods.Dispose();
                     }
                     }
                 }
                 }
 
 
-                // Note disposing has been done.
                 _isDisposed = true;
                 _isDisposed = true;
             }
             }
         }
         }