Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
olegkap committed Dec 20, 2016
2 parents 1b881f5 + c0407a2 commit 5b724e5
Show file tree
Hide file tree
Showing 21 changed files with 213 additions and 192 deletions.
37 changes: 33 additions & 4 deletions build/build.proj
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Clean;CreatePackage;GenerateHelpFile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Clean;CreateNuGetPackage;CreateBinPackage;GenerateHelpFile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Zip" AssemblyFile="$(MSBuildThisFileDirectory)target\nuget\packages\$(MSBuildTasksPackageId).$(MSBuildTasksPackageVersion)\tools\MSBuild.Community.Tasks.dll"/>
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<BuildRoot>$(MSBuildThisFileDirectory)</BuildRoot>
<NuGetExe>$(BuildRoot)target\nuget\nuget.exe</NuGetExe>
<MSBuildTasksPackageId>MSBuildTasks</MSBuildTasksPackageId>
<MSBuildTasksPackageVersion>1.5.0.214</MSBuildTasksPackageVersion>
</PropertyGroup>
<ItemGroup>
<VisualStudioVersion Include="2012">
Expand Down Expand Up @@ -76,7 +79,7 @@
</ItemGroup>
<MSBuild Projects="@(ProjectToBuild)" Targets="Rebuild"/>
</Target>
<Target Name="CreatePackage" DependsOnTargets="CopyBuildOutputToPackage">
<Target Name="CreateNuGetPackage" DependsOnTargets="CopyBuildOutputToPackage">
<Exec Command="$(NuGetExe) pack $(MSBuildThisFileDirectory)nuget\SSH.NET.nuspec -OutputDirectory &quot;$(MSBuildThisFileDirectory)target&quot; -BasePath &quot;$(MSBuildThisFileDirectory)target\package&quot; -NonInteractive"/>
</Target>
<Target Name="CopyBuildOutputToPackage" DependsOnTargets="Build" Outputs="%(TargetFramework.Identity)">
Expand All @@ -87,11 +90,37 @@
</ItemGroup>
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(MSBuildThisFileDirectory)target\package\lib\%(TargetFramework.Moniker)"/>
</Target>
<Target Name="GenerateHelpFile" DependsOnTargets="Build">
<Target Name="GenerateHelpFile" DependsOnTargets="Build;CheckReleaseVersion">
<Error Text="Please install Sandcastle, and ensure the SHFBFolder environment variable is set." Condition="'$(SHFBFolder)'==''"/>
<MSBuild Projects="$(MSBuildThisFileDirectory)sandcastle\SSH.NET.shfbproj"/>
<Move SourceFiles="$(MSBuildThisFileDirectory)target\help\SshNet.Help.chm" DestinationFiles="$(MSBuildThisFileDirectory)target\SSH.NET-$(ReleaseVersion)-help.chm"/>
</Target>
<Target Name="CopyBuildOutputToBin" DependsOnTargets="Build" Outputs="%(TargetFramework.Identity)">
<ItemGroup>
<BuildOutput Remove="@(BuildOutput)"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFramework.OutputDirectory)\*.dll"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFramework.OutputDirectory)\*.xml"/>
</ItemGroup>
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(MSBuildThisFileDirectory)target\bin\lib\%(TargetFramework.Moniker)"/>
</Target>
<Target Name="CreateBinPackage" DependsOnTargets="PrepareMSBuildTasksPackage;CopyBuildOutputToBin;CheckReleaseVersion">
<ItemGroup>
<Files Remove="@(Files)"/>
<Files Include="$(MSBuildThisFileDirectory)..\LICENSE"/>
</ItemGroup>
<Copy SourceFiles="@(Files)" DestinationFolder="$(MSBuildThisFileDirectory)target\bin\%(RecursiveDir)"/>
<ItemGroup>
<Files Remove="@(Files)"/>
<Files Include="$(MSBuildThisFileDirectory)target\bin\**"/>
</ItemGroup>
<Zip ZipFileName="$(MSBuildThisFileDirectory)target\SSH.NET-$(ReleaseVersion)-bin.zip" Files="@(Files)" WorkingDirectory="$(MSBuildThisFileDirectory)target\bin"/>
</Target>
<Target Name="PrepareMSBuildTasksPackage" DependsOnTargets="DownloadNuGet">
<Exec Command="$(NuGetExe) install $(MSBuildTasksPackageId) -Version $(MSBuildTasksPackageVersion) -OutputDirectory &quot;$(MSBuildThisFileDirectory)target\nuget\packages&quot; -Verbosity quiet"/>
</Target>
<Target Name="CheckReleaseVersion" Condition="'$(ReleaseVersion)'==''">
<Error Text= "Please specify the version number of the release (using the &quot;ReleaseVersion&quot; property)."/>
</Target>

<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Address ParameterType="System.String" Required="true"/>
Expand Down
4 changes: 2 additions & 2 deletions build/nuget/SSH.NET.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>SSH.NET</id>
<version>2016.0.0</version>
<version>2016.1.0-beta1</version>
<title>SSH.NET</title>
<authors>Renci</authors>
<owners>olegkap,drieseng</owners>
<licenseUrl>https://github.com/sshnet/SSH.NET/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/sshnet/SSH.NET/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism and with broad framework support.</description>
<releaseNotes>https://github.com/sshnet/SSH.NET/releases/tag/2016.0.0</releaseNotes>
<releaseNotes>https://github.com/sshnet/SSH.NET/releases/tag/2016.1.0-beta1</releaseNotes>
<summary>A Secure Shell (SSH) library for .NET, optimized for parallelism.</summary>
<copyright>2012-2016, RENCI</copyright>
<language>en-US</language>
Expand Down
71 changes: 71 additions & 0 deletions build/sandcastle/new.shfbproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- The configuration and platform will be used to determine which assemblies to include from solution and
project documentation sources -->
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6c35cd41-3f6e-47c1-a805-1aab0ac88b36}</ProjectGuid>
<SHFBSchemaVersion>2015.6.5.0</SHFBSchemaVersion>
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual Studio adds them anyway -->
<AssemblyName>Documentation</AssemblyName>
<RootNamespace>Documentation</RootNamespace>
<Name>Documentation</Name>
<!-- SHFB properties -->
<FrameworkVersion>.NET Framework 4.0</FrameworkVersion>
<OutputPath>D:\development\SSH.NET\build\target\help\</OutputPath>
<HtmlHelpName>Documentation</HtmlHelpName>
<Language>en-US</Language>
<SaveComponentCacheCapacity>100</SaveComponentCacheCapacity>
<BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
<HelpFileFormat>Markdown</HelpFileFormat>
<IndentHtml>False</IndentHtml>
<KeepLogFile>False</KeepLogFile>
<DisableCodeBlockComponent>False</DisableCodeBlockComponent>
<CleanIntermediates>True</CleanIntermediates>
<DocumentationSources>
<DocumentationSource sourceFile="D:\development\SSH.NET\src\Renci.SshNet\bin\Debug\Renci.SshNet.dll" />
<DocumentationSource sourceFile="D:\development\SSH.NET\src\Renci.SshNet\bin\Debug\Renci.SshNet.xml" /></DocumentationSources>
<HelpFileVersion>1.0.0.0</HelpFileVersion>
<MaximumGroupParts>2</MaximumGroupParts>
<NamespaceGrouping>False</NamespaceGrouping>
<SyntaxFilters>Standard</SyntaxFilters>
<SdkLinkTarget>Blank</SdkLinkTarget>
<RootNamespaceContainer>False</RootNamespaceContainer>
<PresentationStyle>Markdown</PresentationStyle>
<Preliminary>False</Preliminary>
<NamingMethod>Guid</NamingMethod>
<HelpTitle>A Sandcastle Documented Class Library</HelpTitle>
<ContentPlacement>AboveNamespaces</ContentPlacement>
</PropertyGroup>
<!-- There are no properties for these groups. AnyCPU needs to appear in order for Visual Studio to perform
the build. The others are optional common platform types that may appear. -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
</PropertyGroup>
<!-- Import the SHFB build targets -->
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
<!-- The pre-build and post-build event properties must appear *after* the targets file import in order to be
evaluated correctly. -->
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
</Project>
3 changes: 1 addition & 2 deletions src/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
<AssemblyOriginatorKeyFile>..\Renci.SshNet.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="mscorlib" />
<Reference Include="SshNet.Security.Cryptography">
<HintPath>..\..\packages\SshNet.Security.Cryptography.1.2.0\lib\sl4\SshNet.Security.Cryptography.dll</HintPath>
Expand Down Expand Up @@ -917,7 +916,7 @@
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
<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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
<AssemblyOriginatorKeyFile>..\Renci.SshNet.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="mscorlib" />
<Reference Include="SshNet.Security.Cryptography, Version=1.2.0.0, Culture=neutral, PublicKeyToken=2fa9220ff3eadda4, processorArchitecture=MSIL">
<HintPath>..\..\packages\SshNet.Security.Cryptography.1.2.0\lib\sl5\SshNet.Security.Cryptography.dll</HintPath>
Expand Down Expand Up @@ -923,7 +922,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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class ForwardedPortDynamicTest_Stop_PortDisposed
private ForwardedPortDynamic _forwardedPort;
private IList<EventArgs> _closingRegister;
private IList<ExceptionEventArgs> _exceptionRegister;
private ObjectDisposedException _actualException;
private IPEndPoint _endpoint;

[TestInitialize]
Expand Down Expand Up @@ -47,22 +46,7 @@ protected void Arrange()

protected void Act()
{
try
{
_forwardedPort.Stop();
Assert.Fail();
}
catch (ObjectDisposedException ex)
{
_actualException = ex;
}
}

[TestMethod]
public void StopShouldThrowObjectDisposedException()
{
Assert.IsNotNull(_actualException);
Assert.AreEqual(_forwardedPort.GetType().FullName, _actualException.ObjectName);
_forwardedPort.Stop();
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class ForwardedPortLocalTest_Stop_PortDisposed
private ForwardedPortLocal _forwardedPort;
private IList<EventArgs> _closingRegister;
private IList<ExceptionEventArgs> _exceptionRegister;
private ObjectDisposedException _actualException;

[TestInitialize]
public void Setup()
Expand Down Expand Up @@ -43,22 +42,7 @@ protected void Arrange()

protected void Act()
{
try
{
_forwardedPort.Stop();
Assert.Fail();
}
catch (ObjectDisposedException ex)
{
_actualException = ex;
}
}

[TestMethod]
public void StopShouldThrowObjectDisposedException()
{
Assert.IsNotNull(_actualException);
Assert.AreEqual(_forwardedPort.GetType().FullName, _actualException.ObjectName);
_forwardedPort.Stop();
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class ForwardedPortRemoteTest_Stop_PortDisposed
private IPEndPoint _remoteEndpoint;
private IList<EventArgs> _closingRegister;
private IList<ExceptionEventArgs> _exceptionRegister;
private ObjectDisposedException _actualException;

[TestInitialize]
public void Setup()
Expand Down Expand Up @@ -49,22 +48,7 @@ protected void Arrange()

protected void Act()
{
try
{
_forwardedPort.Stop();
Assert.Fail();
}
catch (ObjectDisposedException ex)
{
_actualException = ex;
}
}

[TestMethod]
public void StopShouldThrowObjectDisposedException()
{
Assert.IsNotNull(_actualException);
Assert.AreEqual(_forwardedPort.GetType().FullName, _actualException.ObjectName);
_forwardedPort.Stop();
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Channels;
using Renci.SshNet.Common;
using Renci.SshNet.Sftp;
using Renci.SshNet.Sftp.Responses;

namespace Renci.SshNet.Tests.Classes.Sftp
{
Expand Down
1 change: 0 additions & 1 deletion src/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<AssemblyOriginatorKeyFile>..\Renci.SshNet.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Moq">
<HintPath>..\..\packages\Moq.4.2.1409.1722\lib\net40\Moq.dll</HintPath>
Expand Down
3 changes: 2 additions & 1 deletion src/Renci.SshNet/Abstractions/DiagnosticAbstraction.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
#if FEATURE_DIAGNOSTICS_TRACESOURCE
using System.Threading;
#endif // FEATURE_DIAGNOSTICS_TRACESOURCE
Expand Down
4 changes: 2 additions & 2 deletions src/Renci.SshNet/BaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public void Connect()
/// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
public void Disconnect()
{
DiagnosticAbstraction.Log(string.Format("{0} Disconnecting client", DateTime.Now.Ticks));
DiagnosticAbstraction.Log("Disconnecting client.");

CheckDisposed();

Expand Down Expand Up @@ -319,7 +319,7 @@ private void Session_HostKeyReceived(object sender, HostKeyEventArgs e)
/// </summary>
public void Dispose()
{
DiagnosticAbstraction.Log(string.Format("{0} Disposing client", DateTime.Now.Ticks));
DiagnosticAbstraction.Log("Disposing client.");

Dispose(true);
GC.SuppressFinalize(this);
Expand Down
18 changes: 0 additions & 18 deletions src/Renci.SshNet/Common/SshData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,24 +255,6 @@ protected byte[] ReadBinary()
return _stream.ReadBinary();
}

//protected byte[] ReadBinaryDebug()
//{
// DiagnosticAbstraction.Log("Stream Position:" + _stream.Position);
// var data = _stream.ReadBytes(4);
// DiagnosticAbstraction.Log("Binary Length Bytes:" + Session.ToHex(data, 0));
// var length = (uint)(data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]);
// DiagnosticAbstraction.Log("Binary Length:" + length);

// if (length > int.MaxValue)
// {
// throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Data longer than {0} is not supported.", int.MaxValue));
// }

// var binary = _stream.ReadBytes((int) length);
// DiagnosticAbstraction.Log("Binary Bytes:" + Session.ToHex(binary, 0));
// return binary;
//}

/// <summary>
/// Reads next name-list data type from internal buffer.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions src/Renci.SshNet/ForwardedPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public virtual void Start()
/// </summary>
public virtual void Stop()
{
CheckDisposed();

if (IsStarted)
{
StopPort(Session.ConnectionInfo.Timeout);
Expand Down
Loading

0 comments on commit 5b724e5

Please sign in to comment.