|
|
@@ -6,11 +6,6 @@ namespace Renci.SshNet.Sftp.Requests
|
|
|
internal abstract class SftpRequest : SftpMessage
|
|
|
{
|
|
|
private readonly Action<SftpStatusResponse> _statusAction;
|
|
|
- private Action<SftpAttrsResponse> _attrsAction;
|
|
|
- private Action<SftpDataResponse> _dataAction;
|
|
|
- private Action<SftpExtendedReplyResponse> _extendedReplyAction;
|
|
|
- private Action<SftpHandleResponse> _handleAction;
|
|
|
- private Action<SftpNameResponse> _nameAction;
|
|
|
|
|
|
public uint RequestId { get; private set; }
|
|
|
|
|
|
@@ -39,31 +34,12 @@ namespace Renci.SshNet.Sftp.Requests
|
|
|
_statusAction = statusAction;
|
|
|
}
|
|
|
|
|
|
- public void Complete(SftpResponse response)
|
|
|
+ public virtual void Complete(SftpResponse response)
|
|
|
{
|
|
|
- if (response is SftpStatusResponse)
|
|
|
+ var statusResponse = response as SftpStatusResponse;
|
|
|
+ if (statusResponse != null)
|
|
|
{
|
|
|
- _statusAction(response as SftpStatusResponse);
|
|
|
- }
|
|
|
- else if (response is SftpAttrsResponse)
|
|
|
- {
|
|
|
- _attrsAction(response as SftpAttrsResponse);
|
|
|
- }
|
|
|
- else if (response is SftpDataResponse)
|
|
|
- {
|
|
|
- _dataAction(response as SftpDataResponse);
|
|
|
- }
|
|
|
- else if (response is SftpExtendedReplyResponse)
|
|
|
- {
|
|
|
- _extendedReplyAction(response as SftpExtendedReplyResponse);
|
|
|
- }
|
|
|
- else if (response is SftpHandleResponse)
|
|
|
- {
|
|
|
- _handleAction(response as SftpHandleResponse);
|
|
|
- }
|
|
|
- else if (response is SftpNameResponse)
|
|
|
- {
|
|
|
- _nameAction(response as SftpNameResponse);
|
|
|
+ _statusAction(statusResponse);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -71,31 +47,6 @@ namespace Renci.SshNet.Sftp.Requests
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- protected void SetAction(Action<SftpAttrsResponse> action)
|
|
|
- {
|
|
|
- _attrsAction = action;
|
|
|
- }
|
|
|
-
|
|
|
- protected void SetAction(Action<SftpDataResponse> action)
|
|
|
- {
|
|
|
- _dataAction = action;
|
|
|
- }
|
|
|
-
|
|
|
- protected void SetAction(Action<SftpExtendedReplyResponse> action)
|
|
|
- {
|
|
|
- _extendedReplyAction = action;
|
|
|
- }
|
|
|
-
|
|
|
- protected void SetAction(Action<SftpHandleResponse> action)
|
|
|
- {
|
|
|
- _handleAction = action;
|
|
|
- }
|
|
|
-
|
|
|
- protected void SetAction(Action<SftpNameResponse> action)
|
|
|
- {
|
|
|
- _nameAction = action;
|
|
|
- }
|
|
|
-
|
|
|
protected override void LoadData()
|
|
|
{
|
|
|
throw new InvalidOperationException("Request cannot be saved.");
|