Minor improvements.

This commit is contained in:
drieseng
2016-09-10 21:11:40 +02:00
parent 3808aae801
commit ba59196821
4 changed files with 10 additions and 14 deletions
-1
View File
@@ -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
View File
@@ -1,5 +1,4 @@
using System;
using System.Globalization;
using System.Threading;
namespace Renci.SshNet
+1 -1
View File
@@ -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;
}
+9 -11
View File
@@ -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)