C# 클래스 Granados.Poderosa.SFTP.SFTPClient

SFTP Client

This class is designed to be used in the worker thread.

Some methods block thread while waiting for the response.

Referenced specification:
IETF Network Working Group Internet Draft
SSH File Transfer Protocol
draft-ietf-secsh-filexfer-02 (protocol version 3)
파일 보기 프로젝트 열기: poderosaproject/poderosa 1 사용 예제들

공개 메소드들

메소드 설명
Close ( ) : void

Close channel.

CreateDirectory ( string path ) : void

Create directory.

DownloadFile ( string remotePath, string localPath, Granados.Poderosa.FileTransfer.Cancellation cancellation, SFTPFileTransferProgressDelegate progressDelegate ) : void

Download a file.

Even if download failed, local file is not deleted.

GetDirectoryEntries ( string directoryPath ) : Granados.Poderosa.SFTP.SFTPFileInfo[]

Gets directory entries in the specified directory path.

GetFileInformations ( string path, bool lstat ) : Granados.Poderosa.SFTP.SFTPFileAttributes

Get file informations.

GetRealPath ( string path ) : string

Gets canonical path.

Init ( ) : void

Initialize

Send SSH_FXP_INIT and receive SSH_FXP_VERSION.

OpenSFTPChannel ( ISSHConnection connection ) : SFTPClient

Opens SFTP channel and creates a new instance.

RemoveDirectory ( string path ) : void

Remove directory.

RemoveFile ( string path ) : void

Remove file.

Rename ( string oldPath, string newPath ) : void

Rename file or directory.

SetPermissions ( string path, int permissions ) : void

Set permissions of the file or directory.

UploadFile ( string localPath, string remotePath, Granados.Poderosa.FileTransfer.Cancellation cancellation, SFTPFileTransferProgressDelegate progressDelegate ) : void

Upload a file.

비공개 메소드들

메소드 설명
CheckStatus ( ) : void
CloseHandle ( uint requestId, byte handle ) : void
OpenDir ( uint requestId, string directoryPath ) : byte[]
OpenFile ( uint requestId, string filePath, uint flags ) : byte[]
ReadDir ( uint requestId, byte handle ) : ICollection
ReadFile ( uint requestId, byte handle, ulong offset, int length, byte buffer ) : int
ReadFileAttributes ( Granados.IO.SSHDataReader dataReader ) : Granados.Poderosa.SFTP.SFTPFileAttributes
ReadFileInfo ( Granados.IO.SSHDataReader dataReader, Encoding encoding ) : Granados.Poderosa.SFTP.SFTPFileInfo
SFTPClient ( ISSHChannel channel, SFTPClientChannelEventHandler eventHandler ) : System

Constructor

Transmit ( SFTPPacket packet ) : void
TransmitPacketAndWaitForStatusOK ( uint requestId, SFTPPacket packet ) : void
WaitHandle ( SFTPPacket requestPacket, uint requestId ) : byte[]
WaitReady ( ) : bool

Waits for channel status to be "READY". The current thread is blocked until the status comes to "READY" or "CLOSED".

WriteFile ( uint requestId, byte handle, ulong offset, byte buff, int length ) : void

메소드 상세

Close() 공개 메소드

Close channel.
public Close ( ) : void
리턴 void

CreateDirectory() 공개 메소드

Create directory.
Operation failed. Timeout has occured. Invalid status An exception which was thrown while processing the response.
public CreateDirectory ( string path ) : void
path string Directory path to create.
리턴 void

DownloadFile() 공개 메소드

Download a file.
Even if download failed, local file is not deleted.
Operation failed. Timeout has occured. Invalid status. Error. Error.
public DownloadFile ( string remotePath, string localPath, Granados.Poderosa.FileTransfer.Cancellation cancellation, SFTPFileTransferProgressDelegate progressDelegate ) : void
remotePath string Remote file path to download.
localPath string Local file path to save.
cancellation Granados.Poderosa.FileTransfer.Cancellation An object to request the cancellation. Set null if the cancellation is not needed.
progressDelegate SFTPFileTransferProgressDelegate Delegate to notify progress. Set null if notification is not needed.
리턴 void

GetDirectoryEntries() 공개 메소드

Gets directory entries in the specified directory path.
Operation failed. Timeout has occured. Invalid status.
public GetDirectoryEntries ( string directoryPath ) : Granados.Poderosa.SFTP.SFTPFileInfo[]
directoryPath string Directory path.
리턴 Granados.Poderosa.SFTP.SFTPFileInfo[]

GetFileInformations() 공개 메소드

Get file informations.
Operation failed. Timeout has occured. Invalid status An exception which was thrown while processing the response.
public GetFileInformations ( string path, bool lstat ) : Granados.Poderosa.SFTP.SFTPFileAttributes
path string File path.
lstat bool Specifies to use lstat. Symbolic link is not followed and informations about the symbolic link are returned.
리턴 Granados.Poderosa.SFTP.SFTPFileAttributes

GetRealPath() 공개 메소드

Gets canonical path.
Operation failed. Timeout has occured. Invalid status.
public GetRealPath ( string path ) : string
path string Path to be canonicalized.
리턴 string

Init() 공개 메소드

Initialize
Send SSH_FXP_INIT and receive SSH_FXP_VERSION.
Timeout has occured. Invalid status An exception which was thrown while processing the response.
public Init ( ) : void
리턴 void

OpenSFTPChannel() 공개 정적인 메소드

Opens SFTP channel and creates a new instance.
public static OpenSFTPChannel ( ISSHConnection connection ) : SFTPClient
connection ISSHConnection SSH2 connection object
리턴 SFTPClient

RemoveDirectory() 공개 메소드

Remove directory.
Operation failed. Timeout has occured. Invalid status An exception which was thrown while processing the response.
public RemoveDirectory ( string path ) : void
path string Directory path to remove.
리턴 void

RemoveFile() 공개 메소드

Remove file.
Operation failed. Timeout has occured. Invalid status An exception which was thrown while processing the response.
public RemoveFile ( string path ) : void
path string File path to remove.
리턴 void

Rename() 공개 메소드

Rename file or directory.
Operation failed. Timeout has occured. Invalid status An exception which was thrown while processing the response.
public Rename ( string oldPath, string newPath ) : void
oldPath string Old path.
newPath string New path.
리턴 void

SetPermissions() 공개 메소드

Set permissions of the file or directory.
Operation failed. Timeout has occured. Invalid status An exception which was thrown while processing the response.
public SetPermissions ( string path, int permissions ) : void
path string Path.
permissions int Permissions to set.
리턴 void

UploadFile() 공개 메소드

Upload a file.
Operation failed. Timeout has occured. Invalid status. Error. Error.
public UploadFile ( string localPath, string remotePath, Granados.Poderosa.FileTransfer.Cancellation cancellation, SFTPFileTransferProgressDelegate progressDelegate ) : void
localPath string Local file path to upload.
remotePath string Remote file path to write.
cancellation Granados.Poderosa.FileTransfer.Cancellation An object to request the cancellation. Set null if the cancellation is not needed.
progressDelegate SFTPFileTransferProgressDelegate Delegate to notify progress. Set null if notification is not needed.
리턴 void