C# Class Renci.SshNet.ScpClient

Provides SCP client functionality.
Datei anzeigen Open project: sshnet/SSH.NET Class Usage Examples

Public Methods

Method Description
Download ( string directoryName, DirectoryInfo directoryInfo ) : void

Downloads the specified directory from the remote host to local directory.

Download ( string filename, FileInfo fileInfo ) : void

Downloads the specified file from the remote host to local file.

Download ( string filename, Stream destination ) : void

Downloads the specified file from the remote host to the stream.

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

ScpClient ( ConnectionInfo connectionInfo ) : System

Initializes a new instance of the SftpClient class.

ScpClient ( string host, string username ) : System

Initializes a new instance of the SftpClient class.

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

Initializes a new instance of the SftpClient class.

Upload ( DirectoryInfo directoryInfo, string path ) : void

Uploads the specified directory to the remote host.

Upload ( FileInfo fileInfo, string path ) : void

Uploads the specified file to the remote host.

Upload ( Stream source, string path ) : void

Uploads the specified stream to the remote host.

Private Methods

Method Description
CheckReturnCode ( Stream input ) : void

Checks the return code.

InternalDownload ( IChannel channel, Stream input, Stream output, string filename, long length ) : void
InternalDownload ( IChannelSession channel, Stream input, FileSystemInfo fileSystemInfo ) : void
InternalSetTimestamp ( IChannelSession channel, Stream input, System.DateTime lastWriteTime, System.DateTime lastAccessime ) : void
InternalUpload ( IChannelSession channel, Stream input, DirectoryInfo directoryInfo ) : void
InternalUpload ( IChannelSession channel, Stream input, FileInfo fileInfo, string filename ) : void
InternalUpload ( IChannelSession channel, Stream input, Stream source, string filename ) : void
RaiseDownloadingEvent ( string filename, long size, long downloaded ) : void
RaiseUploadingEvent ( string filename, long size, long uploaded ) : void
ReadByte ( Stream stream ) : int
ReadString ( Stream stream ) : string
ScpClient ( ConnectionInfo connectionInfo, bool ownsConnectionInfo ) : System

Initializes a new instance of the ScpClient class.

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

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

Initializes a new instance of the ScpClient class.

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

ScpClient ( string host, int port, string username ) : System
ScpClient ( string host, int port, string username, string password ) : System
SendConfirmation ( IChannel channel ) : void
SendConfirmation ( IChannel channel, byte errorCode, string message ) : void
SendData ( IChannel channel, byte buffer ) : void
SendData ( IChannel channel, byte buffer, int length ) : void
SendData ( IChannel channel, string command ) : void

Method Details

Download() public method

Downloads the specified directory from the remote host to local directory.
is null or empty. is null.
public Download ( string directoryName, DirectoryInfo directoryInfo ) : void
directoryName string Remote host directory name.
directoryInfo System.IO.DirectoryInfo Local directory information.
return void

Download() public method

Downloads the specified file from the remote host to local file.
is null. is null or empty.
public Download ( string filename, FileInfo fileInfo ) : void
filename string Remote host file name.
fileInfo System.IO.FileInfo Local file information.
return void

Download() public method

Downloads the specified file from the remote host to the stream.
Method calls made by this method to destination, may under certain conditions result in exceptions thrown by the stream.
is null or contains only whitespace characters. is null.
public Download ( string filename, Stream destination ) : void
filename string Remote host file name.
destination Stream The stream where to download remote file.
return void

ScpClient() public method

Initializes a new instance of the SftpClient class.
is null.
public ScpClient ( ConnectionInfo connectionInfo ) : System
connectionInfo ConnectionInfo The connection info.
return System

ScpClient() public method

Initializes a new instance of the SftpClient class.
is null. is invalid, -or- is null or contains only whitespace characters.
public ScpClient ( string host, string username ) : System
host string Connection host.
username string Authentication username.
return System

ScpClient() public method

Initializes a new instance of the SftpClient class.
is null. is invalid, or is null or contains only whitespace characters.
public ScpClient ( string host, string username, string password ) : System
host string Connection host.
username string Authentication username.
password string Authentication password.
return System

Upload() public method

Uploads the specified directory to the remote host.
fileSystemInfo is null or empty.
public Upload ( DirectoryInfo directoryInfo, string path ) : void
directoryInfo System.IO.DirectoryInfo The directory info.
path string The path.
return void

Upload() public method

Uploads the specified file to the remote host.
is null. is null or empty.
public Upload ( FileInfo fileInfo, string path ) : void
fileInfo System.IO.FileInfo The file system info.
path string The path.
return void

Upload() public method

Uploads the specified stream to the remote host.
public Upload ( Stream source, string path ) : void
source Stream Stream to upload.
path string Remote host file name.
return void