Skip to content

Instantly share code, notes, and snippets.

@slpsys
Created March 16, 2011 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slpsys/871792 to your computer and use it in GitHub Desktop.
Save slpsys/871792 to your computer and use it in GitHub Desktop.
Stupid Tamir.SharpSsh
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tamir.SharpSsh;
using Tamir.SharpSsh.jsch;
namespace FileService
{
/// <summary>
/// When the going gets tough, the tough subclass, and implement their own damn features.
/// </summary>
public class SftpClient : Sftp
{
public SftpClient(string sftpHost, string user) : base(sftpHost, user) { }
public SftpClient(string sftpHost, string user, string password) : base(sftpHost, user, password) { }
/// <summary>
/// Gets the underlying channel. This would have been good to have, if you're not going to implement things like: file status.
/// </summary>
/// <value>The underlying channel.</value>
public ChannelSftp UnderlyingChannel
{
get { return (ChannelSftp)this.m_channel; }
}
/// <summary>
/// This is in the underlying Java implementation...how hard would this to have been to expose?
/// </summary>
/// <param name="Path">The path.</param>
/// <returns></returns>
public DateTime GetFileModificationTime(string Path)
{
SftpATTRS attrs = this.UnderlyingChannel.lstat(Path);
DateTime ret = DateTime.MinValue;
if (attrs != null && DateTime.TryParse(attrs.getMtimeString(), out ret))
{
}
return ret;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment