C# Класс Renci.SshNet.SftpClient

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

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

Метод Описание
AppendAllLines ( string path, IEnumerable contents ) : void

Appends lines to a file, and closes the file.

AppendAllLines ( string path, IEnumerable contents, Encoding encoding ) : void

Appends lines to a file by using a specified encoding, and closes the file.

AppendAllText ( string path, string contents ) : void

Appends the specified string to the file, and closes the file.

AppendAllText ( string path, string contents, Encoding encoding ) : void

Appends the specified string to the file, and closes the file.

AppendText ( string path ) : StreamWriter

Creates a StreamWriter that appends UTF-8 encoded text to an existing file.

AppendText ( string path, Encoding encoding ) : StreamWriter

Creates a StreamWriter that appends text to an existing file using the specified encoding.

BeginDownloadFile ( string path, Stream output ) : IAsyncResult

Begins an asynchronous file downloading into the stream.

Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.

BeginDownloadFile ( string path, Stream output, AsyncCallback asyncCallback ) : IAsyncResult

Begins an asynchronous file downloading into the stream.

Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.

BeginDownloadFile ( string path, Stream output, AsyncCallback asyncCallback, object state, Action downloadCallback = null ) : IAsyncResult

Begins an asynchronous file downloading into the stream.

Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.

BeginListDirectory ( string path, AsyncCallback asyncCallback, object state, Action listCallback = null ) : IAsyncResult

Begins an asynchronous operation of retrieving list of files in remote directory.

BeginSynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern, AsyncCallback asyncCallback, object state ) : IAsyncResult

Begins the synchronize directories.

BeginUploadFile ( Stream input, string path ) : IAsyncResult

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

BeginUploadFile ( Stream input, string path, AsyncCallback asyncCallback ) : IAsyncResult

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

BeginUploadFile ( Stream input, string path, AsyncCallback asyncCallback, object state, Action uploadCallback = null ) : IAsyncResult

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

BeginUploadFile ( Stream input, string path, bool canOverride, AsyncCallback asyncCallback, object state, Action uploadCallback = null ) : IAsyncResult

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

When path refers to an existing file, set canOverride to true to overwrite and truncate that file. If canOverride is false, the upload will fail and EndUploadFile(IAsyncResult) will throw an SshException.

ChangeDirectory ( string path ) : void

Changes remote directory to path.

ChangePermissions ( string path, short mode ) : void

Changes permissions of file(s) to specified mode.

Create ( string path ) : SftpFileStream

Creates or overwrites a file in the specified path.

If the target file already exists, it is first truncated to zero bytes.

Create ( string path, int bufferSize ) : SftpFileStream

Creates or overwrites the specified file.

If the target file already exists, it is first truncated to zero bytes.

CreateDirectory ( string path ) : void

Creates remote directory specified by path.

CreateText ( string path ) : StreamWriter

Creates or opens a file for writing UTF-8 encoded text.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

CreateText ( string path, Encoding encoding ) : StreamWriter

Creates or opens a file for writing text using the specified encoding.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

Delete ( string path ) : void

Deletes the specified file or directory.

DeleteDirectory ( string path ) : void

Deletes remote directory specified by path.

DeleteFile ( string path ) : void

Deletes remote file specified by path.

DownloadFile ( string path, Stream output, Action downloadCallback = null ) : void

Downloads remote file specified by the path into the stream.

Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.

EndDownloadFile ( IAsyncResult asyncResult ) : void

Ends an asynchronous file downloading into the stream.

EndListDirectory ( IAsyncResult asyncResult ) : IEnumerable

Ends an asynchronous operation of retrieving list of files in remote directory.

EndSynchronizeDirectories ( IAsyncResult asyncResult ) : IEnumerable

Ends the synchronize directories.

EndUploadFile ( IAsyncResult asyncResult ) : void

Ends an asynchronous uploading the stream into remote file.

Exists ( string path ) : bool

Checks whether file or directory exists;

Get ( string path ) : SftpFile

Gets reference to remote file or directory.

GetAttributes ( string path ) : SftpFileAttributes

Gets the SftpFileAttributes of the file on the path.

GetLastAccessTime ( string path ) : DateTime

Returns the date and time the specified file or directory was last accessed.

GetLastAccessTimeUtc ( string path ) : DateTime

Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.

GetLastWriteTime ( string path ) : DateTime

Returns the date and time the specified file or directory was last written to.

GetLastWriteTimeUtc ( string path ) : DateTime

Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.

GetStatus ( string path ) : SftpFileSytemInformation

Gets status using [email protected] request.

ListDirectory ( string path, Action listCallback = null ) : IEnumerable

Retrieves list of files in remote directory.

Open ( string path, FileMode mode ) : SftpFileStream

Opens a SftpFileStream on the specified path with read/write access.

Open ( string path, FileMode mode, FileAccess access ) : SftpFileStream

Opens a SftpFileStream on the specified path, with the specified mode and access.

OpenRead ( string path ) : SftpFileStream

Opens an existing file for reading.

OpenText ( string path ) : StreamReader

Opens an existing UTF-8 encoded text file for reading.

OpenWrite ( string path ) : SftpFileStream

Opens a file for writing.

If the file does not exist, it is created.

ReadAllBytes ( string path ) : byte[]

Opens a binary file, reads the contents of the file into a byte array, and closes the file.

ReadAllLines ( string path ) : string[]

Opens a text file, reads all lines of the file using UTF-8 encoding, and closes the file.

ReadAllLines ( string path, Encoding encoding ) : string[]

Opens a file, reads all lines of the file with the specified encoding, and closes the file.

ReadAllText ( string path ) : string

Opens a text file, reads all lines of the file with the UTF-8 encoding, and closes the file.

ReadAllText ( string path, Encoding encoding ) : string

Opens a file, reads all lines of the file with the specified encoding, and closes the file.

ReadLines ( string path ) : IEnumerable

Reads the lines of a file with the UTF-8 encoding.

ReadLines ( string path, Encoding encoding ) : IEnumerable

Read the lines of a file that has a specified encoding.

RenameFile ( string oldPath, string newPath ) : void

Renames remote file from old path to new path.

RenameFile ( string oldPath, string newPath, bool isPosix ) : void

Renames remote file from old path to new path.

SetAttributes ( string path, SftpFileAttributes fileAttributes ) : void

Sets the specified SftpFileAttributes of the file on the specified path.

SftpClient ( ConnectionInfo connectionInfo ) : System

Initializes a new instance of the SftpClient class.

SftpClient ( string host, string username ) : System

Initializes a new instance of the SftpClient class.

SftpClient ( string host, string username, string password ) : System

Initializes a new instance of the SftpClient class.

SymbolicLink ( string path, string linkPath ) : void

Creates a symbolic link from old path to new path.

SynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern ) : IEnumerable

Synchronizes the directories.

UploadFile ( Stream input, string path, Action uploadCallback = null ) : void

Uploads stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

UploadFile ( Stream input, string path, bool canOverride, Action uploadCallback = null ) : void

Uploads stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

WriteAllBytes ( string path, byte bytes ) : void

Writes the specified byte array to the specified file, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllLines ( string path, IEnumerable contents ) : void

Writes a collection of strings to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllLines ( string path, IEnumerable contents, Encoding encoding ) : void

Writes a collection of strings to the file using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllLines ( string path, string contents ) : void

Write the specified string array to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllLines ( string path, string contents, Encoding encoding ) : void

Writes the specified string array to the file by using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllText ( string path, string contents ) : void

Writes the specified string to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllText ( string path, string contents, Encoding encoding ) : void

Writes the specified string to the file using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

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

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

Releases unmanaged and - optionally - managed resources

OnConnected ( ) : void

Called when client is connected to the server.

OnDisconnecting ( ) : void

Called when client is disconnecting from the server.

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

Метод Описание
InternalDownloadFile ( string path, Stream output, SftpDownloadAsyncResult asyncResult, Action downloadCallback ) : void

Internals the download file.

InternalListDirectory ( string path, Action listCallback ) : IEnumerable

Internals the list directory.

InternalSynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern, SftpSynchronizeDirectoriesAsyncResult asynchResult ) : IEnumerable
InternalUploadFile ( Stream input, string path, Flags flags, SftpUploadAsyncResult asyncResult, Action uploadCallback ) : void

Internals the upload file.

SetLastAccessTime ( string path, DateTime lastAccessTime ) : void
SetLastAccessTimeUtc ( string path, DateTime lastAccessTimeUtc ) : void
SetLastWriteTime ( string path, DateTime lastWriteTime ) : void
SetLastWriteTimeUtc ( string path, DateTime lastWriteTimeUtc ) : void
SftpClient ( ConnectionInfo connectionInfo, bool ownsConnectionInfo ) : System

Initializes a new instance of the SftpClient class.

If ownsConnectionInfo is true, the connection info will be disposed when this instance is disposed.

SftpClient ( ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory ) : System

Initializes a new instance of the SftpClient class.

If ownsConnectionInfo is true, the connection info will be disposed when this instance is disposed.

SftpClient ( string host, int port, string username ) : System
SftpClient ( string host, int port, string username, string password ) : System

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

AppendAllLines() публичный метод

Appends lines to a file, and closes the file.
isnull -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendAllLines ( string path, IEnumerable contents ) : void
path string The file to append the lines to. The file is created if it does not already exist.
contents IEnumerable The lines to append to the file.
Результат void

AppendAllLines() публичный метод

Appends lines to a file by using a specified encoding, and closes the file.
is null. -or- is null. -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendAllLines ( string path, IEnumerable contents, Encoding encoding ) : void
path string The file to append the lines to. The file is created if it does not already exist.
contents IEnumerable The lines to append to the file.
encoding System.Text.Encoding The character encoding to use.
Результат void

AppendAllText() публичный метод

Appends the specified string to the file, and closes the file.
is null. -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendAllText ( string path, string contents ) : void
path string The file to append the specified string to.
contents string The string to append to the file.
Результат void

AppendAllText() публичный метод

Appends the specified string to the file, and closes the file.
is null. -or- is null. -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendAllText ( string path, string contents, Encoding encoding ) : void
path string The file to append the specified string to.
contents string The string to append to the file.
encoding System.Text.Encoding The character encoding to use.
Результат void

AppendText() публичный метод

Creates a StreamWriter that appends UTF-8 encoded text to an existing file.
is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendText ( string path ) : StreamWriter
path string The path to the file to append to.
Результат System.IO.StreamWriter

AppendText() публичный метод

Creates a StreamWriter that appends text to an existing file using the specified encoding.
is null. -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendText ( string path, Encoding encoding ) : StreamWriter
path string The path to the file to append to.
encoding System.Text.Encoding The character encoding to use.
Результат System.IO.StreamWriter

BeginDownloadFile() публичный метод

Begins an asynchronous file downloading into the stream.
Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginDownloadFile ( string path, Stream output ) : IAsyncResult
path string The path.
output Stream The output.
Результат IAsyncResult

BeginDownloadFile() публичный метод

Begins an asynchronous file downloading into the stream.
Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginDownloadFile ( string path, Stream output, AsyncCallback asyncCallback ) : IAsyncResult
path string The path.
output Stream The output.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
Результат IAsyncResult

BeginDownloadFile() публичный метод

Begins an asynchronous file downloading into the stream.
Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. The method was called after the client was disposed.
public BeginDownloadFile ( string path, Stream output, AsyncCallback asyncCallback, object state, Action downloadCallback = null ) : IAsyncResult
path string The path.
output Stream The output.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
state object A user-provided object that distinguishes this particular asynchronous write request from other requests.
downloadCallback Action The download callback.
Результат IAsyncResult

BeginListDirectory() публичный метод

Begins an asynchronous operation of retrieving list of files in remote directory.
The method was called after the client was disposed.
public BeginListDirectory ( string path, AsyncCallback asyncCallback, object state, Action listCallback = null ) : IAsyncResult
path string The path.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
state object A user-provided object that distinguishes this particular asynchronous write request from other requests.
listCallback Action The list callback.
Результат IAsyncResult

BeginSynchronizeDirectories() публичный метод

Begins the synchronize directories.
is null. is null or contains only whitespace.
public BeginSynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern, AsyncCallback asyncCallback, object state ) : IAsyncResult
sourcePath string The source path.
destinationPath string The destination path.
searchPattern string The search pattern.
asyncCallback AsyncCallback The async callback.
state object The state.
Результат IAsyncResult

BeginUploadFile() публичный метод

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

is null. is null or contains only whitespace characters. Client is not connected. Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginUploadFile ( Stream input, string path ) : IAsyncResult
input Stream Data input stream.
path string Remote file path.
Результат IAsyncResult

BeginUploadFile() публичный метод

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

is null. is null or contains only whitespace characters. Client is not connected. Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginUploadFile ( Stream input, string path, AsyncCallback asyncCallback ) : IAsyncResult
input Stream Data input stream.
path string Remote file path.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
Результат IAsyncResult

BeginUploadFile() публичный метод

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

is null. is null or contains only whitespace characters. Client is not connected. Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginUploadFile ( Stream input, string path, AsyncCallback asyncCallback, object state, Action uploadCallback = null ) : IAsyncResult
input Stream Data input stream.
path string Remote file path.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
state object A user-provided object that distinguishes this particular asynchronous write request from other requests.
uploadCallback Action The upload callback.
Результат IAsyncResult

BeginUploadFile() публичный метод

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

When path refers to an existing file, set canOverride to true to overwrite and truncate that file. If canOverride is false, the upload will fail and EndUploadFile(IAsyncResult) will throw an SshException.

is null. is null or contains only whitespace characters. The method was called after the client was disposed.
public BeginUploadFile ( Stream input, string path, bool canOverride, AsyncCallback asyncCallback, object state, Action uploadCallback = null ) : IAsyncResult
input Stream Data input stream.
path string Remote file path.
canOverride bool Specified whether an existing file can be overwritten.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
state object A user-provided object that distinguishes this particular asynchronous write request from other requests.
uploadCallback Action The upload callback.
Результат IAsyncResult

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

Changes remote directory to path.
is null. Client is not connected. Permission to change directory denied by remote host. -or- A SSH command was denied by the server. was not found on the remote host. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public ChangeDirectory ( string path ) : void
path string New directory path.
Результат void

ChangePermissions() публичный метод

Changes permissions of file(s) to specified mode.
is null. Client is not connected. Permission to change permission on the path(s) was denied by the remote host. -or- A SSH command was denied by the server. was not found on the remote host. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public ChangePermissions ( string path, short mode ) : void
path string File(s) path, may match multiple files.
mode short The mode.
Результат void

Create() публичный метод

Creates or overwrites a file in the specified path.
If the target file already exists, it is first truncated to zero bytes.
is null. Client is not connected. The method was called after the client was disposed.
public Create ( string path ) : SftpFileStream
path string The path and name of the file to create.
Результат Renci.SshNet.Sftp.SftpFileStream

Create() публичный метод

Creates or overwrites the specified file.
If the target file already exists, it is first truncated to zero bytes.
is null. Client is not connected. The method was called after the client was disposed.
public Create ( string path, int bufferSize ) : SftpFileStream
path string The path and name of the file to create.
bufferSize int The maximum number of bytes buffered for reads and writes to the file.
Результат Renci.SshNet.Sftp.SftpFileStream

CreateDirectory() публичный метод

Creates remote directory specified by path.
is null or contains only whitespace characters. Client is not connected. Permission to create the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public CreateDirectory ( string path ) : void
path string Directory path to create.
Результат void

CreateText() публичный метод

Creates or opens a file for writing UTF-8 encoded text.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public CreateText ( string path ) : StreamWriter
path string The file to be opened for writing.
Результат System.IO.StreamWriter

CreateText() публичный метод

Creates or opens a file for writing text using the specified encoding.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public CreateText ( string path, Encoding encoding ) : StreamWriter
path string The file to be opened for writing.
encoding Encoding The character encoding to use.
Результат StreamWriter

Delete() публичный метод

Deletes the specified file or directory.
is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public Delete ( string path ) : void
path string The name of the file or directory to be deleted. Wildcard characters are not supported.
Результат void

DeleteDirectory() публичный метод

Deletes remote directory specified by path.
is null or contains only whitespace characters. Client is not connected. was not found on the remote host. Permission to delete the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public DeleteDirectory ( string path ) : void
path string Directory to be deleted path.
Результат void

DeleteFile() публичный метод

Deletes remote file specified by path.
is null or contains only whitespace characters. Client is not connected. was not found on the remote host. Permission to delete the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public DeleteFile ( string path ) : void
path string File to be deleted path.
Результат void

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

Releases unmanaged and - optionally - managed resources
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
Результат void

DownloadFile() публичный метод

Downloads remote file specified by the path into the stream.
Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. was not found on the remote host. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public DownloadFile ( string path, Stream output, Action downloadCallback = null ) : void
path string File to download.
output Stream Stream to write the file into.
downloadCallback Action The download callback.
Результат void

EndDownloadFile() публичный метод

Ends an asynchronous file downloading into the stream.
The object did not come from the corresponding async method on this type.-or- was called multiple times with the same . Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. The path was not found on the remote host. A SSH error where is the message from the remote host.
public EndDownloadFile ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult The pending asynchronous SFTP request.
Результат void

EndListDirectory() публичный метод

Ends an asynchronous operation of retrieving list of files in remote directory.
The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
public EndListDirectory ( IAsyncResult asyncResult ) : IEnumerable
asyncResult IAsyncResult The pending asynchronous SFTP request.
Результат IEnumerable

EndSynchronizeDirectories() публичный метод

Ends the synchronize directories.
The object did not come from the corresponding async method on this type.-or- was called multiple times with the same . The destination path was not found on the remote host.
public EndSynchronizeDirectories ( IAsyncResult asyncResult ) : IEnumerable
asyncResult IAsyncResult The async result.
Результат IEnumerable

EndUploadFile() публичный метод

Ends an asynchronous uploading the stream into remote file.
The object did not come from the corresponding async method on this type.-or- was called multiple times with the same . Client is not connected. The directory of the file was not found on the remote host. Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host.
public EndUploadFile ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult The pending asynchronous SFTP request.
Результат void

Exists() публичный метод

Checks whether file or directory exists;
is null or contains only whitespace characters. Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public Exists ( string path ) : bool
path string The path.
Результат bool

Get() публичный метод

Gets reference to remote file or directory.
Client is not connected. was not found on the remote host. is null. The method was called after the client was disposed.
public Get ( string path ) : SftpFile
path string The path.
Результат SftpFile

GetAttributes() публичный метод

Gets the SftpFileAttributes of the file on the path.
is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public GetAttributes ( string path ) : SftpFileAttributes
path string The path to the file.
Результат SftpFileAttributes

GetLastAccessTime() публичный метод

Returns the date and time the specified file or directory was last accessed.
is null. Client is not connected. The method was called after the client was disposed.
public GetLastAccessTime ( string path ) : DateTime
path string The file or directory for which to obtain access date and time information.
Результат DateTime

GetLastAccessTimeUtc() публичный метод

Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.
is null. Client is not connected. The method was called after the client was disposed.
public GetLastAccessTimeUtc ( string path ) : DateTime
path string The file or directory for which to obtain access date and time information.
Результат DateTime

GetLastWriteTime() публичный метод

Returns the date and time the specified file or directory was last written to.
is null. Client is not connected. The method was called after the client was disposed.
public GetLastWriteTime ( string path ) : DateTime
path string The file or directory for which to obtain write date and time information.
Результат DateTime

GetLastWriteTimeUtc() публичный метод

Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.
is null. Client is not connected. The method was called after the client was disposed.
public GetLastWriteTimeUtc ( string path ) : DateTime
path string The file or directory for which to obtain write date and time information.
Результат DateTime

GetStatus() публичный метод

Gets status using [email protected] request.
Client is not connected. is null. The method was called after the client was disposed.
public GetStatus ( string path ) : SftpFileSytemInformation
path string The path.
Результат SftpFileSytemInformation

ListDirectory() публичный метод

Retrieves list of files in remote directory.
is null. Client is not connected. Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public ListDirectory ( string path, Action listCallback = null ) : IEnumerable
path string The path.
listCallback Action The list callback.
Результат IEnumerable

OnConnected() защищенный метод

Called when client is connected to the server.
protected OnConnected ( ) : void
Результат void

OnDisconnecting() защищенный метод

Called when client is disconnecting from the server.
protected OnDisconnecting ( ) : void
Результат void

Open() публичный метод

Opens a SftpFileStream on the specified path with read/write access.
is null. Client is not connected. The method was called after the client was disposed.
public Open ( string path, FileMode mode ) : SftpFileStream
path string The file to open.
mode FileMode A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.
Результат SftpFileStream

Open() публичный метод

Opens a SftpFileStream on the specified path, with the specified mode and access.
is null. Client is not connected. The method was called after the client was disposed.
public Open ( string path, FileMode mode, FileAccess access ) : SftpFileStream
path string The file to open.
mode FileMode A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.
access FileAccess A value that specifies the operations that can be performed on the file.
Результат SftpFileStream

OpenRead() публичный метод

Opens an existing file for reading.
is null. Client is not connected. The method was called after the client was disposed.
public OpenRead ( string path ) : SftpFileStream
path string The file to be opened for reading.
Результат SftpFileStream

OpenText() публичный метод

Opens an existing UTF-8 encoded text file for reading.
is null. Client is not connected. The method was called after the client was disposed.
public OpenText ( string path ) : StreamReader
path string The file to be opened for reading.
Результат StreamReader

OpenWrite() публичный метод

Opens a file for writing.
If the file does not exist, it is created.
is null. Client is not connected. The method was called after the client was disposed.
public OpenWrite ( string path ) : SftpFileStream
path string The file to be opened for writing.
Результат SftpFileStream

ReadAllBytes() публичный метод

Opens a binary file, reads the contents of the file into a byte array, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllBytes ( string path ) : byte[]
path string The file to open for reading.
Результат byte[]

ReadAllLines() публичный метод

Opens a text file, reads all lines of the file using UTF-8 encoding, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllLines ( string path ) : string[]
path string The file to open for reading.
Результат string[]

ReadAllLines() публичный метод

Opens a file, reads all lines of the file with the specified encoding, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllLines ( string path, Encoding encoding ) : string[]
path string The file to open for reading.
encoding Encoding The encoding applied to the contents of the file.
Результат string[]

ReadAllText() публичный метод

Opens a text file, reads all lines of the file with the UTF-8 encoding, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllText ( string path ) : string
path string The file to open for reading.
Результат string

ReadAllText() публичный метод

Opens a file, reads all lines of the file with the specified encoding, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllText ( string path, Encoding encoding ) : string
path string The file to open for reading.
encoding Encoding The encoding applied to the contents of the file.
Результат string

ReadLines() публичный метод

Reads the lines of a file with the UTF-8 encoding.
is null. Client is not connected. The method was called after the client was disposed.
public ReadLines ( string path ) : IEnumerable
path string The file to read.
Результат IEnumerable

ReadLines() публичный метод

Read the lines of a file that has a specified encoding.
is null. Client is not connected. The method was called after the client was disposed.
public ReadLines ( string path, Encoding encoding ) : IEnumerable
path string The file to read.
encoding Encoding The encoding that is applied to the contents of the file.
Результат IEnumerable

RenameFile() публичный метод

Renames remote file from old path to new path.
is null. -or- or is null. Client is not connected. Permission to rename the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public RenameFile ( string oldPath, string newPath ) : void
oldPath string Path to the old file location.
newPath string Path to the new file location.
Результат void

RenameFile() публичный метод

Renames remote file from old path to new path.
is null. -or- or is null. Client is not connected. Permission to rename the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public RenameFile ( string oldPath, string newPath, bool isPosix ) : void
oldPath string Path to the old file location.
newPath string Path to the new file location.
isPosix bool if set to true then perform a posix rename.
Результат void

SetAttributes() публичный метод

Sets the specified SftpFileAttributes of the file on the specified path.
is null. Client is not connected. The method was called after the client was disposed.
public SetAttributes ( string path, SftpFileAttributes fileAttributes ) : void
path string The path to the file.
fileAttributes SftpFileAttributes The desired .
Результат void

SftpClient() публичный метод

Initializes a new instance of the SftpClient class.
is null.
public SftpClient ( ConnectionInfo connectionInfo ) : System
connectionInfo ConnectionInfo The connection info.
Результат System

SftpClient() публичный метод

Initializes a new instance of the SftpClient class.
is null. is invalid. -or- is null or contains only whitespace characters.
public SftpClient ( string host, string username ) : System
host string Connection host.
username string Authentication username.
Результат System

SftpClient() публичный метод

Initializes a new instance of the SftpClient class.
is null. is invalid. -or- is null contains only whitespace characters.
public SftpClient ( string host, string username, string password ) : System
host string Connection host.
username string Authentication username.
password string Authentication password.
Результат System

SymbolicLink() публичный метод

Creates a symbolic link from old path to new path.
is null. -or- is null or contains only whitespace characters. Client is not connected. Permission to create the symbolic link was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public SymbolicLink ( string path, string linkPath ) : void
path string The old path.
linkPath string The new path.
Результат void

SynchronizeDirectories() публичный метод

Synchronizes the directories.
is null. is null or contains only whitespace. was not found on the remote host.
public SynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern ) : IEnumerable
sourcePath string The source path.
destinationPath string The destination path.
searchPattern string The search pattern.
Результат IEnumerable

UploadFile() публичный метод

Uploads stream into remote file.
Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public UploadFile ( Stream input, string path, Action uploadCallback = null ) : void
input Stream Data input stream.
path string Remote file path.
uploadCallback Action The upload callback.
Результат void

UploadFile() публичный метод

Uploads stream into remote file.
Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public UploadFile ( Stream input, string path, bool canOverride, Action uploadCallback = null ) : void
input Stream Data input stream.
path string Remote file path.
canOverride bool if set to true then existing file will be overwritten.
uploadCallback Action The upload callback.
Результат void

WriteAllBytes() публичный метод

Writes the specified byte array to the specified file, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllBytes ( string path, byte bytes ) : void
path string The file to write to.
bytes byte The bytes to write to the file.
Результат void

WriteAllLines() публичный метод

Writes a collection of strings to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllLines ( string path, IEnumerable contents ) : void
path string The file to write to.
contents IEnumerable The lines to write to the file.
Результат void

WriteAllLines() публичный метод

Writes a collection of strings to the file using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllLines ( string path, IEnumerable contents, Encoding encoding ) : void
path string The file to write to.
contents IEnumerable The lines to write to the file.
encoding Encoding The character encoding to use.
Результат void

WriteAllLines() публичный метод

Write the specified string array to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllLines ( string path, string contents ) : void
path string The file to write to.
contents string The string array to write to the file.
Результат void

WriteAllLines() публичный метод

Writes the specified string array to the file by using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllLines ( string path, string contents, Encoding encoding ) : void
path string The file to write to.
contents string The string array to write to the file.
encoding Encoding An object that represents the character encoding applied to the string array.
Результат void

WriteAllText() публичный метод

Writes the specified string to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllText ( string path, string contents ) : void
path string The file to write to.
contents string The string to write to the file.
Результат void

WriteAllText() публичный метод

Writes the specified string to the file using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllText ( string path, string contents, Encoding encoding ) : void
path string The file to write to.
contents string The string to write to the file.
encoding Encoding The encoding to apply to the string.
Результат void