Created
March 16, 2011 00:24
-
-
Save slpsys/871792 to your computer and use it in GitHub Desktop.
Stupid Tamir.SharpSsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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