浏览代码

Merge pull request #17 from matthewvukomanovic/develop

Use Infinite constants where appropriate
Gert Driesen 9 年之前
父节点
当前提交
665759c246

+ 4 - 1
.gitignore

@@ -18,4 +18,7 @@ src/TestResults/
 src/.vs/
 src/.vs/
 
 
 # Expanded/resolved project.json files
 # Expanded/resolved project.json files
-project.lock.json
+project.lock.json
+
+# Build outputs
+build/target/

+ 2 - 2
build/build.cmd

@@ -6,13 +6,13 @@ set MSBUILD_HOME=%WINDIR%\Microsoft.NET\Framework\v4.0.30319
 rem MSBuild project file is located in the same directory as the current script
 rem MSBuild project file is located in the same directory as the current script
 set MSBUILD_PROJECT=%~dp0\build.proj
 set MSBUILD_PROJECT=%~dp0\build.proj
 
 
-set MSBUILD_EXE=%MSBUILD_HOME%\msbuild.exe
+set MSBUILD_EXE="%MSBUILD_HOME%\msbuild.exe"
 
 
 rem verify whether the version of MSBuild that we need is installed
 rem verify whether the version of MSBuild that we need is installed
 if not exist %MSBUILD_EXE% goto msbuild_missing
 if not exist %MSBUILD_EXE% goto msbuild_missing
 
 
 rem launch the build script
 rem launch the build script
-call %MSBUILD_HOME%\msbuild.exe %MSBUILD_PROJECT% /verbosity:minimal /nologo
+call %MSBUILD_EXE% %MSBUILD_PROJECT% /verbosity:minimal /nologo
 if errorlevel 1 goto msbuild_failure
 if errorlevel 1 goto msbuild_failure
 goto :EOF
 goto :EOF
 
 

+ 5 - 5
build/build.proj

@@ -39,7 +39,7 @@
 	
 	
 	<Target Name="Build">
 	<Target Name="Build">
 		<ItemGroup>
 		<ItemGroup>
-			<ProjectToBuild Include="$(MSBuildThisFileDirectory)..\Renci.SshNet.VS2012.sln">
+			<ProjectToBuild Include="$(MSBuildThisFileDirectory)..\src\Renci.SshNet.VS2012.sln">
 				<Properties>Configuration=Release</Properties>
 				<Properties>Configuration=Release</Properties>
 			</ProjectToBuild>
 			</ProjectToBuild>
 		</ItemGroup>
 		</ItemGroup>
@@ -52,8 +52,8 @@
 	<Target Name="CopyBuildOutputToPackage" DependsOnTargets="Build" Outputs="%(TargetFramework.Identity)">
 	<Target Name="CopyBuildOutputToPackage" DependsOnTargets="Build" Outputs="%(TargetFramework.Identity)">
 		<ItemGroup>
 		<ItemGroup>
 			<BuildOutput Remove="@(BuildOutput)"/>
 			<BuildOutput Remove="@(BuildOutput)"/>
-			<BuildOutput Include="$(MSBuildThisFileDirectory)..\%(TargetFramework.Project)\bin\$(Configuration)\Renci.SshNet.dll"/>
-			<BuildOutput Include="$(MSBuildThisFileDirectory)..\%(TargetFramework.Project)\bin\$(Configuration)\Renci.SshNet.xml"/>
+			<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFramework.Project)\bin\$(Configuration)\Renci.SshNet.dll"/>
+			<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFramework.Project)\bin\$(Configuration)\Renci.SshNet.xml"/>
 		</ItemGroup>
 		</ItemGroup>
 		<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(MSBuildThisFileDirectory)target\package\lib\%(TargetFramework.Moniker)"/>
 		<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(MSBuildThisFileDirectory)target\package\lib\%(TargetFramework.Moniker)"/>
 	</Target>
 	</Target>
@@ -63,8 +63,8 @@
 	
 	
 	<Target Name="GenerateSourceZip">
 	<Target Name="GenerateSourceZip">
 		<ItemGroup>
 		<ItemGroup>
-			<SourceFiles Include="$(MSBuildThisFileDirectory)..\Renci.SshNet\**" Exclude="$(MSBuildThisFileDirectory)..\Renci.SshNet\bin\**;$(MSBuildThisFileDirectory)..\Renci.SshNet\obj\**"/>
-			<SourceFiles Include="$(MSBuildThisFileDirectory)..\Renci.SshNet.snk"/>
+			<SourceFiles Include="$(MSBuildThisFileDirectory)..\src\Renci.SshNet\**" Exclude="$(MSBuildThisFileDirectory)..\src\Renci.SshNet\bin\**;$(MSBuildThisFileDirectory)..\src\Renci.SshNet\obj\**"/>
+			<SourceFiles Include="$(MSBuildThisFileDirectory)..\src\Renci.SshNet.snk"/>
 		</ItemGroup>
 		</ItemGroup>
 		<Zip
 		<Zip
 			Files="@(SourceFiles)"
 			Files="@(SourceFiles)"

+ 3 - 3
build/sandcastle/SSH.NET.shfbproj

@@ -32,7 +32,7 @@
     <ComponentConfigurations>
     <ComponentConfigurations>
       <ComponentConfig id="Code Block Component" enabled="True" xmlns="">
       <ComponentConfig id="Code Block Component" enabled="True" xmlns="">
         <component id="Code Block Component">
         <component id="Code Block Component">
-          <basePath value="{@HtmlEncProjectFolder}..\..\Renci.SshNet\bin" />
+          <basePath value="{@HtmlEncProjectFolder}..\..\src\Renci.SshNet\bin" />
           <outputPaths>{@HelpFormatOutputPaths}</outputPaths>
           <outputPaths>{@HelpFormatOutputPaths}</outputPaths>
           <allowMissingSource value="false" />
           <allowMissingSource value="false" />
           <removeRegionMarkers value="false" />
           <removeRegionMarkers value="false" />
@@ -41,8 +41,8 @@
       </ComponentConfig>
       </ComponentConfig>
     </ComponentConfigurations>
     </ComponentConfigurations>
     <DocumentationSources>
     <DocumentationSources>
-      <DocumentationSource sourceFile="..\..\Renci.SshNet\bin\Release\Renci.SshNet.dll" xmlns="" />
-      <DocumentationSource sourceFile="..\..\Renci.SshNet\bin\Release\Renci.SshNet.xml" xmlns="" />
+      <DocumentationSource sourceFile="..\..\src\Renci.SshNet\bin\Release\Renci.SshNet.dll" xmlns="" />
+      <DocumentationSource sourceFile="..\..\src\Renci.SshNet\bin\Release\Renci.SshNet.xml" xmlns="" />
     </DocumentationSources>
     </DocumentationSources>
     <MissingTags>Summary, Parameter, Returns, AutoDocumentCtors, TypeParameter, AutoDocumentDispose</MissingTags>
     <MissingTags>Summary, Parameter, Returns, AutoDocumentCtors, TypeParameter, AutoDocumentDispose</MissingTags>
     <BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
     <BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>

+ 3 - 3
src/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs

@@ -57,7 +57,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
                     new MessageEventArgs<ChannelOpenConfirmationMessage>(
                     new MessageEventArgs<ChannelOpenConfirmationMessage>(
                         new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
                         new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
             _sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
             _sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
-                .Callback<WaitHandle>(p => p.WaitOne(-1));
+                .Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
 
 
             var localPortEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
             var localPortEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
             using (var localPortListener = new AsyncSocketListener(localPortEndPoint))
             using (var localPortListener = new AsyncSocketListener(localPortEndPoint))
@@ -107,7 +107,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
                     new MessageEventArgs<ChannelOpenConfirmationMessage>(
                     new MessageEventArgs<ChannelOpenConfirmationMessage>(
                         new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
                         new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
             _sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
             _sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
-                .Callback<WaitHandle>(p => p.WaitOne(-1));
+                .Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
 
 
             var localPortEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
             var localPortEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
             using (var localPortListener = new AsyncSocketListener(localPortEndPoint))
             using (var localPortListener = new AsyncSocketListener(localPortEndPoint))
@@ -159,7 +159,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
                         new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber,
                         new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber,
                             _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
                             _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
             _sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
             _sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
-                .Callback<WaitHandle>(p => p.WaitOne(-1));
+                .Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
             _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
             _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
             _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(60));
             _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(60));
             _sessionMock.Setup(p => p.TrySendMessage(It.IsAny<ChannelEofMessage>()))
             _sessionMock.Setup(p => p.TrySendMessage(It.IsAny<ChannelEofMessage>()))

+ 1 - 1
src/Renci.SshNet/NetConfClient.cs

@@ -126,7 +126,7 @@ namespace Renci.SshNet
         internal NetConfClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
         internal NetConfClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
             : base(connectionInfo, ownsConnectionInfo, serviceFactory)
             : base(connectionInfo, ownsConnectionInfo, serviceFactory)
         {
         {
-            OperationTimeout = new TimeSpan(0, 0, 0, 0, -1);
+            OperationTimeout = SshNet.Session.InfiniteTimeSpan;
             AutomaticMessageIdHandling = true;
             AutomaticMessageIdHandling = true;
         }
         }
 
 

+ 1 - 1
src/Renci.SshNet/ScpClient.cs

@@ -144,7 +144,7 @@ namespace Renci.SshNet
         internal ScpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
         internal ScpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
             : base(connectionInfo, ownsConnectionInfo, serviceFactory)
             : base(connectionInfo, ownsConnectionInfo, serviceFactory)
         {
         {
-            OperationTimeout = new TimeSpan(0, 0, 0, 0, -1);
+            OperationTimeout = SshNet.Session.InfiniteTimeSpan;
             BufferSize = 1024 * 16;
             BufferSize = 1024 * 16;
 
 
             if (_byteToChar == null)
             if (_byteToChar == null)

+ 1 - 1
src/Renci.SshNet/SftpClient.cs

@@ -229,7 +229,7 @@ namespace Renci.SshNet
         internal SftpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
         internal SftpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
             : base(connectionInfo, ownsConnectionInfo, serviceFactory)
             : base(connectionInfo, ownsConnectionInfo, serviceFactory)
         {
         {
-            OperationTimeout = new TimeSpan(0, 0, 0, 0, -1);
+            OperationTimeout = SshNet.Session.InfiniteTimeSpan;
             BufferSize = 1024 * 32;
             BufferSize = 1024 * 32;
         }
         }
 
 

+ 1 - 1
src/Renci.SshNet/ShellStream.cs

@@ -464,7 +464,7 @@ namespace Renci.SshNet
         /// </returns>
         /// </returns>
         public string Expect(string text)
         public string Expect(string text)
         {
         {
-            return Expect(new Regex(Regex.Escape(text)), TimeSpan.FromMilliseconds(-1));
+            return Expect(new Regex(Regex.Escape(text)), Session.InfiniteTimeSpan);
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 1 - 1
src/Renci.SshNet/SshCommand.cs

@@ -143,7 +143,7 @@ namespace Renci.SshNet
             _session = session;
             _session = session;
             CommandText = commandText;
             CommandText = commandText;
             _encoding = encoding;
             _encoding = encoding;
-            CommandTimeout = new TimeSpan(0, 0, 0, 0, -1);
+            CommandTimeout = Session.InfiniteTimeSpan;
             _sessionErrorOccuredWaitHandle = new AutoResetEvent(false);
             _sessionErrorOccuredWaitHandle = new AutoResetEvent(false);
 
 
             _session.Disconnected += Session_Disconnected;
             _session.Disconnected += Session_Disconnected;