C# Класс Renci.SshNet.Sftp.SftpSession

Наследование: SubsystemSession, ISftpSession
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CalculateOptimalReadLength ( uint bufferSize ) : uint

Calculates the optimal size of the buffer to read data from the channel.

CalculateOptimalWriteLength ( uint bufferSize, byte handle ) : uint

Calculates the optimal size of the buffer to write data on the channel.

Currently, we do not take the remote window size into account.

ChangeDirectory ( string path ) : void

Changes the current working directory to the specified path.

GetCanonicalPath ( string path ) : string

Resolves a given path into an absolute path on the server.

RequestClose ( byte handle ) : void

Performs SSH_FXP_CLOSE request.

RequestFSetStat ( byte handle, SftpFileAttributes attributes ) : void

Performs SSH_FXP_FSETSTAT request.

RequestFStat ( byte handle ) : SftpFileAttributes

Performs SSH_FXP_FSTAT request.

RequestLStat ( string path ) : SftpFileAttributes

Performs SSH_FXP_LSTAT request.

RequestMkDir ( string path ) : void

Performs SSH_FXP_MKDIR request.

RequestOpen ( string path, Flags flags, bool nullOnError = false ) : byte[]

Performs SSH_FXP_OPEN request

RequestOpenDir ( string path, bool nullOnError = false ) : byte[]

Performs SSH_FXP_OPENDIR request

RequestPosixRename ( string oldPath, string newPath ) : void

Performs [email protected] extended request.

RequestRead ( byte handle, ulong offset, uint length ) : byte[]

Performs SSH_FXP_READ request.

RequestReadDir ( byte handle ) : SftpFileAttributes>[].KeyValuePair

Performs SSH_FXP_READDIR request

RequestRemove ( string path ) : void

Performs SSH_FXP_REMOVE request.

RequestRename ( string oldPath, string newPath ) : void

Performs SSH_FXP_RENAME request.

RequestRmDir ( string path ) : void

Performs SSH_FXP_RMDIR request.

RequestSetStat ( string path, SftpFileAttributes attributes ) : void

Performs SSH_FXP_SETSTAT request.

RequestStatVfs ( string path, bool nullOnError = false ) : SftpFileSytemInformation

Performs [email protected] extended request.

RequestSymLink ( string linkpath, string targetpath ) : void

Performs SSH_FXP_SYMLINK request.

RequestWrite ( byte handle, ulong serverOffset, byte data, int offset, int length, AutoResetEvent wait, Action writeCompleted = null ) : void

Performs SSH_FXP_WRITE request.

SftpSession ( ISession session, System.TimeSpan operationTimeout, Encoding encoding ) : System

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void
OnChannelOpen ( ) : void
OnDataReceived ( byte data ) : void

Приватные методы

Метод Описание
GetFullRemotePath ( string path ) : string
GetSftpException ( SftpStatusResponse response ) : SshException
HandleResponse ( SftpResponse response ) : void
HardLink ( string oldPath, string newPath ) : void

Performs [email protected] extended request.

RequestFStatVfs ( byte handle, bool nullOnError = false ) : SftpFileSytemInformation

Performs [email protected] extended request.

RequestReadLink ( string path, bool nullOnError = false ) : SftpFileAttributes>[].KeyValuePair

Performs SSH_FXP_READLINK request.

RequestRealPath ( string path, bool nullOnError = false ) : SftpFileAttributes>[].KeyValuePair

Performs SSH_FXP_REALPATH request

RequestStat ( string path, bool nullOnError = false ) : SftpFileAttributes

Performs SSH_FXP_STAT request.

SendMessage ( SftpMessage sftpMessage ) : void
SendRequest ( SftpRequest request ) : void
TryLoadSftpMessage ( byte packetData, int offset, int count ) : bool

Описание методов

CalculateOptimalReadLength() публичный Метод

Calculates the optimal size of the buffer to read data from the channel.
public CalculateOptimalReadLength ( uint bufferSize ) : uint
bufferSize uint The buffer size configured on the client.
Результат uint

CalculateOptimalWriteLength() публичный Метод

Calculates the optimal size of the buffer to write data on the channel.
Currently, we do not take the remote window size into account.
public CalculateOptimalWriteLength ( uint bufferSize, byte handle ) : uint
bufferSize uint The buffer size configured on the client.
handle byte The file handle.
Результат uint

ChangeDirectory() публичный Метод

Changes the current working directory to the specified path.
public ChangeDirectory ( string path ) : void
path string The new working directory.
Результат void

Dispose() защищенный Метод

protected Dispose ( bool disposing ) : void
disposing bool
Результат void

GetCanonicalPath() публичный Метод

Resolves a given path into an absolute path on the server.
public GetCanonicalPath ( string path ) : string
path string The path to resolve.
Результат string

OnChannelOpen() защищенный Метод

protected OnChannelOpen ( ) : void
Результат void

OnDataReceived() защищенный Метод

protected OnDataReceived ( byte data ) : void
data byte
Результат void

RequestClose() публичный Метод

Performs SSH_FXP_CLOSE request.
public RequestClose ( byte handle ) : void
handle byte The handle.
Результат void

RequestFSetStat() публичный Метод

Performs SSH_FXP_FSETSTAT request.
public RequestFSetStat ( byte handle, SftpFileAttributes attributes ) : void
handle byte The handle.
attributes SftpFileAttributes The attributes.
Результат void

RequestFStat() публичный Метод

Performs SSH_FXP_FSTAT request.
public RequestFStat ( byte handle ) : SftpFileAttributes
handle byte The handle.
Результат SftpFileAttributes

RequestLStat() публичный Метод

Performs SSH_FXP_LSTAT request.
public RequestLStat ( string path ) : SftpFileAttributes
path string The path.
Результат SftpFileAttributes

RequestMkDir() публичный Метод

Performs SSH_FXP_MKDIR request.
public RequestMkDir ( string path ) : void
path string The path.
Результат void

RequestOpen() публичный Метод

Performs SSH_FXP_OPEN request
public RequestOpen ( string path, Flags flags, bool nullOnError = false ) : byte[]
path string The path.
flags System.Flags The flags.
nullOnError bool if set to true returns null instead of throwing an exception.
Результат byte[]

RequestOpenDir() публичный Метод

Performs SSH_FXP_OPENDIR request
public RequestOpenDir ( string path, bool nullOnError = false ) : byte[]
path string The path.
nullOnError bool if set to true returns null instead of throwing an exception.
Результат byte[]

RequestPosixRename() публичный Метод

Performs [email protected] extended request.
public RequestPosixRename ( string oldPath, string newPath ) : void
oldPath string The old path.
newPath string The new path.
Результат void

RequestRead() публичный Метод

Performs SSH_FXP_READ request.
public RequestRead ( byte handle, ulong offset, uint length ) : byte[]
handle byte The handle.
offset ulong The offset.
length uint The length.
Результат byte[]

RequestReadDir() публичный Метод

Performs SSH_FXP_READDIR request
public RequestReadDir ( byte handle ) : SftpFileAttributes>[].KeyValuePair
handle byte The handle.
Результат SftpFileAttributes>[].KeyValuePair

RequestRemove() публичный Метод

Performs SSH_FXP_REMOVE request.
public RequestRemove ( string path ) : void
path string The path.
Результат void

RequestRename() публичный Метод

Performs SSH_FXP_RENAME request.
public RequestRename ( string oldPath, string newPath ) : void
oldPath string The old path.
newPath string The new path.
Результат void

RequestRmDir() публичный Метод

Performs SSH_FXP_RMDIR request.
public RequestRmDir ( string path ) : void
path string The path.
Результат void

RequestSetStat() публичный Метод

Performs SSH_FXP_SETSTAT request.
public RequestSetStat ( string path, SftpFileAttributes attributes ) : void
path string The path.
attributes SftpFileAttributes The attributes.
Результат void

RequestStatVfs() публичный Метод

Performs [email protected] extended request.
public RequestStatVfs ( string path, bool nullOnError = false ) : SftpFileSytemInformation
path string The path.
nullOnError bool if set to true [null on error].
Результат SftpFileSytemInformation

RequestSymLink() публичный Метод

Performs SSH_FXP_SYMLINK request.
public RequestSymLink ( string linkpath, string targetpath ) : void
linkpath string The linkpath.
targetpath string The targetpath.
Результат void

RequestWrite() публичный Метод

Performs SSH_FXP_WRITE request.
public RequestWrite ( byte handle, ulong serverOffset, byte data, int offset, int length, AutoResetEvent wait, Action writeCompleted = null ) : void
handle byte The handle.
serverOffset ulong The the zero-based offset (in bytes) relative to the beginning of the file that the write must start at.
data byte The buffer holding the data to write.
offset int the zero-based offset in at which to begin taking bytes to write.
length int The length (in bytes) of the data to write.
wait System.Threading.AutoResetEvent The wait event handle if needed.
writeCompleted Action The callback to invoke when the write has completed.
Результат void

SftpSession() публичный Метод

public SftpSession ( ISession session, System.TimeSpan operationTimeout, Encoding encoding ) : System
session ISession
operationTimeout System.TimeSpan
encoding System.Text.Encoding
Результат System