Parcourir la source

Fix compiler and (correct) resharper warnings across the solution.

Gert Driesen il y a 11 ans
Parent
commit
cd640aa1cd
100 fichiers modifiés avec 164 ajouts et 435 suppressions
  1. 2 1
      Renci.SshClient/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj
  2. 2 1
      Renci.SshClient/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj
  3. 4 5
      Renci.SshClient/Renci.SshNet.Silverlight/Session.SilverlightShared.cs
  4. 2 1
      Renci.SshClient/Renci.SshNet.Silverlight5/Renci.SshNet.Silverlight5.csproj
  5. 4 4
      Renci.SshClient/Renci.SshNet.Silverlight5/Session.SilverlightShared.cs
  6. 2 2
      Renci.SshClient/Renci.SshNet.Tests.NET35/Renci.SshNet.Tests.NET35.csproj
  7. 1 1
      Renci.SshClient/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
  8. 1 0
      Renci.SshClient/Renci.SshNet.WindowsPhone/Renci.SshNet.WindowsPhone.csproj
  9. 2 1
      Renci.SshClient/Renci.SshNet.WindowsPhone8/Renci.SshNet.WindowsPhone8.csproj
  10. 0 2
      Renci.SshClient/Renci.SshNet/AuthenticationMethod.cs
  11. 1 6
      Renci.SshClient/Renci.SshNet/AuthenticationResult.cs
  12. 3 8
      Renci.SshClient/Renci.SshNet/BaseClient.cs
  13. 3 4
      Renci.SshClient/Renci.SshNet/Channels/Channel.cs
  14. 2 3
      Renci.SshClient/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs
  15. 1 4
      Renci.SshClient/Renci.SshNet/Channels/ChannelDirectTcpip.cs
  16. 1 6
      Renci.SshClient/Renci.SshNet/Channels/ChannelForwardedTcpip.NET40.cs
  17. 2 4
      Renci.SshClient/Renci.SshNet/Channels/ChannelForwardedTcpip.cs
  18. 1 3
      Renci.SshClient/Renci.SshNet/Channels/ChannelSession.cs
  19. 0 2
      Renci.SshClient/Renci.SshNet/CipherInfo.cs
  20. 2 5
      Renci.SshClient/Renci.SshNet/Common/ASCIIEncoding.cs
  21. 4 3
      Renci.SshClient/Renci.SshNet/Common/AsyncResult.cs
  22. 1 6
      Renci.SshClient/Renci.SshNet/Common/AuthenticationBannerEventArgs.cs
  23. 0 4
      Renci.SshClient/Renci.SshNet/Common/AuthenticationEventArgs.cs
  24. 1 6
      Renci.SshClient/Renci.SshNet/Common/AuthenticationPasswordChangeEventArgs.cs
  25. 1 6
      Renci.SshClient/Renci.SshNet/Common/AuthenticationPrompt.cs
  26. 1 4
      Renci.SshClient/Renci.SshNet/Common/AuthenticationPromptEventArgs.cs
  27. 4 8
      Renci.SshClient/Renci.SshNet/Common/BigInteger.cs
  28. 4 8
      Renci.SshClient/Renci.SshNet/Common/DerData.cs
  29. 0 3
      Renci.SshClient/Renci.SshNet/Common/ExceptionEventArgs.cs
  30. 0 3
      Renci.SshClient/Renci.SshNet/Common/Extensions.NET.cs
  31. 27 38
      Renci.SshClient/Renci.SshNet/Common/Extensions.cs
  32. 0 3
      Renci.SshClient/Renci.SshNet/Common/HostKeyEventArgs.cs
  33. 0 4
      Renci.SshClient/Renci.SshNet/Common/NetConfServerException.NET40.cs
  34. 0 5
      Renci.SshClient/Renci.SshNet/Common/NetConfServerException.cs
  35. 0 3
      Renci.SshClient/Renci.SshNet/Common/ObjectIdentifier.cs
  36. 2 2
      Renci.SshClient/Renci.SshNet/Common/PipeStream.cs
  37. 2 6
      Renci.SshClient/Renci.SshNet/Common/ProxyException.NET40.cs
  38. 0 5
      Renci.SshClient/Renci.SshNet/Common/ProxyException.cs
  39. 0 3
      Renci.SshClient/Renci.SshNet/Common/ScpDownloadEventArgs.cs
  40. 0 4
      Renci.SshClient/Renci.SshNet/Common/ScpException.NET40.cs
  41. 0 3
      Renci.SshClient/Renci.SshNet/Common/ScpException.cs
  42. 0 3
      Renci.SshClient/Renci.SshNet/Common/ScpUploadEventArgs.cs
  43. 2 5
      Renci.SshClient/Renci.SshNet/Common/SemaphoreLight.cs
  44. 0 4
      Renci.SshClient/Renci.SshNet/Common/SftpPathNotFoundException.NET40.cs
  45. 0 5
      Renci.SshClient/Renci.SshNet/Common/SftpPathNotFoundException.cs
  46. 0 4
      Renci.SshClient/Renci.SshNet/Common/SftpPermissionDeniedException.NET40.cs
  47. 0 5
      Renci.SshClient/Renci.SshNet/Common/SftpPermissionDeniedException.cs
  48. 0 3
      Renci.SshClient/Renci.SshNet/Common/ShellDataEventArgs.cs
  49. 0 4
      Renci.SshClient/Renci.SshNet/Common/SshAuthenticationException.NET40.cs
  50. 0 3
      Renci.SshClient/Renci.SshNet/Common/SshAuthenticationException.cs
  51. 0 12
      Renci.SshClient/Renci.SshNet/Common/SshConnectionException.NET40.cs
  52. 12 4
      Renci.SshClient/Renci.SshNet/Common/SshData.cs
  53. 0 17
      Renci.SshClient/Renci.SshNet/Common/SshException.NET40.cs
  54. 0 4
      Renci.SshClient/Renci.SshNet/Common/SshOperationTimeoutException.NET40.cs
  55. 0 2
      Renci.SshClient/Renci.SshNet/Common/SshOperationTimeoutException.cs
  56. 0 4
      Renci.SshClient/Renci.SshNet/Common/SshPassPhraseNullOrEmptyException.NET40.cs
  57. 0 4
      Renci.SshClient/Renci.SshNet/Common/SshPassPhraseNullOrEmptyException.cs
  58. 1 6
      Renci.SshClient/Renci.SshNet/Common/TerminalModes.cs
  59. 2 3
      Renci.SshClient/Renci.SshNet/Compression/Compressor.cs
  60. 1 5
      Renci.SshClient/Renci.SshNet/Compression/Zlib.cs
  61. 1 5
      Renci.SshClient/Renci.SshNet/Compression/ZlibOpenSsh.cs
  62. 1 5
      Renci.SshClient/Renci.SshNet/Compression/ZlibStream.cs
  63. 0 4
      Renci.SshClient/Renci.SshNet/ConnectionInfo.cs
  64. 0 3
      Renci.SshClient/Renci.SshNet/ExpectAction.cs
  65. 0 2
      Renci.SshClient/Renci.SshNet/ExpectAsyncResult.cs
  66. 4 5
      Renci.SshClient/Renci.SshNet/ForwardedPortDynamic.NET.cs
  67. 1 2
      Renci.SshClient/Renci.SshNet/ForwardedPortDynamic.NET40.cs
  68. 1 4
      Renci.SshClient/Renci.SshNet/ForwardedPortDynamic.cs
  69. 0 1
      Renci.SshClient/Renci.SshNet/ForwardedPortLocal.NET.cs
  70. 1 2
      Renci.SshClient/Renci.SshNet/ForwardedPortLocal.NET40.cs
  71. 8 9
      Renci.SshClient/Renci.SshNet/ForwardedPortLocal.cs
  72. 1 2
      Renci.SshClient/Renci.SshNet/ForwardedPortRemote.NET.cs
  73. 1 2
      Renci.SshClient/Renci.SshNet/ForwardedPortRemote.NET40.cs
  74. 9 14
      Renci.SshClient/Renci.SshNet/ForwardedPortRemote.cs
  75. 2 5
      Renci.SshClient/Renci.SshNet/HashInfo.cs
  76. 1 9
      Renci.SshClient/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.NET40.cs
  77. 4 6
      Renci.SshClient/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs
  78. 3 5
      Renci.SshClient/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs
  79. 1 3
      Renci.SshClient/Renci.SshNet/Messages/Authentication/BannerMessage.cs
  80. 0 1
      Renci.SshClient/Renci.SshNet/Messages/Authentication/FailureMessage.cs
  81. 0 1
      Renci.SshClient/Renci.SshNet/Messages/Authentication/InformationRequestMessage.cs
  82. 1 4
      Renci.SshClient/Renci.SshNet/Messages/Authentication/PublicKeyMessage.cs
  83. 0 1
      Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessage.cs
  84. 1 3
      Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessageHost.cs
  85. 1 3
      Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessageKeyboardInteractive.cs
  86. 1 14
      Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessageNone.cs
  87. 1 3
      Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessagePassword.cs
  88. 1 3
      Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessagePublicKey.cs
  89. 0 2
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelDataMessage.cs
  90. 2 0
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelExtendedDataMessage.cs
  91. 1 1
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelOpen/DirectTcpipChannelInfo.cs
  92. 1 1
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelOpen/ForwardedTcpipChannelInfo.cs
  93. 1 1
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelOpen/SessionChannelOpenInfo.cs
  94. 1 1
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelOpen/X11ChannelOpenInfo.cs
  95. 1 4
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/BreakRequestInfo.cs
  96. 1 4
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/ChannelRequestMessage.cs
  97. 2 7
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/EndOfWriteRequestInfo.cs
  98. 1 1
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/EnvironmentVariableRequestInfo.cs
  99. 5 2
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/ExecRequestInfo.cs
  100. 2 3
      Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/ExitSignalRequestInfo.cs

+ 2 - 1
Renci.SshClient/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj

@@ -34,6 +34,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <DocumentationFile>bin\Release\Renci.SshNet.XML</DocumentationFile>
+    <NoWarn>1591</NoWarn>
   </PropertyGroup>
   <PropertyGroup>
     <SignAssembly>true</SignAssembly>
@@ -876,7 +877,7 @@
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
     <VisualStudio>
-      <UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
+      <UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
     </VisualStudio>
   </ProjectExtensions>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 2 - 1
Renci.SshClient/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj

@@ -50,6 +50,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <DocumentationFile>Bin\Release\Renci.SshNet.xml</DocumentationFile>
+    <NoWarn>1591</NoWarn>
   </PropertyGroup>
   <PropertyGroup>
     <SignAssembly>true</SignAssembly>
@@ -834,7 +835,7 @@
       <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
         <SilverlightProjectProperties />
       </FlavorProperties>
-      <UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
+      <UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
     </VisualStudio>
   </ProjectExtensions>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 4 - 5
Renci.SshClient/Renci.SshNet.Silverlight/Session.SilverlightShared.cs

@@ -6,16 +6,15 @@ using System.Threading;
 using Renci.SshNet.Common;
 using Renci.SshNet.Messages.Transport;
 using System.Text;
-using Renci.SshNet.Messages;
 using System.Collections.Generic;
 
 namespace Renci.SshNet
 {
     public partial class Session
     {
-        private AutoResetEvent _autoEvent = new AutoResetEvent(false);
-        private AutoResetEvent _sendEvent = new AutoResetEvent(false);
-        private AutoResetEvent _receiveEvent = new AutoResetEvent(false);
+        private readonly AutoResetEvent _autoEvent = new AutoResetEvent(false);
+        private readonly AutoResetEvent _sendEvent = new AutoResetEvent(false);
+        private readonly AutoResetEvent _receiveEvent = new AutoResetEvent(false);
 
         private bool _isConnected = false;
 
@@ -29,7 +28,7 @@ namespace Renci.SshNet
             var ep = new DnsEndPoint(host, port);
             this._socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 
-            SocketAsyncEventArgs args = new SocketAsyncEventArgs();
+            var args = new SocketAsyncEventArgs();
 
             args.UserToken = this._socket;
             args.RemoteEndPoint = ep;

+ 2 - 1
Renci.SshClient/Renci.SshNet.Silverlight5/Renci.SshNet.Silverlight5.csproj

@@ -53,6 +53,7 @@
     <WarningLevel>4</WarningLevel>
     <Prefer32Bit>false</Prefer32Bit>
     <DocumentationFile>Bin\Release\Renci.SshNet.xml</DocumentationFile>
+    <NoWarn>1591</NoWarn>
   </PropertyGroup>
   <PropertyGroup>
     <SignAssembly>true</SignAssembly>
@@ -846,7 +847,7 @@
       <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
         <SilverlightProjectProperties />
       </FlavorProperties>
-      <UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
+      <UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
     </VisualStudio>
   </ProjectExtensions>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 4 - 4
Renci.SshClient/Renci.SshNet.Silverlight5/Session.SilverlightShared.cs

@@ -12,9 +12,9 @@ namespace Renci.SshNet
 {
     public partial class Session
     {
-        private AutoResetEvent _autoEvent = new AutoResetEvent(false);
-        private AutoResetEvent _sendEvent = new AutoResetEvent(false);
-        private AutoResetEvent _receiveEvent = new AutoResetEvent(false);
+        private readonly AutoResetEvent _autoEvent = new AutoResetEvent(false);
+        private readonly AutoResetEvent _sendEvent = new AutoResetEvent(false);
+        private readonly AutoResetEvent _receiveEvent = new AutoResetEvent(false);
 
         private bool _isConnected = false;
 
@@ -28,7 +28,7 @@ namespace Renci.SshNet
             var ep = new DnsEndPoint(host, port);
             this._socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 
-            SocketAsyncEventArgs args = new SocketAsyncEventArgs();
+            var args = new SocketAsyncEventArgs();
 
             args.UserToken = this._socket;
             args.RemoteEndPoint = ep;

+ 2 - 2
Renci.SshClient/Renci.SshNet.Tests.NET35/Renci.SshNet.Tests.NET35.csproj

@@ -35,7 +35,7 @@
     <OutputPath>bin\Release\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
+    <WarningLevel>0</WarningLevel>
   </PropertyGroup>
   <PropertyGroup>
     <SignAssembly>true</SignAssembly>
@@ -775,7 +775,7 @@
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
     <VisualStudio>
-      <UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="c45379b9-17b1-4e89-bc2e-6d41726413e8" />
+      <UserProperties ProjectLinkReference="c45379b9-17b1-4e89-bc2e-6d41726413e8" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
     </VisualStudio>
   </ProjectExtensions>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 1 - 1
Renci.SshClient/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj

@@ -34,7 +34,7 @@
     <OutputPath>bin\Release\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
+    <WarningLevel>0</WarningLevel>
   </PropertyGroup>
   <PropertyGroup>
     <StartupObject>

+ 1 - 0
Renci.SshClient/Renci.SshNet.WindowsPhone/Renci.SshNet.WindowsPhone.csproj

@@ -45,6 +45,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <DocumentationFile>Bin\Release\Renci.SshNet.xml</DocumentationFile>
+    <NoWarn>1591</NoWarn>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="system" />

+ 2 - 1
Renci.SshClient/Renci.SshNet.WindowsPhone8/Renci.SshNet.WindowsPhone8.csproj

@@ -50,6 +50,7 @@
     <WarningLevel>4</WarningLevel>
     <Prefer32Bit>false</Prefer32Bit>
     <DocumentationFile>Bin\Release\Renci.SshNet.xml</DocumentationFile>
+    <NoWarn>1591</NoWarn>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
     <DebugSymbols>true</DebugSymbols>
@@ -870,7 +871,7 @@
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
   <ProjectExtensions>
     <VisualStudio>
-      <UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
+      <UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
     </VisualStudio>
   </ProjectExtensions>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 0 - 2
Renci.SshClient/Renci.SshNet/AuthenticationMethod.cs

@@ -1,7 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet

+ 1 - 6
Renci.SshClient/Renci.SshNet/AuthenticationResult.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Renci.SshNet
+namespace Renci.SshNet
 {
     /// <summary>
     /// Represents possible authentication methods results

+ 3 - 8
Renci.SshClient/Renci.SshNet/BaseClient.cs

@@ -1,5 +1,4 @@
 using System;
-using System.IO;
 using System.Threading;
 using Renci.SshNet.Common;
 
@@ -36,8 +35,7 @@ namespace Renci.SshNet
             {
                 if (this.Session == null)
                     return false;
-                else
-                    return this.Session.IsConnected;
+                return this.Session.IsConnected;
             }
         }
 
@@ -59,10 +57,7 @@ namespace Renci.SshNet
 
                 if (this._keepAliveTimer == null)
                 {
-                    this._keepAliveTimer = new Timer((state) =>
-                    {
-                        this.SendKeepAlive();
-                    });
+                    this._keepAliveTimer = new Timer(state => this.SendKeepAlive());
                 }
 
                 this._keepAliveTimer.Change(this._keepAliveInterval, this._keepAliveInterval);
@@ -200,7 +195,7 @@ namespace Renci.SshNet
 
         #region IDisposable Members
 
-        private bool _isDisposed = false;
+        private bool _isDisposed;
 
         /// <summary>
         /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged ResourceMessages.

+ 3 - 4
Renci.SshClient/Renci.SshNet/Channels/Channel.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Linq;
 using System.Threading;
 using Renci.SshNet.Common;
 using Renci.SshNet.Messages;
@@ -21,9 +20,9 @@ namespace Renci.SshNet.Channels
 
         private EventWaitHandle _disconnectedWaitHandle = new ManualResetEvent(false);
 
-        private object _serverWindowSizeLock = new object();
+        private readonly object _serverWindowSizeLock = new object();
 
-        private bool _closeMessageSent = false;
+        private bool _closeMessageSent;
 
         private uint _initialWindowSize = 0x100000;
 
@@ -676,7 +675,7 @@ namespace Renci.SshNet.Channels
 
         #region IDisposable Members
 
-        private bool _isDisposed = false;
+        private bool _isDisposed;
 
         /// <summary>
         /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

+ 2 - 3
Renci.SshClient/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs

@@ -1,5 +1,4 @@
-using System.Threading.Tasks;
-using System;
+using System;
 using System.Net.Sockets;
 using System.Threading;
 
@@ -12,7 +11,7 @@ namespace Renci.SshNet.Channels
     {
         partial void ExecuteThread(Action action)
         {
-            ThreadPool.QueueUserWorkItem((o) => { action(); });
+            ThreadPool.QueueUserWorkItem(o => action());
         }
 
         partial void InternalSocketReceive(byte[] buffer, ref int read)

+ 1 - 4
Renci.SshClient/Renci.SshNet/Channels/ChannelDirectTcpip.cs

@@ -36,17 +36,14 @@ namespace Renci.SshNet.Channels
         /// Initializes a new instance of the <see cref="ChannelDirectTcpip"/> class.
         /// </summary>
         public ChannelDirectTcpip()
-            : base()
         {
-
         }
 
         public void Open(string remoteHost, uint port, Socket socket)
         {
             this._socket = socket;
 
-            IPEndPoint ep = socket.RemoteEndPoint as IPEndPoint;
-
+            var ep = socket.RemoteEndPoint as IPEndPoint;
 
             if (!this.IsConnected)
             {

+ 1 - 6
Renci.SshClient/Renci.SshNet/Channels/ChannelForwardedTcpip.NET40.cs

@@ -1,10 +1,5 @@
-using System;
-using System.Linq;
-using System.Net;
+using System.Net;
 using System.Net.Sockets;
-using System.Threading;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Connection;
 
 namespace Renci.SshNet.Channels
 {

+ 2 - 4
Renci.SshClient/Renci.SshNet/Channels/ChannelForwardedTcpip.cs

@@ -30,9 +30,7 @@ namespace Renci.SshNet.Channels
         /// Initializes a new instance of the <see cref="ChannelForwardedTcpip"/> class.
         /// </summary>
         public ChannelForwardedTcpip()
-            : base()
         {
-
         }
 
         /// <summary>
@@ -42,7 +40,7 @@ namespace Renci.SshNet.Channels
         /// <param name="connectedPort">The connected port.</param>
         public void Bind(IPAddress connectedHost, uint connectedPort)
         {
-            byte[] buffer = null;
+            byte[] buffer;
 
             this.ServerWindowSize = this.LocalWindowSize;
 
@@ -75,7 +73,7 @@ namespace Renci.SshNet.Channels
                 {
                 try
                 {
-                    int read = 0;
+                    var read = 0;
                     this.InternalSocketReceive(buffer, ref read);
 
                     if (read > 0)

+ 1 - 3
Renci.SshClient/Renci.SshNet/Channels/ChannelSession.cs

@@ -1,10 +1,8 @@
-using System.Diagnostics;
-using System.Threading;
+using System.Threading;
 using Renci.SshNet.Common;
 using Renci.SshNet.Messages.Connection;
 using System.Globalization;
 using System.Collections.Generic;
-using System.Text;
 
 namespace Renci.SshNet.Channels
 {

+ 0 - 2
Renci.SshClient/Renci.SshNet/CipherInfo.cs

@@ -1,7 +1,5 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Text;
 using Renci.SshNet.Security.Cryptography;
 
 namespace Renci.SshNet

+ 2 - 5
Renci.SshClient/Renci.SshNet/Common/ASCIIEncoding.cs

@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System.Text;
 
 namespace Renci.SshNet.Common
 {
@@ -12,7 +9,7 @@ namespace Renci.SshNet.Common
     {
         private readonly char _fallbackChar;
 
-        private static char[] _byteToChar;
+        private static readonly char[] _byteToChar;
 
         static ASCIIEncoding()
         {

+ 4 - 3
Renci.SshClient/Renci.SshNet/Common/AsyncResult.cs

@@ -120,8 +120,8 @@ namespace Renci.SshNet.Common
             {
                 if (this._asyncWaitHandle == null)
                 {
-                    Boolean done = this.IsCompleted;
-                    ManualResetEvent mre = new ManualResetEvent(done);
+                    var done = this.IsCompleted;
+                    var mre = new ManualResetEvent(done);
                     if (Interlocked.CompareExchange(ref this._asyncWaitHandle, mre, null) != null)
                     {
                         // Another thread created this object's event; dispose the event we just created
@@ -168,7 +168,8 @@ namespace Renci.SshNet.Common
         /// <param name="state">The state.</param>
         public AsyncResult(AsyncCallback asyncCallback, Object state)
             : base(asyncCallback, state)
-        { }
+        {
+        }
 
         /// <summary>
         /// Marks asynchronous operation as completed.

+ 1 - 6
Renci.SshClient/Renci.SshNet/Common/AuthenticationBannerEventArgs.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Renci.SshNet.Common
+namespace Renci.SshNet.Common
 {
     /// <summary>
     /// Provides data for <see cref="Renci.SshNet.ConnectionInfo.AuthenticationBanner"/> event.

+ 0 - 4
Renci.SshClient/Renci.SshNet/Common/AuthenticationEventArgs.cs

@@ -1,8 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Renci.SshNet.Messages.Authentication;
 
 namespace Renci.SshNet.Common
 {

+ 1 - 6
Renci.SshClient/Renci.SshNet/Common/AuthenticationPasswordChangeEventArgs.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Renci.SshNet.Common
+namespace Renci.SshNet.Common
 {
     /// <summary>
     /// Provides data for <see cref="Renci.SshNet.PasswordConnectionInfo.PasswordExpired"/> event.

+ 1 - 6
Renci.SshClient/Renci.SshNet/Common/AuthenticationPrompt.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Renci.SshNet.Common
+namespace Renci.SshNet.Common
 {
     /// <summary>
     /// Provides prompt information when <see cref="Renci.SshNet.KeyboardInteractiveConnectionInfo.AuthenticationPrompt"/> is raised

+ 1 - 4
Renci.SshClient/Renci.SshNet/Common/AuthenticationPromptEventArgs.cs

@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System.Collections.Generic;
 
 namespace Renci.SshNet.Common
 {

+ 4 - 8
Renci.SshClient/Renci.SshNet/Common/BigInteger.cs

@@ -46,11 +46,7 @@
 using System;
 using System.Linq;
 using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
 using System.Globalization;
-using System.Text;
-using System.Threading;
 using System.Security.Cryptography;
 
 /*
@@ -70,14 +66,14 @@ namespace Renci.SshNet.Common
     /// </summary>
     public struct BigInteger : IComparable, IFormattable, IComparable<BigInteger>, IEquatable<BigInteger>
     {
-        private static RNGCryptoServiceProvider _randomizer = new System.Security.Cryptography.RNGCryptoServiceProvider();
+        private static readonly RNGCryptoServiceProvider _randomizer = new RNGCryptoServiceProvider();
 
         private const ulong _BASE = 0x100000000;
         private const Int32 _DECIMALSIGNMASK = unchecked((Int32)0x80000000);
         private const int _BIAS = 1075;
 
         private static readonly uint[] _zero = new uint[1];
-        private static readonly uint[] _one = new uint[1] { 1 };
+        private static readonly uint[] _one = new uint[] { 1 };
 
         //LSB on [0]
         private readonly uint[] _data;
@@ -2641,7 +2637,7 @@ namespace Renci.SshNet.Common
         /// </returns>
         public string ToString(string format, IFormatProvider provider)
         {
-            if (format == null || format == "")
+            if (string.IsNullOrEmpty(format))
                 return ToString(10, provider);
 
             switch (format[0])
@@ -2676,7 +2672,7 @@ namespace Renci.SshNet.Common
         /// null or is not in a format that is compliant with style. This parameter is
         /// passed uninitialized.</param>
         /// <returns>true if the value parameter was converted successfully; otherwise, false.</returns>
-        public static bool TryParse(string value, System.Globalization.NumberStyles style, CultureInfo cultureInfo, out BigInteger result)
+        public static bool TryParse(string value, NumberStyles style, CultureInfo cultureInfo, out BigInteger result)
         {
             Exception ex;
             return Parse(value, true, style, cultureInfo, out result, out ex);

+ 4 - 8
Renci.SshClient/Renci.SshNet/Common/DerData.cs

@@ -1,7 +1,6 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {
@@ -41,10 +40,10 @@ namespace Renci.SshNet.Common
         //private const byte APPLICATION = 0x40;
         //private const byte TAGGED = 0x80;
 
-        private List<byte> _data;
+        private readonly List<byte> _data;
 
-        private int _readerIndex = 0;
-        private int _lastIndex;
+        private int _readerIndex;
+        private readonly int _lastIndex;
 
         /// <summary>
         /// Gets a value indicating whether end of data is reached.
@@ -271,10 +270,7 @@ namespace Renci.SshNet.Common
 
                 return data;
             }
-            else
-            {
-                return new byte[] { (byte)length };
-            }
+            return new byte[] { (byte)length };
         }
 
         private int ReadLength()

+ 0 - 3
Renci.SshClient/Renci.SshNet/Common/ExceptionEventArgs.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {

+ 0 - 3
Renci.SshClient/Renci.SshNet/Common/Extensions.NET.cs

@@ -1,9 +1,6 @@
-using System;
-using System.Collections.Generic;
 using System.Linq;
 using System.Net;
 using System.Net.Sockets;
-using System.Text;
 
 namespace Renci.SshNet
 {

+ 27 - 38
Renci.SshClient/Renci.SshNet/Common/Extensions.cs

@@ -1,7 +1,5 @@
-using System.Collections;
-using System.Collections.Generic;
+using System.Collections.Generic;
 using System.Diagnostics;
-using System.Linq;
 using System;
 using System.Globalization;
 using System.Text.RegularExpressions;
@@ -24,46 +22,40 @@ namespace Renci.SshNet
         internal static bool IsEqualTo<TSource>(this IEnumerable<TSource> value, IEnumerable<TSource> compareList, IEqualityComparer<TSource> comparer)
         {
             if (value == compareList)
-            {
                 return true;
-            }
-            else if (value == null || compareList == null)
-            {
+            if (value == null || compareList == null)
                 return false;
-            }
-            else
+
+            if (comparer == null)
             {
-                if (comparer == null)
-                {
-                    comparer = EqualityComparer<TSource>.Default;
-                }
+                comparer = EqualityComparer<TSource>.Default;
+            }
 
-                IEnumerator<TSource> enumerator1 = value.GetEnumerator();
-                IEnumerator<TSource> enumerator2 = compareList.GetEnumerator();
+            var enumerator1 = value.GetEnumerator();
+            var enumerator2 = compareList.GetEnumerator();
 
-                bool enum1HasValue = enumerator1.MoveNext();
-                bool enum2HasValue = enumerator2.MoveNext();
+            bool enum1HasValue = enumerator1.MoveNext();
+            bool enum2HasValue = enumerator2.MoveNext();
 
-                try
+            try
+            {
+                while (enum1HasValue && enum2HasValue)
                 {
-                    while (enum1HasValue && enum2HasValue)
+                    if (!comparer.Equals(enumerator1.Current, enumerator2.Current))
                     {
-                        if (!comparer.Equals(enumerator1.Current, enumerator2.Current))
-                        {
-                            return false;
-                        }
-
-                        enum1HasValue = enumerator1.MoveNext();
-                        enum2HasValue = enumerator2.MoveNext();
+                        return false;
                     }
 
-                    return !(enum1HasValue || enum2HasValue);
-                }
-                finally
-                {
-                    if (enumerator1 != null) enumerator1.Dispose();
-                    if (enumerator2 != null) enumerator2.Dispose();
+                    enum1HasValue = enumerator1.MoveNext();
+                    enum2HasValue = enumerator2.MoveNext();
                 }
+
+                return !(enum1HasValue || enum2HasValue);
+            }
+            finally
+            {
+                enumerator1.Dispose();
+                enumerator2.Dispose();
             }
         }
 
@@ -109,10 +101,7 @@ namespace Renci.SshNet
                 {
                     continue;
                 }
-                else
-                {
-                    leadingZero = false;
-                }
+                leadingZero = false;
 
                 yield return item;
             }
@@ -176,9 +165,9 @@ namespace Renci.SshNet
 
         private static Regex _reIPv6 = new Regex(@"^(((?=(?>.*?::)(?!.*::)))(::)?([0-9A-F]{1,4}::?){0,5}|([0-9A-F]{1,4}:){6})(\2([0-9A-F]{1,4}(::?|$)){0,2}|((25[0-5]|(2[0-4]|1\d|[1-9])?\d)(\.|$)){4}|[0-9A-F]{1,4}:[0-9A-F]{1,4})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase);
 #else
-        private static Regex _rehost = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
+        private static readonly Regex _rehost = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
 
-        private static Regex _reIPv6 = new Regex(@"^(((?=(?>.*?::)(?!.*::)))(::)?([0-9A-F]{1,4}::?){0,5}|([0-9A-F]{1,4}:){6})(\2([0-9A-F]{1,4}(::?|$)){0,2}|((25[0-5]|(2[0-4]|1\d|[1-9])?\d)(\.|$)){4}|[0-9A-F]{1,4}:[0-9A-F]{1,4})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase | RegexOptions.Compiled);
+        private static readonly Regex _reIPv6 = new Regex(@"^(((?=(?>.*?::)(?!.*::)))(::)?([0-9A-F]{1,4}::?){0,5}|([0-9A-F]{1,4}:){6})(\2([0-9A-F]{1,4}(::?|$)){0,2}|((25[0-5]|(2[0-4]|1\d|[1-9])?\d)(\.|$)){4}|[0-9A-F]{1,4}:[0-9A-F]{1,4})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase | RegexOptions.Compiled);
 
 #endif
 

+ 0 - 3
Renci.SshClient/Renci.SshNet/Common/HostKeyEventArgs.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using Renci.SshNet.Security.Cryptography;
 using Renci.SshNet.Security;
 

+ 0 - 4
Renci.SshClient/Renci.SshNet/Common/NetConfServerException.NET40.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
         /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
         /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
-        ///   
         /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
         protected NetConfServerException(SerializationInfo info, StreamingContext context)
             : base(info, context)

+ 0 - 5
Renci.SshClient/Renci.SshNet/Common/NetConfServerException.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
         /// </summary>
         public NetConfServerException()
         {
-
         }
 
         /// <summary>
@@ -25,7 +21,6 @@ namespace Renci.SshNet.Common
         public NetConfServerException(string message)
             : base(message)
         {
-
         }
 
         /// <summary>

+ 0 - 3
Renci.SshClient/Renci.SshNet/Common/ObjectIdentifier.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {

+ 2 - 2
Renci.SshClient/Renci.SshNet/Common/PipeStream.cs

@@ -162,7 +162,7 @@
             if (offset != 0)
                 throw new NotSupportedException("Offsets with value of non-zero are not supported");
             if (buffer == null)
-                throw new ArgumentNullException("Buffer is null");
+                throw new ArgumentNullException("buffer");
             if (offset + count > buffer.Length)
                 throw new ArgumentException("The sum of offset and count is greater than the buffer length. ");
             if (offset < 0 || count < 0)
@@ -217,7 +217,7 @@
         public override void Write(byte[] buffer, int offset, int count)
         {
             if (buffer == null)
-                throw new ArgumentNullException("Buffer is null");
+                throw new ArgumentNullException("buffer");
             if (offset + count > buffer.Length)
                 throw new ArgumentException("The sum of offset and count is greater than the buffer length. ");
             if (offset < 0 || count < 0)

+ 2 - 6
Renci.SshClient/Renci.SshNet/Common/ProxyException.NET40.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
@@ -14,9 +11,8 @@ namespace Renci.SshNet.Common
         /// </summary>
         /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
-        /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
-        ///   
-        /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
+        /// <exception cref="ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
+        /// <exception cref="SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
         protected ProxyException(SerializationInfo info, StreamingContext context)
             : base(info, context)
         {

+ 0 - 5
Renci.SshClient/Renci.SshNet/Common/ProxyException.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
         /// </summary>
         public ProxyException()
         {
-
         }
 
         /// <summary>
@@ -25,7 +21,6 @@ namespace Renci.SshNet.Common
         public ProxyException(string message)
             : base(message)
         {
-
         }
 
         /// <summary>

+ 0 - 3
Renci.SshClient/Renci.SshNet/Common/ScpDownloadEventArgs.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {

+ 0 - 4
Renci.SshClient/Renci.SshNet/Common/ScpException.NET40.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
         /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
         /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
-        ///   
         /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
         protected ScpException(SerializationInfo info, StreamingContext context)
             : base(info, context)

+ 0 - 3
Renci.SshClient/Renci.SshNet/Common/ScpException.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {

+ 0 - 3
Renci.SshClient/Renci.SshNet/Common/ScpUploadEventArgs.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {

+ 2 - 5
Renci.SshClient/Renci.SshNet/Common/SemaphoreLight.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Threading;
 
 namespace Renci.SshNet.Common
@@ -11,7 +8,7 @@ namespace Renci.SshNet.Common
     /// </summary>
     public class SemaphoreLight
     {
-        private object _lock = new object();
+        private readonly object _lock = new object();
 
         private int _currentCount;
 
@@ -24,7 +21,7 @@ namespace Renci.SshNet.Common
         public SemaphoreLight(int initialCount)
         {
             if (initialCount < 0 )
-                throw new ArgumentOutOfRangeException("The initial argument is negative");
+                throw new ArgumentOutOfRangeException("initialCount", "The value cannot be negative.");
 
             this._currentCount = initialCount;
         }

+ 0 - 4
Renci.SshClient/Renci.SshNet/Common/SftpPathNotFoundException.NET40.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
         /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
         /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
-        ///   
         /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
         protected SftpPathNotFoundException(SerializationInfo info, StreamingContext context)
             : base(info, context)

+ 0 - 5
Renci.SshClient/Renci.SshNet/Common/SftpPathNotFoundException.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
         /// </summary>
         public SftpPathNotFoundException()
         {
-
         }
 
         /// <summary>
@@ -25,7 +21,6 @@ namespace Renci.SshNet.Common
         public SftpPathNotFoundException(string message)
             : base(message)
         {
-
         }
 
         /// <summary>

+ 0 - 4
Renci.SshClient/Renci.SshNet/Common/SftpPermissionDeniedException.NET40.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
         /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
         /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
-        ///   
         /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
         protected SftpPermissionDeniedException(SerializationInfo info, StreamingContext context)
             : base(info, context)

+ 0 - 5
Renci.SshClient/Renci.SshNet/Common/SftpPermissionDeniedException.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
         /// </summary>
         public SftpPermissionDeniedException()
         {
-
         }
 
         /// <summary>
@@ -25,7 +21,6 @@ namespace Renci.SshNet.Common
         public SftpPermissionDeniedException(string message)
             : base(message)
         {
-
         }
 
         /// <summary>

+ 0 - 3
Renci.SshClient/Renci.SshNet/Common/ShellDataEventArgs.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {

+ 0 - 4
Renci.SshClient/Renci.SshNet/Common/SshAuthenticationException.NET40.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
         /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
         /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
-        ///   
         /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
         protected SshAuthenticationException(SerializationInfo info, StreamingContext context)
             : base(info, context)

+ 0 - 3
Renci.SshClient/Renci.SshNet/Common/SshAuthenticationException.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Common
 {

+ 0 - 12
Renci.SshClient/Renci.SshNet/Common/SshConnectionException.NET40.cs

@@ -1,5 +1,4 @@
 using System;
-using Renci.SshNet.Messages.Transport;
 using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
@@ -16,21 +15,10 @@ namespace Renci.SshNet.Common
         /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
         /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
-        ///   
         /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
         protected SshConnectionException(SerializationInfo info, StreamingContext context)
             : base(info, context)
         {
         }
-
-        /// <summary>
-        /// Gets the object data.
-        /// </summary>
-        /// <param name="info">The info.</param>
-        /// <param name="context">The context.</param>
-        public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
-        {
-            base.GetObjectData(info, context);
-        }
     }
 }

+ 12 - 4
Renci.SshClient/Renci.SshNet/Common/SshData.cs

@@ -11,12 +11,12 @@ namespace Renci.SshNet.Common
     /// </summary>
     public abstract class SshData
     {
-        private static Encoding _ascii = new ASCIIEncoding();
+        private static readonly Encoding _ascii = new ASCIIEncoding();
 
 #if SILVERLIGHT
-        private static Encoding _utf8 = Encoding.UTF8;
+        private static readonly Encoding _utf8 = Encoding.UTF8;
 #else
-        private static Encoding _utf8 = Encoding.Default;
+        private static readonly Encoding _utf8 = Encoding.Default;
 #endif
 
         /// <summary>
@@ -401,10 +401,19 @@ namespace Renci.SshNet.Common
             this.Write(data, SshData._utf8);
         }
 
+        /// <summary>
+        /// Writes string data into internal buffer using the specified encoding.
+        /// </summary>
+        /// <param name="data">string data to write.</param>
+        /// <param name="encoding">The character encoding to use.</param>
+        /// <exception cref="ArgumentNullException"><paramref name="data"/> is null.</exception>
+        /// <exception cref="ArgumentNullException"><paramref name="encoding"/> is null.</exception>
         protected void Write(string data, Encoding encoding)
         {
             if (data == null)
                 throw new ArgumentNullException("data");
+            if (encoding == null)
+                throw new ArgumentNullException("encoding");
 
             var bytes = encoding.GetBytes(data);
             this.Write((uint)bytes.Length);
@@ -445,7 +454,6 @@ namespace Renci.SshNet.Common
             this.WriteAscii(string.Join(",", data));
         }
 
-
         /// <summary>
         /// Writes extension-pair data into internal buffer.
         /// </summary>

+ 0 - 17
Renci.SshClient/Renci.SshNet/Common/SshException.NET40.cs

@@ -21,22 +21,5 @@ namespace Renci.SshNet.Common
             : base(info, context)
         {
         }
-
-        /// <summary>
-        /// When overridden in a derived class, sets the <see cref="T:System.Runtime.Serialization.SerializationInfo"/> with information about the exception.
-        /// </summary>
-        /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
-        /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
-        /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is a null reference (Nothing in Visual Basic). </exception>
-        ///   
-        /// <PermissionSet>
-        ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*"/>
-        ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter"/>
-        ///   </PermissionSet>
-        public override void GetObjectData(SerializationInfo info, StreamingContext context)
-        {
-            base.GetObjectData(info, context);
-        }
-
     }
 }

+ 0 - 4
Renci.SshClient/Renci.SshNet/Common/SshOperationTimeoutException.NET40.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
         /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
         /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
-        ///   
         /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
         protected SshOperationTimeoutException(SerializationInfo info, StreamingContext context)
             : base(info, context)

+ 0 - 2
Renci.SshClient/Renci.SshNet/Common/SshOperationTimeoutException.cs

@@ -12,7 +12,6 @@ namespace Renci.SshNet.Common
         /// </summary>
         public SshOperationTimeoutException()
         {
-
         }
 
         /// <summary>
@@ -22,7 +21,6 @@ namespace Renci.SshNet.Common
         public SshOperationTimeoutException(string message)
             : base(message)
         {
-
         }
 
         /// <summary>

+ 0 - 4
Renci.SshClient/Renci.SshNet/Common/SshPassPhraseNullOrEmptyException.NET40.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
         /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
         /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
-        ///   
         /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
         protected SshPassPhraseNullOrEmptyException(SerializationInfo info, StreamingContext context)
             : base(info, context)

+ 0 - 4
Renci.SshClient/Renci.SshNet/Common/SshPassPhraseNullOrEmptyException.cs

@@ -1,8 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Runtime.Serialization;
 
 namespace Renci.SshNet.Common
 {

+ 1 - 6
Renci.SshClient/Renci.SshNet/Common/TerminalModes.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Renci.SshNet.Common
+namespace Renci.SshNet.Common
 {
     /// <summary>
     /// Specifies the initial assignments of the opcode values that are used in the 'encoded terminal modes' valu

+ 2 - 3
Renci.SshClient/Renci.SshNet/Compression/Compressor.cs

@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using Renci.SshNet.Security;
+using Renci.SshNet.Security;
 using System.IO;
 using System;
 
@@ -90,7 +89,7 @@ namespace Renci.SshNet.Compression
 
         #region IDisposable Members
 
-        private bool _isDisposed = false;
+        private bool _isDisposed;
 
         /// <summary>
         /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged ResourceMessages.

+ 1 - 5
Renci.SshClient/Renci.SshNet/Compression/Zlib.cs

@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Renci.SshNet.Compression
+namespace Renci.SshNet.Compression
 {
     /// <summary>
     /// Represents "zlib" compression implementation

+ 1 - 5
Renci.SshClient/Renci.SshNet/Compression/ZlibOpenSsh.cs

@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Renci.SshNet.Compression
+namespace Renci.SshNet.Compression
 {
     /// <summary>
     /// Represents "zlib@openssh.org" compression implementation

+ 1 - 5
Renci.SshClient/Renci.SshNet/Compression/ZlibStream.cs

@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
+using System.IO;
 
 namespace Renci.SshNet.Compression
 {

+ 0 - 4
Renci.SshClient/Renci.SshNet/ConnectionInfo.cs

@@ -4,15 +4,11 @@ using System.Linq;
 using System.Text;
 using Renci.SshNet.Security;
 using Renci.SshNet.Messages.Connection;
-using System.Security.Cryptography;
 using Renci.SshNet.Common;
 using Renci.SshNet.Messages.Authentication;
 using Renci.SshNet.Security.Cryptography;
 using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
 using Renci.SshNet.Security.Cryptography.Ciphers;
-using System.Collections.ObjectModel;
-using System.Net;
-using Renci.SshNet.Compression;
 
 namespace Renci.SshNet
 {

+ 0 - 3
Renci.SshClient/Renci.SshNet/ExpectAction.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Text.RegularExpressions;
 
 namespace Renci.SshNet

+ 0 - 2
Renci.SshClient/Renci.SshNet/ExpectAsyncResult.cs

@@ -1,6 +1,5 @@
 using Renci.SshNet.Common;
 using System;
-using System.Threading;
 
 namespace Renci.SshNet
 {
@@ -12,7 +11,6 @@ namespace Renci.SshNet
         /// <summary>
         /// Initializes a new instance of the <see cref="ExpectAsyncResult" /> class.
         /// </summary>
-        /// <param name="shellStream">The shell stream.</param>
         /// <param name="asyncCallback">The async callback.</param>
         /// <param name="state">The state.</param>
         internal ExpectAsyncResult(AsyncCallback asyncCallback, Object state)

+ 4 - 5
Renci.SshClient/Renci.SshNet/ForwardedPortDynamic.NET.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Net;
@@ -13,7 +12,7 @@ namespace Renci.SshNet
     public partial class ForwardedPortDynamic
     {
         private TcpListener _listener;
-        private object _listenerLocker = new object();
+        private readonly object _listenerLocker = new object();
 
         partial void InternalStart()
         {
@@ -192,8 +191,8 @@ namespace Renci.SshNet
 
                 var addressType = stream.ReadByte();
 
-                IPAddress ipAddress = null;
-                byte[] addressBuffer = null;
+                IPAddress ipAddress;
+                byte[] addressBuffer;
                 switch (addressType)
                 {
                     case 0x01:
@@ -210,7 +209,7 @@ namespace Renci.SshNet
                             addressBuffer = new byte[length];
                             stream.Read(addressBuffer, 0, addressBuffer.Length);
 
-                            ipAddress = IPAddress.Parse(new Renci.SshNet.Common.ASCIIEncoding().GetString(addressBuffer));
+                            ipAddress = IPAddress.Parse(new Common.ASCIIEncoding().GetString(addressBuffer));
                         }
                         break;
                     case 0x04:

+ 1 - 2
Renci.SshClient/Renci.SshNet/ForwardedPortDynamic.NET40.cs

@@ -1,6 +1,5 @@
 using System;
 using System.Threading;
-using System.Threading.Tasks;
 
 namespace Renci.SshNet
 {
@@ -8,7 +7,7 @@ namespace Renci.SshNet
     {
         partial void ExecuteThread(Action action)
         {
-            ThreadPool.QueueUserWorkItem((o) => { action(); });
+            ThreadPool.QueueUserWorkItem(o => action());
         }
     }
 }

+ 1 - 4
Renci.SshClient/Renci.SshNet/ForwardedPortDynamic.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Threading;
 
 namespace Renci.SshNet
@@ -69,7 +66,7 @@ namespace Renci.SshNet
 
         #region IDisposable Members
 
-        private bool _isDisposed = false;
+        private bool _isDisposed;
 
         /// <summary>
         /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged ResourceMessages.

+ 0 - 1
Renci.SshClient/Renci.SshNet/ForwardedPortLocal.NET.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Linq;
 using System.Net.Sockets;
 using System.Net;
 using System.Threading;

+ 1 - 2
Renci.SshClient/Renci.SshNet/ForwardedPortLocal.NET40.cs

@@ -1,6 +1,5 @@
 using System;
 using System.Threading;
-using System.Threading.Tasks;
 
 namespace Renci.SshNet
 {
@@ -11,7 +10,7 @@ namespace Renci.SshNet
     {
         partial void ExecuteThread(Action action)
         {
-            ThreadPool.QueueUserWorkItem((o) => { action(); });
+            ThreadPool.QueueUserWorkItem(o => action());
         }
     }
 }

+ 8 - 9
Renci.SshClient/Renci.SshNet/ForwardedPortLocal.cs

@@ -1,6 +1,5 @@
 using System;
 using System.Threading;
-using System.Net;
 
 namespace Renci.SshNet
 {
@@ -10,12 +9,12 @@ namespace Renci.SshNet
     public partial class ForwardedPortLocal : ForwardedPort, IDisposable
     {
         private EventWaitHandle _listenerTaskCompleted;
-		
+
         /// <summary>
         /// Gets the bound host.
         /// </summary>
         public string BoundHost { get; protected set; }
-		
+
         /// <summary>
         /// Gets the bound port.
         /// </summary>
@@ -48,12 +47,13 @@ namespace Renci.SshNet
         /// <summary>
         /// Initializes a new instance of the <see cref="ForwardedPortLocal"/> class.
         /// </summary>
+        /// <param name="boundHost">The bound host.</param>
         /// <param name="host">The host.</param>
         /// <param name="port">The port.</param>
-		public ForwardedPortLocal(string boundHost, string host, uint port)
-			: this(boundHost, 0, host, port) 
-		{
-		}
+        public ForwardedPortLocal(string boundHost, string host, uint port)
+            : this(boundHost, 0, host, port) 
+        {
+        }
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ForwardedPortLocal"/> class.
@@ -88,7 +88,6 @@ namespace Renci.SshNet
             this.Port = port;
         }
 
-
         /// <summary>
         /// Starts local port forwarding.
         /// </summary>
@@ -115,7 +114,7 @@ namespace Renci.SshNet
 
         #region IDisposable Members
 
-        private bool _isDisposed = false;
+        private bool _isDisposed;
 
         /// <summary>
         /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged ResourceMessages.

+ 1 - 2
Renci.SshClient/Renci.SshNet/ForwardedPortRemote.NET.cs

@@ -1,5 +1,4 @@
-using System;
-using System.Net;
+using System.Net;
 
 namespace Renci.SshNet
 {

+ 1 - 2
Renci.SshClient/Renci.SshNet/ForwardedPortRemote.NET40.cs

@@ -1,6 +1,5 @@
 using System;
 using System.Threading;
-using System.Threading.Tasks;
 
 namespace Renci.SshNet
 {
@@ -11,7 +10,7 @@ namespace Renci.SshNet
     {
         partial void ExecuteThread(Action action)
         {
-            ThreadPool.QueueUserWorkItem((o) => { action(); });
+            ThreadPool.QueueUserWorkItem(o => action());
         }
     }
 }

+ 9 - 14
Renci.SshClient/Renci.SshNet/ForwardedPortRemote.cs

@@ -3,7 +3,6 @@ using System.Threading;
 using Renci.SshNet.Channels;
 using Renci.SshNet.Messages.Connection;
 using Renci.SshNet.Common;
-using System.Diagnostics;
 using System.Globalization;
 using System.Net;
 
@@ -67,19 +66,18 @@ namespace Renci.SshNet
         /// <param name="boundPort">The bound port.</param>
         /// <param name="hostAddress">The host address.</param>
         /// <param name="port">The port.</param>
-        /// <exception cref="System.ArgumentNullException">boundHost</exception>
-        /// <exception cref="System.ArgumentOutOfRangeException">boundPort</exception>
+        /// <exception cref="ArgumentNullException"><paramref name="boundHostAddress"/> is <c>null</c>.</exception>
+        /// <exception cref="ArgumentNullException"><paramref name="hostAddress"/> is <c>null</c>.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="boundPort"/> is not a valid port.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not a valid port.</exception>
         public ForwardedPortRemote(IPAddress boundHostAddress, uint boundPort, IPAddress hostAddress, uint port)
         {
             if (boundHostAddress == null)
-                throw new ArgumentNullException("boundHost");
-
+                throw new ArgumentNullException("boundHostAddress");
             if (hostAddress == null)
-                throw new ArgumentNullException("host");
-
+                throw new ArgumentNullException("hostAddress");
             if (!boundPort.IsValidPort())
                 throw new ArgumentOutOfRangeException("boundPort");
-
             if (!port.IsValidPort())
                 throw new ArgumentOutOfRangeException("port");
 
@@ -120,10 +118,7 @@ namespace Renci.SshNet
 
                 throw new SshException(string.Format(CultureInfo.CurrentCulture, "Port forwarding for '{0}' port '{1}' failed to start.", this.Host, this.Port));
             }
-            else
-            {
-                this.IsStarted = true;
-            }
+            this.IsStarted = true;
         }
 
         /// <summary>
@@ -175,7 +170,7 @@ namespace Renci.SshNet
             }
         }
 
-        private void Session_RequestFailure(object sender, System.EventArgs e)
+        private void Session_RequestFailure(object sender, EventArgs e)
         {
             this._requestStatus = false;
             this._globalRequestResponse.Set();
@@ -196,7 +191,7 @@ namespace Renci.SshNet
 
         #region IDisposable Members
 
-        private bool _isDisposed = false;
+        private bool _isDisposed;
 
         /// <summary>
         /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

+ 2 - 5
Renci.SshClient/Renci.SshNet/HashInfo.cs

@@ -1,8 +1,5 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Text;
-using Renci.SshNet.Security.Cryptography;
 using System.Security.Cryptography;
 
 namespace Renci.SshNet
@@ -29,11 +26,11 @@ namespace Renci.SshNet
         /// Initializes a new instance of the <see cref="CipherInfo"/> class.
         /// </summary>
         /// <param name="keySize">Size of the key.</param>
-        /// <param name="cipher">The cipher.</param>
+        /// <param name="hash">The hash algorithm to use for a given key.</param>
         public HashInfo(int keySize, Func<byte[], HashAlgorithm> hash)
         {
             this.KeySize = keySize;
-            this.HashAlgorithm = (key) => (hash(key.Take(this.KeySize / 8).ToArray()));
+            this.HashAlgorithm = key => (hash(key.Take(this.KeySize / 8).ToArray()));
         }
     }
 }

+ 1 - 9
Renci.SshClient/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.NET40.cs

@@ -1,21 +1,13 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Threading;
-using Renci.SshNet.Messages;
-using Renci.SshNet.Messages.Authentication;
-using Renci.SshNet.Common;
-using System.Threading.Tasks;
 
 namespace Renci.SshNet
 {
     public partial  class KeyboardInteractiveAuthenticationMethod : AuthenticationMethod
     {
-        /// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
         partial void ExecuteThread(Action action)
         {
-            ThreadPool.QueueUserWorkItem((o) => { action(); });
+            ThreadPool.QueueUserWorkItem(o => action());
         }
     }
 }

+ 4 - 6
Renci.SshClient/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs

@@ -1,7 +1,5 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Text;
 using System.Threading;
 using Renci.SshNet.Messages;
 using Renci.SshNet.Messages.Authentication;
@@ -22,7 +20,7 @@ namespace Renci.SshNet
 
         private Exception _exception;
 
-        private RequestMessage _requestMessage;
+        private readonly RequestMessage _requestMessage;
 
         /// <summary>
         /// Gets authentication method name
@@ -142,7 +140,7 @@ namespace Renci.SshNet
 
         #region IDisposable Members
 
-        private bool isDisposed = false;
+        private bool _isDisposed;
 
         /// <summary>
         /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
@@ -161,7 +159,7 @@ namespace Renci.SshNet
         protected virtual void Dispose(bool disposing)
         {
             // Check to see if Dispose has already been called.
-            if (!this.isDisposed)
+            if (!this._isDisposed)
             {
                 // If disposing equals true, dispose all managed
                 // and unmanaged resources.
@@ -176,7 +174,7 @@ namespace Renci.SshNet
                 }
 
                 // Note disposing has been done.
-                isDisposed = true;
+                _isDisposed = true;
             }
         }
 

+ 3 - 5
Renci.SshClient/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs

@@ -1,7 +1,5 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Text;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet
@@ -150,7 +148,7 @@ namespace Renci.SshNet
 
         #region IDisposable Members
 
-        private bool isDisposed = false;
+        private bool _isDisposed;
 
         /// <summary>
         /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
@@ -169,7 +167,7 @@ namespace Renci.SshNet
         protected virtual void Dispose(bool disposing)
         {
             // Check to see if Dispose has already been called.
-            if (!this.isDisposed)
+            if (!this._isDisposed)
             {
                 // If disposing equals true, dispose all managed
                 // and unmanaged resources.
@@ -186,7 +184,7 @@ namespace Renci.SshNet
                 }
 
                 // Note disposing has been done.
-                isDisposed = true;
+                _isDisposed = true;
             }
         }
 

+ 1 - 3
Renci.SshClient/Renci.SshNet/Messages/Authentication/BannerMessage.cs

@@ -1,6 +1,4 @@
-using System.Text;
-
-namespace Renci.SshNet.Messages.Authentication
+namespace Renci.SshNet.Messages.Authentication
 {
     /// <summary>
     /// Represents SSH_MSG_USERAUTH_BANNER message.

+ 0 - 1
Renci.SshClient/Renci.SshNet/Messages/Authentication/FailureMessage.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Collections.Generic;
 
 namespace Renci.SshNet.Messages.Authentication
 {

+ 0 - 1
Renci.SshClient/Renci.SshNet/Messages/Authentication/InformationRequestMessage.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Linq;
 using System.Collections.Generic;
 using Renci.SshNet.Common;
 

+ 1 - 4
Renci.SshClient/Renci.SshNet/Messages/Authentication/PublicKeyMessage.cs

@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-
-namespace Renci.SshNet.Messages.Authentication
+namespace Renci.SshNet.Messages.Authentication
 {
     /// <summary>
     /// Represents SSH_MSG_USERAUTH_PK_OK message.

+ 0 - 1
Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessage.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Text;
 
 namespace Renci.SshNet.Messages.Authentication
 {

+ 1 - 3
Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessageHost.cs

@@ -1,6 +1,4 @@
-using System.Text;
-
-namespace Renci.SshNet.Messages.Authentication
+namespace Renci.SshNet.Messages.Authentication
 {
     /// <summary>
     /// Represents "hostbased" SSH_MSG_USERAUTH_REQUEST message.

+ 1 - 3
Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessageKeyboardInteractive.cs

@@ -1,6 +1,4 @@
-using System.Text;
-
-namespace Renci.SshNet.Messages.Authentication
+namespace Renci.SshNet.Messages.Authentication
 {
     /// <summary>
     /// Represents "keyboard-interactive" SSH_MSG_USERAUTH_REQUEST message.

+ 1 - 14
Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessageNone.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Renci.SshNet.Messages.Authentication
+namespace Renci.SshNet.Messages.Authentication
 {
     /// <summary>
     /// Represents "none" SSH_MSG_USERAUTH_REQUEST message.
@@ -33,13 +28,5 @@ namespace Renci.SshNet.Messages.Authentication
             : base(serviceName, username)
         {
         }
-
-        /// <summary>
-        /// Called when type specific data need to be saved.
-        /// </summary>
-        protected override void SaveData()
-        {
-            base.SaveData();
-        }
     }
 }

+ 1 - 3
Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessagePassword.cs

@@ -1,6 +1,4 @@
-using System.Text;
-
-namespace Renci.SshNet.Messages.Authentication
+namespace Renci.SshNet.Messages.Authentication
 {
     /// <summary>
     /// Represents "password" SSH_MSG_USERAUTH_REQUEST message.

+ 1 - 3
Renci.SshClient/Renci.SshNet/Messages/Authentication/RequestMessagePublicKey.cs

@@ -1,6 +1,4 @@
-using System.Collections.Generic;
-
-namespace Renci.SshNet.Messages.Authentication
+namespace Renci.SshNet.Messages.Authentication
 {
     /// <summary>
     /// Represents "publickey" SSH_MSG_USERAUTH_REQUEST message.

+ 0 - 2
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelDataMessage.cs

@@ -18,9 +18,7 @@
         /// Initializes a new instance of the <see cref="ChannelDataMessage"/> class.
         /// </summary>
         public ChannelDataMessage()
-            : base()
         {
-
         }
 
         /// <summary>

+ 2 - 0
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelExtendedDataMessage.cs

@@ -28,6 +28,8 @@
         /// Initializes a new instance of the <see cref="ChannelExtendedDataMessage"/> class.
         /// </summary>
         /// <param name="localChannelNumber">The local channel number.</param>
+        /// <param name="dataTypeCode">The message data type code.</param>
+        /// <param name="data">The message data.</param>
         public ChannelExtendedDataMessage(uint localChannelNumber, uint dataTypeCode, byte[] data)
         {
             this.LocalChannelNumber = localChannelNumber;

+ 1 - 1
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelOpen/DirectTcpipChannelInfo.cs

@@ -18,7 +18,7 @@
         /// </value>
         public override string ChannelType
         {
-            get { return DirectTcpipChannelInfo.NAME; }
+            get { return NAME; }
         }
 
         /// <summary>

+ 1 - 1
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelOpen/ForwardedTcpipChannelInfo.cs

@@ -18,7 +18,7 @@
         /// </value>
         public override string ChannelType
         {
-            get { return ForwardedTcpipChannelInfo.NAME; }
+            get { return NAME; }
         }
 
         /// <summary>

+ 1 - 1
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelOpen/SessionChannelOpenInfo.cs

@@ -18,7 +18,7 @@
         /// </value>
         public override string ChannelType
         {
-            get { return SessionChannelOpenInfo.NAME; }
+            get { return NAME; }
         }
     }
 }

+ 1 - 1
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelOpen/X11ChannelOpenInfo.cs

@@ -18,7 +18,7 @@
         /// </value>
         public override string ChannelType
         {
-            get { return X11ChannelOpenInfo.NAME; }
+            get { return NAME; }
         }
 
         /// <summary>

+ 1 - 4
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/BreakRequestInfo.cs

@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 
 namespace Renci.SshNet.Messages.Connection
 {
@@ -23,7 +20,7 @@ namespace Renci.SshNet.Messages.Connection
         /// </value>
         public override string RequestName
         {
-            get { return BreakRequestInfo.NAME; }
+            get { return NAME; }
         }
 
         /// <summary>

+ 1 - 4
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/ChannelRequestMessage.cs

@@ -1,7 +1,4 @@
-using System;
-using System.Globalization;
-
-namespace Renci.SshNet.Messages.Connection
+namespace Renci.SshNet.Messages.Connection
 {
     /// <summary>
     /// Represents SSH_MSG_CHANNEL_REQUEST message.

+ 2 - 7
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/EndOfWriteRequestInfo.cs

@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Renci.SshNet.Messages.Connection
+namespace Renci.SshNet.Messages.Connection
 {
     /// <summary>
     /// Represents "eow@openssh.com" type channel request information
@@ -23,7 +18,7 @@ namespace Renci.SshNet.Messages.Connection
         /// </value>
         public override string RequestName
         {
-            get { return EndOfWriteRequestInfo.NAME; }
+            get { return NAME; }
         }
 
         /// <summary>

+ 1 - 1
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/EnvironmentVariableRequestInfo.cs

@@ -18,7 +18,7 @@
         /// </value>
         public override string RequestName
         {
-            get { return EnvironmentVariableRequestInfo.NAME; }
+            get { return NAME; }
         }
 
         /// <summary>

+ 5 - 2
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/ExecRequestInfo.cs

@@ -20,7 +20,7 @@ namespace Renci.SshNet.Messages.Connection
         /// </value>
         public override string RequestName
         {
-            get { return ExecRequestInfo.NAME; }
+            get { return NAME; }
         }
 
         /// <summary>
@@ -51,12 +51,15 @@ namespace Renci.SshNet.Messages.Connection
         /// Initializes a new instance of the <see cref="ExecRequestInfo"/> class.
         /// </summary>
         /// <param name="command">The command.</param>
-        /// <exception cref="System.ArgumentNullException"><paramref name="command"/> is null.</exception>
+        /// <param name="encoding">The character encoding to use.</param>
+        /// <exception cref="System.ArgumentNullException"><paramref name="command"/> or <paramref name="encoding"/> is null.</exception>
         public ExecRequestInfo(string command, Encoding encoding)
             : this()
         {
             if (command == null)
                 throw new System.ArgumentNullException("command");
+            if (encoding == null)
+                throw new System.ArgumentNullException("encoding");
 
             this.Command = command;
             this.Encoding = encoding;

+ 2 - 3
Renci.SshClient/Renci.SshNet/Messages/Connection/ChannelRequest/ExitSignalRequestInfo.cs

@@ -1,5 +1,4 @@
-using System.Text;
-namespace Renci.SshNet.Messages.Connection
+namespace Renci.SshNet.Messages.Connection
 {
     /// <summary>
     /// Represents "exit-signal" type channel request information
@@ -19,7 +18,7 @@ namespace Renci.SshNet.Messages.Connection
         /// </value>
         public override string RequestName
         {
-            get { return ExitSignalRequestInfo.NAME; }
+            get { return NAME; }
         }
 
         /// <summary>

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff