示例#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;
            }
        }
示例#2
0
 public ScpLocalToRemoteReceiver(ScpParameter param) : base(param)
 {
     _state         = State.WaitingChannelReady;
     _responseEvent = new ManualResetEvent(false);
 }
示例#3
0
 public ScpRemoteToLocalReceiver(ScpParameter param) : base(param)
 {
     _state             = State.WaitingFileInfo;
     _channelReadyEvent = new ManualResetEvent(false);
 }
示例#4
0
 public ScpChannelReceiverBase(ScpParameter param)
 {
     _param         = param;
     _completeEvent = new ManualResetEvent(false);
 }
示例#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;
        }
示例#6
0
文件: SCP.cs 项目: FNKGino/poderosa
 public ScpRemoteToLocalReceiver(ScpParameter param)
     : base(param)
 {
     _state = State.WaitingFileInfo;
     _channelReadyEvent = new ManualResetEvent(false);
 }
示例#7
0
文件: SCP.cs 项目: FNKGino/poderosa
 public ScpLocalToRemoteReceiver(ScpParameter param)
     : base(param)
 {
     _state = State.WaitingChannelReady;
     _responseEvent = new ManualResetEvent(false);
 }
示例#8
0
文件: SCP.cs 项目: FNKGino/poderosa
 public ScpChannelReceiverBase(ScpParameter param)
 {
     _param = param;
     _completeEvent = new ManualResetEvent(false);
 }