Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
 public ScpLocalToRemoteReceiver(ScpParameter param) : base(param)
 {
     _state         = State.WaitingChannelReady;
     _responseEvent = new ManualResetEvent(false);
 }
Esempio n. 3
0
 public ScpRemoteToLocalReceiver(ScpParameter param) : base(param)
 {
     _state             = State.WaitingFileInfo;
     _channelReadyEvent = new ManualResetEvent(false);
 }
Esempio n. 4
0
 public ScpChannelReceiverBase(ScpParameter param)
 {
     _param         = param;
     _completeEvent = new ManualResetEvent(false);
 }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
 public ScpRemoteToLocalReceiver(ScpParameter param)
     : base(param)
 {
     _state = State.WaitingFileInfo;
     _channelReadyEvent = new ManualResetEvent(false);
 }
Esempio n. 7
0
 public ScpLocalToRemoteReceiver(ScpParameter param)
     : base(param)
 {
     _state = State.WaitingChannelReady;
     _responseEvent = new ManualResetEvent(false);
 }
Esempio n. 8
0
 public ScpChannelReceiverBase(ScpParameter param)
 {
     _param = param;
     _completeEvent = new ManualResetEvent(false);
 }