public void ExecuteSCP(ScpParameter scp_param) { // making command string for scp string cmd = String.Format("scp {0} {1}", scp_param.Direction == SCPCopyDirection.LocalToRemote? "-t" : "-f", scp_param.RemoteFilename); ScpChannelReceiverBase receiver_base; if (scp_param.Direction == SCPCopyDirection.LocalToRemote) { ScpLocalToRemoteReceiver receiver = new ScpLocalToRemoteReceiver(scp_param); receiver_base = receiver; // exec command receiver.Run(DoExecCommand(receiver, cmd)); } else { ScpRemoteToLocalReceiver receiver = new ScpRemoteToLocalReceiver(scp_param); receiver_base = receiver; // exec command receiver.Run(DoExecCommand(receiver, cmd)); //Note: asynchronously operation should be supported receiver.CompleteEvent.WaitOne(); } Debug.Assert(scp_param.LocalSource.IsClosed); //the local source must be closed regardless of the transmission receiver_base.Dipose(); if (!receiver_base.Succeeded) { throw receiver_base.Error; } }
public ScpLocalToRemoteReceiver(ScpParameter param) : base(param) { _state = State.WaitingChannelReady; _responseEvent = new ManualResetEvent(false); }
public ScpRemoteToLocalReceiver(ScpParameter param) : base(param) { _state = State.WaitingFileInfo; _channelReadyEvent = new ManualResetEvent(false); }
public ScpChannelReceiverBase(ScpParameter param) { _param = param; _completeEvent = new ManualResetEvent(false); }
public void ExecuteSCP(ScpParameter scp_param) { // making command string for scp string cmd = String.Format("scp {0} {1}", scp_param.Direction == SCPCopyDirection.LocalToRemote ? "-t" : "-f", scp_param.RemoteFilename); ScpChannelReceiverBase receiver_base; if (scp_param.Direction == SCPCopyDirection.LocalToRemote) { ScpLocalToRemoteReceiver receiver = new ScpLocalToRemoteReceiver(scp_param); receiver_base = receiver; // exec command receiver.Run(DoExecCommand(receiver, cmd)); } else { ScpRemoteToLocalReceiver receiver = new ScpRemoteToLocalReceiver(scp_param); receiver_base = receiver; // exec command receiver.Run(DoExecCommand(receiver, cmd)); //Note: asynchronously operation should be supported receiver.CompleteEvent.WaitOne(); } Debug.Assert(scp_param.LocalSource.IsClosed); //the local source must be closed regardless of the transmission receiver_base.Dipose(); if (!receiver_base.Succeeded) throw receiver_base.Error; }