mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 17:25:51 +00:00
Minor improvements.
This commit is contained in:
@@ -9,7 +9,6 @@ using System.Text;
|
||||
using Renci.SshNet.Abstractions;
|
||||
using Renci.SshNet.Common;
|
||||
using Renci.SshNet.Messages;
|
||||
using Renci.SshNet.Messages.Connection;
|
||||
|
||||
namespace Renci.SshNet
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
namespace Renci.SshNet
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Renci.SshNet.Sftp
|
||||
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Message type '{0}' is not supported.", messageType));
|
||||
}
|
||||
|
||||
message.Load(data, offset, data.Length - offset);
|
||||
message.Load(data, offset, count);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -1210,19 +1210,17 @@ namespace Renci.SshNet.Sftp
|
||||
|
||||
private static SshException GetSftpException(SftpStatusResponse response)
|
||||
{
|
||||
if (response.StatusCode == StatusCodes.Ok)
|
||||
switch (response.StatusCode)
|
||||
{
|
||||
return null;
|
||||
case StatusCodes.Ok:
|
||||
return null;
|
||||
case StatusCodes.PermissionDenied:
|
||||
return new SftpPermissionDeniedException(response.ErrorMessage);
|
||||
case StatusCodes.NoSuchFile:
|
||||
return new SftpPathNotFoundException(response.ErrorMessage);
|
||||
default:
|
||||
return new SshException(response.ErrorMessage);
|
||||
}
|
||||
if (response.StatusCode == StatusCodes.PermissionDenied)
|
||||
{
|
||||
return new SftpPermissionDeniedException(response.ErrorMessage);
|
||||
}
|
||||
if (response.StatusCode == StatusCodes.NoSuchFile)
|
||||
{
|
||||
return new SftpPathNotFoundException(response.ErrorMessage);
|
||||
}
|
||||
return new SshException(response.ErrorMessage);
|
||||
}
|
||||
|
||||
private void HandleResponse(SftpResponse response)
|
||||
|
||||
Reference in New Issue
Block a user