Skip to content

Commit

Permalink
Move UploadTime to ScpClient.NET.cs, and sync legacy project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
drieseng committed Aug 27, 2017
1 parent b70e218 commit 84f3a28
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 19 deletions.
5 changes: 4 additions & 1 deletion src/Renci.SshNet.Silverlight/Renci.SshNet.Silverlight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
<Link>Common\PortForwardEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
<Link>Common\PosixPath.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
<Link>Common\ProxyException.cs</Link>
</Compile>
Expand Down Expand Up @@ -946,7 +949,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 @@ -218,6 +218,9 @@
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
<Link>Common\PortForwardEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
<Link>Common\PosixPath.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
<Link>Common\ProxyException.cs</Link>
</Compile>
Expand Down Expand Up @@ -952,7 +955,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
3 changes: 3 additions & 0 deletions src/Renci.SshNet.UAP10/Renci.SshNet.UAP10.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
<Link>Common\PortForwardEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
<Link>Common\PosixPath.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
<Link>Common\ProxyException.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
<Link>Common\PortForwardEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
<Link>Common\PosixPath.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
<Link>Common\ProxyException.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
<Link>Common\PortForwardEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
<Link>Common\PosixPath.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
<Link>Common\ProxyException.cs</Link>
</Compile>
Expand Down Expand Up @@ -979,7 +982,7 @@
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).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.
Expand Down
16 changes: 16 additions & 0 deletions src/Renci.SshNet/ScpClient.NET.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,22 @@ public void Download(string directoryName, DirectoryInfo directoryInfo)
}
}

/// <summary>
/// Uploads the <see cref="FileSystemInfo.LastWriteTimeUtc"/> and <see cref="FileSystemInfo.LastAccessTimeUtc"/>
/// of the next file or directory to upload.
/// </summary>
/// <param name="channel">The channel to perform the upload in.</param>
/// <param name="input">A <see cref="Stream"/> from which any feedback from the server can be read.</param>
/// <param name="fileOrDirectory">The file or directory to upload.</param>
private void UploadTimes(IChannelSession channel, Stream input, FileSystemInfo fileOrDirectory)
{
var zeroTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
var modificationSeconds = (long) (fileOrDirectory.LastWriteTimeUtc - zeroTime).TotalSeconds;
var accessSeconds = (long) (fileOrDirectory.LastAccessTimeUtc - zeroTime).TotalSeconds;
SendData(channel, string.Format("T{0} 0 {1} 0\n", modificationSeconds, accessSeconds));
CheckReturnCode(input);
}

/// <summary>
/// Upload the files and subdirectories in the specified directory.
/// </summary>
Expand Down
16 changes: 0 additions & 16 deletions src/Renci.SshNet/ScpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,22 +243,6 @@ public void Download(string filename, Stream destination)
}
}

/// <summary>
/// Uploads the <see cref="FileSystemInfo.LastWriteTimeUtc"/> and <see cref="FileSystemInfo.LastAccessTimeUtc"/>
/// of the next file or directory to upload.
/// </summary>
/// <param name="channel">The channel to perform the upload in.</param>
/// <param name="input">A <see cref="Stream"/> from which any feedback from the server can be read.</param>
/// <param name="fileOrDirectory">The file or directory to upload.</param>
private void UploadTimes(IChannelSession channel, Stream input, FileSystemInfo fileOrDirectory)
{
var zeroTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
var modificationSeconds = (long) (fileOrDirectory.LastWriteTimeUtc - zeroTime).TotalSeconds;
var accessSeconds = (long) (fileOrDirectory.LastAccessTimeUtc - zeroTime).TotalSeconds;
SendData(channel, string.Format("T{0} 0 {1} 0\n", modificationSeconds, accessSeconds));
CheckReturnCode(input);
}

/// <summary>
/// Sets mode, size and name of file being upload.
/// </summary>
Expand Down

0 comments on commit 84f3a28

Please sign in to comment.