Updated documentation for exceptions.

This commit is contained in:
Kenneth_aa_cp
2012-05-01 09:22:42 +00:00
parent cefb74bf1e
commit af05714f97
+91 -91
View File
@@ -12,7 +12,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Renci.SshNet
{
/// <summary>
///
/// Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
/// </summary>
public partial class SftpClient : BaseClient
{
@@ -59,7 +59,7 @@ namespace Renci.SshNet
/// Initializes a new instance of the <see cref="SftpClient"/> class.
/// </summary>
/// <param name="connectionInfo">The connection info.</param>
/// <exception cref="ArgumentNullException"><paramref name="connectionInfo"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="connectionInfo"/> is <b>null</b>.</exception>
public SftpClient(ConnectionInfo connectionInfo)
: base(connectionInfo)
{
@@ -74,8 +74,8 @@ namespace Renci.SshNet
/// <param name="port">Connection port.</param>
/// <param name="username">Authentication username.</param>
/// <param name="password">Authentication password.</param>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid. <para>-or-</para> <paramref name="username"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="System.Net.IPEndPoint.MinPort"/> and <see cref="System.Net.IPEndPoint.MaxPort"/>.</exception>
[SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "Disposed in Dispose(bool) method.")]
public SftpClient(string host, int port, string username, string password)
@@ -90,8 +90,8 @@ namespace Renci.SshNet
/// <param name="host">Connection host.</param>
/// <param name="username">Authentication username.</param>
/// <param name="password">Authentication password.</param>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="password"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid. <para>-or-</para> <paramref name="username"/> is <b>null</b> contains whitespace characters.</exception>
public SftpClient(string host, string username, string password)
: this(host, 22, username, password)
{
@@ -104,8 +104,8 @@ namespace Renci.SshNet
/// <param name="port">Connection port.</param>
/// <param name="username">Authentication username.</param>
/// <param name="keyFiles">Authentication private key file(s) .</param>
/// <exception cref="ArgumentNullException"><paramref name="keyFiles"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, -or- <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="keyFiles"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid. <para>-or-</para> <paramref name="username"/> is nu<b>null</b>ll or contains whitespace characters.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="System.Net.IPEndPoint.MinPort"/> and <see cref="System.Net.IPEndPoint.MaxPort"/>.</exception>
[SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "Disposed in Dispose(bool) method.")]
public SftpClient(string host, int port, string username, params PrivateKeyFile[] keyFiles)
@@ -120,8 +120,8 @@ namespace Renci.SshNet
/// <param name="host">Connection host.</param>
/// <param name="username">Authentication username.</param>
/// <param name="keyFiles">Authentication private key file(s) .</param>
/// <exception cref="ArgumentNullException"><paramref name="keyFiles"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid, -or- <paramref name="username"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="keyFiles"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="host"/> is invalid. <para>-or-</para> <paramref name="username"/> is <b>null</b> or contains whitespace characters.</exception>
public SftpClient(string host, string username, params PrivateKeyFile[] keyFiles)
: this(host, 22, username, keyFiles)
{
@@ -133,9 +133,9 @@ namespace Renci.SshNet
/// Changes remote directory to path.
/// </summary>
/// <param name="path">New directory path.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="SftpPermissionDeniedException">Permission to change directory denied by remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="SftpPermissionDeniedException">Permission to change directory denied by remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="SftpPathNotFoundException">The path in <paramref name="path"/> was not found on the remote host.</exception>
/// <exception cref="SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
public void ChangeDirectory(string path)
@@ -154,9 +154,9 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">File(s) path, may match multiple files.</param>
/// <param name="mode">The mode.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="SftpPermissionDeniedException">Permission to change permission on the path(s) was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="SftpPermissionDeniedException">Permission to change permission on the path(s) was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="SftpPathNotFoundException">The path in <paramref name="path"/> was not found on the remote host.</exception>
/// <exception cref="SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
public void ChangePermissions(string path, short mode)
@@ -170,9 +170,9 @@ namespace Renci.SshNet
/// Creates remote directory specified by path.
/// </summary>
/// <param name="path">Directory path to create.</param>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to create the directory was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to create the directory was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
public void CreateDirectory(string path)
{
@@ -191,9 +191,9 @@ namespace Renci.SshNet
/// Deletes remote directory specified by path.
/// </summary>
/// <param name="path">Directory to be deleted path.</param>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to delete the directory was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to delete the directory was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
public void DeleteDirectory(string path)
{
@@ -212,9 +212,9 @@ namespace Renci.SshNet
/// Deletes remote file specified by path.
/// </summary>
/// <param name="path">File to be deleted path.</param>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to delete the file was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to delete the file was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
public void DeleteFile(string path)
{
@@ -234,9 +234,9 @@ namespace Renci.SshNet
/// </summary>
/// <param name="oldPath">Path to the old file location.</param>
/// <param name="newPath">Path to the new file location.</param>
/// <exception cref="ArgumentNullException"><paramref name="oldPath"/> or <paramref name="newPath"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="oldPath"/> is <b>null</b>. <para>-or-</para> or <paramref name="newPath"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to rename the file was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to rename the file was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
public void RenameFile(string oldPath, string newPath)
{
@@ -261,9 +261,9 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The old path.</param>
/// <param name="linkPath">The new path.</param>
/// <exception cref="ArgumentException"><paramref name="path"/> or <paramref name="linkPath"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b>. <para>-or-</para> <paramref name="linkPath"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to create the symbolic link was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to create the symbolic link was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
public void SymbolicLink(string path, string linkPath)
{
@@ -288,9 +288,9 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The path.</param>
/// <returns>List of directory entries</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to list the contents of the directory was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to list the contents of the directory was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
public IEnumerable<SftpFile> ListDirectory(string path)
{
@@ -334,7 +334,7 @@ namespace Renci.SshNet
/// <returns>
/// List of files
/// </returns>
/// <exception cref="ArgumentException">Either the IAsyncResult object (<paramref name="asyncResult"/>) did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.</exception>
/// <exception cref="ArgumentException">The IAsyncResult object (<paramref name="asyncResult"/>) did not come from the corresponding async method on this type. <para>-or-</para> EndExecute was called multiple times with the same IAsyncResult.</exception>
public IEnumerable<SftpFile> EndListDirectory(IAsyncResult asyncResult)
{
var ar = asyncResult as SftpListDirectoryAsyncResult;
@@ -352,7 +352,7 @@ namespace Renci.SshNet
/// <param name="path">The path.</param>
/// <returns></returns>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public SftpFile Get(string path)
{
if (path == null)
@@ -373,9 +373,9 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if directory or file exists; otherwise <c>false</c>.</returns>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to perform the operation was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to perform the operation was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
public bool Exists(string path)
{
@@ -411,10 +411,10 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">File to download.</param>
/// <param name="output">Stream to write the file into.</param>
/// <exception cref="ArgumentNullException"><paramref name="output"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="output"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to perform the operation was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to perform the operation was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>Method calls made by this method to <paramref name="output"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
public void DownloadFile(string path, Stream output)
@@ -430,10 +430,10 @@ namespace Renci.SshNet
/// <param name="asyncCallback">The method to be called when the asynchronous write operation is completed.</param>
/// <param name="state">A user-provided object that distinguishes this particular asynchronous write request from other requests.</param>
/// <returns>An <see cref="IAsyncResult"/> that references the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException"><paramref name="output"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="output"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to perform the operation was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to perform the operation was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>Method calls made by this method to <paramref name="output"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
public IAsyncResult BeginDownloadFile(string path, Stream output, AsyncCallback asyncCallback, object state)
@@ -470,7 +470,7 @@ namespace Renci.SshNet
/// Ends an asynchronous file downloading into the stream.
/// </summary>
/// <param name="asyncResult">The pending asynchronous SFTP request.</param>
/// <exception cref="ArgumentException">Either the IAsyncResult object (<paramref name="asyncResult"/>) did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.</exception>
/// <exception cref="ArgumentException">The IAsyncResult object (<paramref name="asyncResult"/>) did not come from the corresponding async method on this type. <para>-or-</para> EndExecute was called multiple times with the same IAsyncResult.</exception>
public void EndDownloadFile(IAsyncResult asyncResult)
{
var ar = asyncResult as SftpDownloadAsyncResult;
@@ -487,10 +487,10 @@ namespace Renci.SshNet
/// </summary>
/// <param name="input">Data input stream.</param>
/// <param name="path">Remote file path.</param>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to upload the file was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to upload the file was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>Method calls made by this method to <paramref name="input"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
public void UploadFile(Stream input, string path)
@@ -504,10 +504,10 @@ namespace Renci.SshNet
/// <param name="input">Data input stream.</param>
/// <param name="path">Remote file path.</param>
/// <param name="canOverride">if set to <c>true</c> then existing file will be overwritten.</param>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to upload the file was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to upload the file was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>
/// Method calls made by this method to <paramref name="input"/>, may under certain conditions result in exceptions thrown by the stream.
@@ -532,10 +532,10 @@ namespace Renci.SshNet
/// <param name="asyncCallback">The method to be called when the asynchronous write operation is completed.</param>
/// <param name="state">A user-provided object that distinguishes this particular asynchronous write request from other requests.</param>
/// <returns>An <see cref="IAsyncResult"/> that references the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to list the contents of the directory was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to list the contents of the directory was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>Method calls made by this method to <paramref name="input"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
public IAsyncResult BeginUploadFile(Stream input, string path, AsyncCallback asyncCallback, object state)
@@ -552,10 +552,10 @@ namespace Renci.SshNet
/// <param name="asyncCallback">The method to be called when the asynchronous write operation is completed.</param>
/// <param name="state">A user-provided object that distinguishes this particular asynchronous write request from other requests.</param>
/// <returns>An <see cref="IAsyncResult"/> that references the asynchronous operation.</returns>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace characters.</exception>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace characters.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to list the contents of the directory was denied by the remote host -or- a SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SftpPermissionDeniedException">Permission to list the contents of the directory was denied by the remote host. <para>-or-</para> A SSH command was denied by the server.</exception>
/// <exception cref="Renci.SshNet.Common.SshException">A SSH error where <see cref="P:SshException.Message"/> is the message from the remote host.</exception>
/// <remarks>Method calls made by this method to <paramref name="input"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
public IAsyncResult BeginUploadFile(Stream input, string path, bool canOverride, AsyncCallback asyncCallback, object state)
@@ -599,7 +599,7 @@ namespace Renci.SshNet
/// Ends an asynchronous uploading the steam into remote file.
/// </summary>
/// <param name="asyncResult">The pending asynchronous SFTP request.</param>
/// <exception cref="ArgumentException">Either the IAsyncResult object (<paramref name="asyncResult"/>) did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.</exception>
/// <exception cref="ArgumentException">The IAsyncResult object (<paramref name="asyncResult"/>) did not come from the corresponding async method on this type. <para>-or-</para> EndExecute was called multiple times with the same IAsyncResult.</exception>
public void EndUploadFile(IAsyncResult asyncResult)
{
var ar = asyncResult as SftpUploadAsyncResult;
@@ -618,7 +618,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to append the lines to. The file is created if it does not already exist.</param>
/// <param name="contents">The lines to append to the file.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> or <paramref name="contents"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is<b>null</b> <para>-or-</para> <paramref name="contents"/> is <b>null</b>.</exception>
public void AppendAllLines(string path, IEnumerable<string> contents)
{
if (contents == null)
@@ -639,7 +639,7 @@ namespace Renci.SshNet
/// <param name="path">The file to append the lines to. The file is created if it does not already exist.</param>
/// <param name="contents">The lines to append to the file.</param>
/// <param name="encoding">The character encoding to use.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/>, <paramref name="contents"/> or <paramref name="encoding"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>. <para>-or-</para> <paramref name="contents"/> is <b>null</b>. <para>-or-</para> <paramref name="encoding"/> is <b>null</b>.</exception>
public void AppendAllLines(string path, IEnumerable<string> contents, Encoding encoding)
{
if (contents == null)
@@ -660,7 +660,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to append the specified string to.</param>
/// <param name="contents">The string to append to the file.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> or <paramref name="contents"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>. <para>-or-</para> <paramref name="contents"/> is <b>null</b>.</exception>
public void AppendAllText(string path, string contents)
{
using (var stream = this.AppendText(path))
@@ -676,7 +676,7 @@ namespace Renci.SshNet
/// <param name="path">The file to append the specified string to.</param>
/// <param name="contents">The string to append to the file.</param>
/// <param name="encoding">The character encoding to use.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/>, <paramref name="contents"/> or <paramref name="encoding"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>. <para>-or-</para> <paramref name="contents"/> is <b>null</b>. <para>-or-</para> <paramref name="encoding"/> is <b>null</b>.</exception>
public void AppendAllText(string path, string contents, Encoding encoding)
{
using (var stream = this.AppendText(path, encoding))
@@ -690,7 +690,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The path to the file to append to.</param>
/// <returns>A StreamWriter that appends UTF-8 encoded text to an existing file.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public StreamWriter AppendText(string path)
{
return this.AppendText(path, Encoding.UTF8);
@@ -704,7 +704,7 @@ namespace Renci.SshNet
/// <returns>
/// A StreamWriter that appends UTF-8 encoded text to an existing file.
/// </returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> or <paramref name="encoding"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>. <para>-or-</para> <paramref name="encoding"/> is <b>null</b>.</exception>
public StreamWriter AppendText(string path, Encoding encoding)
{
if (encoding == null)
@@ -718,7 +718,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The path and name of the file to create.</param>
/// <returns>A <see cref="SftpFileStream"/> that provides read/write access to the file specified in path</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public SftpFileStream Create(string path)
{
return new SftpFileStream(this._sftpSession, path, FileMode.Create, FileAccess.ReadWrite);
@@ -730,7 +730,7 @@ namespace Renci.SshNet
/// <param name="path">The path and name of the file to create.</param>
/// <param name="bufferSize">The number of bytes buffered for reads and writes to the file.</param>
/// <returns>A <see cref="SftpFileStream"/> that provides read/write access to the file specified in path</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public SftpFileStream Create(string path, int bufferSize)
{
return new SftpFileStream(this._sftpSession, path, FileMode.Create, FileAccess.ReadWrite, bufferSize);
@@ -741,7 +741,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to be opened for writing.</param>
/// <returns>A <see cref="System.IO.StreamWriter"/> that writes to the specified file using UTF-8 encoding.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public StreamWriter CreateText(string path)
{
return new StreamWriter(this.OpenWrite(path), Encoding.UTF8);
@@ -753,7 +753,7 @@ namespace Renci.SshNet
/// <param name="path">The file to be opened for writing.</param>
/// <param name="encoding">The character encoding to use.</param>
/// <returns> A <see cref="System.IO.StreamWriter"/> that writes to the specified file using UTF-8 encoding. </returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public StreamWriter CreateText(string path, Encoding encoding)
{
return new StreamWriter(this.OpenWrite(path), encoding);
@@ -763,7 +763,7 @@ namespace Renci.SshNet
/// Deletes the specified file or directory. An exception is not thrown if the specified file does not exist.
/// </summary>
/// <param name="path">The name of the file or directory to be deleted. Wildcard characters are not supported.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
public void Delete(string path)
{
@@ -777,7 +777,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file or directory for which to obtain access date and time information.</param>
/// <returns>A <see cref="System.DateTime"/> structure set to the date and time that the specified file or directory was last accessed. This value is expressed in local time.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
public DateTime GetLastAccessTime(string path)
{
@@ -791,7 +791,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file or directory for which to obtain access date and time information.</param>
/// <returns>A <see cref="System.DateTime"/> structure set to the date and time that the specified file or directory was last accessed. This value is expressed in UTC time.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
public DateTime GetLastAccessTimeUtc(string path)
{
@@ -805,7 +805,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file or directory for which to obtain write date and time information.</param>
/// <returns>A <see cref="System.DateTime"/> structure set to the date and time that the specified file or directory was last written to. This value is expressed in local time.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
public DateTime GetLastWriteTime(string path)
{
@@ -819,7 +819,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file or directory for which to obtain write date and time information.</param>
/// <returns>A <see cref="System.DateTime"/> structure set to the date and time that the specified file or directory was last written to. This value is expressed in UTC time.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client is not connected.</exception>
public DateTime GetLastWriteTimeUtc(string path)
{
@@ -834,7 +834,7 @@ namespace Renci.SshNet
/// <param name="path">The file to open.</param>
/// <param name="mode">A <see cref="System.IO.FileMode"/> 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.</param>
/// <returns>An unshared <see cref="SftpFileStream"/> that provides access to the specified file, with the specified mode and access.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public SftpFileStream Open(string path, FileMode mode)
{
return new SftpFileStream(this._sftpSession, path, mode, FileAccess.ReadWrite);
@@ -847,7 +847,7 @@ namespace Renci.SshNet
/// <param name="mode">A <see cref="System.IO.FileMode"/> 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.</param>
/// <param name="access">A <see cref="System.IO.FileAccess"/> value that specifies the operations that can be performed on the file.</param>
/// <returns>An unshared <see cref="SftpFileStream"/> that provides access to the specified file, with the specified mode and access.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public SftpFileStream Open(string path, FileMode mode, FileAccess access)
{
return new SftpFileStream(this._sftpSession, path, mode, access);
@@ -858,7 +858,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to be opened for reading.</param>
/// <returns>A read-only System.IO.FileStream on the specified path.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public SftpFileStream OpenRead(string path)
{
return new SftpFileStream(this._sftpSession, path, FileMode.Open, FileAccess.Read);
@@ -869,7 +869,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to be opened for reading.</param>
/// <returns>A <see cref="System.IO.StreamReader"/> on the specified path.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public StreamReader OpenText(string path)
{
return new StreamReader(this.OpenRead(path), Encoding.UTF8);
@@ -880,7 +880,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to be opened for writing.</param>
/// <returns>An unshared <see cref="SftpFileStream"/> object on the specified path with <see cref="System.IO.FileAccess.Write"/> access.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public SftpFileStream OpenWrite(string path)
{
return new SftpFileStream(this._sftpSession, path, FileMode.OpenOrCreate, FileAccess.Write);
@@ -891,7 +891,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to open for reading.</param>
/// <returns>A byte array containing the contents of the file.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public byte[] ReadAllBytes(string path)
{
using (var stream = this.OpenRead(path))
@@ -907,7 +907,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to open for reading.</param>
/// <returns>A string array containing all lines of the file.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public string[] ReadAllLines(string path)
{
return this.ReadAllLines(path, Encoding.UTF8);
@@ -919,7 +919,7 @@ namespace Renci.SshNet
/// <param name="path">The file to open for reading.</param>
/// <param name="encoding">The encoding applied to the contents of the file.</param>
/// <returns>A string array containing all lines of the file.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public string[] ReadAllLines(string path, Encoding encoding)
{
var lines = new List<string>();
@@ -938,7 +938,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to open for reading.</param>
/// <returns>A string containing all lines of the file.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public string ReadAllText(string path)
{
return this.ReadAllText(path, Encoding.UTF8);
@@ -950,7 +950,7 @@ namespace Renci.SshNet
/// <param name="path">The file to open for reading.</param>
/// <param name="encoding">The encoding applied to the contents of the file.</param>
/// <returns>A string containing all lines of the file.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public string ReadAllText(string path, Encoding encoding)
{
var lines = new List<string>();
@@ -965,7 +965,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to read.</param>
/// <returns>The lines of the file.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public IEnumerable<string> ReadLines(string path)
{
return this.ReadAllLines(path);
@@ -977,7 +977,7 @@ namespace Renci.SshNet
/// <param name="path">The file to read.</param>
/// <param name="encoding">The encoding that is applied to the contents of the file.</param>
/// <returns>The lines of the file.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public IEnumerable<string> ReadLines(string path, Encoding encoding)
{
return this.ReadAllLines(path, encoding);
@@ -1032,7 +1032,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to write to.</param>
/// <param name="bytes">The bytes to write to the file.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public void WriteAllBytes(string path, byte[] bytes)
{
using (var stream = this.OpenWrite(path))
@@ -1046,7 +1046,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to write to.</param>
/// <param name="contents">The lines to write to the file.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public void WriteAllLines(string path, IEnumerable<string> contents)
{
this.WriteAllLines(path, contents, Encoding.UTF8);
@@ -1057,7 +1057,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to write to.</param>
/// <param name="contents">The string array to write to the file.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public void WriteAllLines(string path, string[] contents)
{
this.WriteAllLines(path, contents, Encoding.UTF8);
@@ -1069,7 +1069,7 @@ namespace Renci.SshNet
/// <param name="path">The file to write to.</param>
/// <param name="contents">The lines to write to the file.</param>
/// <param name="encoding">The character encoding to use.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public void WriteAllLines(string path, IEnumerable<string> contents, Encoding encoding)
{
using (var stream = this.CreateText(path, encoding))
@@ -1087,7 +1087,7 @@ namespace Renci.SshNet
/// <param name="path">The file to write to.</param>
/// <param name="contents">The string array to write to the file.</param>
/// <param name="encoding">An <see cref="System.Text.Encoding"/> object that represents the character encoding applied to the string array.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public void WriteAllLines(string path, string[] contents, Encoding encoding)
{
using (var stream = this.CreateText(path, encoding))
@@ -1104,7 +1104,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The file to write to.</param>
/// <param name="contents">The string to write to the file.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public void WriteAllText(string path, string contents)
{
using (var stream = this.CreateText(path))
@@ -1119,7 +1119,7 @@ namespace Renci.SshNet
/// <param name="path">The file to write to.</param>
/// <param name="contents">The string to write to the file.</param>
/// <param name="encoding">The encoding to apply to the string.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public void WriteAllText(string path, string contents, Encoding encoding)
{
using (var stream = this.CreateText(path, encoding))
@@ -1133,7 +1133,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The path to the file.</param>
/// <returns>The <see cref="SftpFileAttributes"/> of the file on the path.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public SftpFileAttributes GetAttributes(string path)
{
var fullPath = this._sftpSession.GetCanonicalPath(path);
@@ -1146,7 +1146,7 @@ namespace Renci.SshNet
/// </summary>
/// <param name="path">The path to the file.</param>
/// <param name="fileAttributes">The desired <see cref="SftpFileAttributes"/>.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
public void SetAttributes(string path, SftpFileAttributes fileAttributes)
{
var fullPath = this._sftpSession.GetCanonicalPath(path);
@@ -1165,7 +1165,7 @@ namespace Renci.SshNet
#endregion
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client not connected.</exception>
private IEnumerable<SftpFile> InternalListDirectory(string path, SftpListDirectoryAsyncResult asynchResult)
{
@@ -1206,8 +1206,8 @@ namespace Renci.SshNet
return result;
}
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null or contains whitespace.</exception>
/// <exception cref="ArgumentException"><paramref name="output"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <b>null</b> or contains whitespace.</exception>
/// <exception cref="ArgumentException"><paramref name="output"/> is <b>null</b>.</exception>
/// <exception cref="SshConnectionException">Client not connected.</exception>
private void InternalDownloadFile(string path, Stream output, SftpDownloadAsyncResult asynchResult)
{
@@ -1249,8 +1249,8 @@ namespace Renci.SshNet
this._sftpSession.RequestClose(handle);
}
/// <exception cref="ArgumentNullException"><paramref name="input"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is null or contains whitespace.</exception>
/// <exception cref="ArgumentNullException"><paramref name="input"/> is <b>null</b>.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is <b>null</b> or contains whitespace.</exception>
/// <exception cref="SshConnectionException">Client not connected.</exception>
private void InternalUploadFile(Stream input, string path, SftpUploadAsyncResult asynchResult, Flags flags)
{