Esempio n. 1
0
 private void CancleCommand()
 {
     _cmdList.Clear();
     _currentCommand = null;
 }
Esempio n. 2
0
 /// <summary>
 /// 执行下一条命令
 /// </summary>
  public void ExcuteNextCommand()
  {
      if (_cmdList.Count > 0)
      {
          FtpCommand cmd = _cmdList[0];
          _cmdList.RemoveAt(0);
          ExcuteCommand(cmd);
      }
      else
      {
          _currentCommand = null;
      }
  }
Esempio n. 3
0
        /// <summary>
        /// 执行指定命令
        /// </summary>
        /// <param name="command"></param>
         public  void ExcuteCommand(FtpCommand command)
         {
             _currentCommand = command;
             if (_cmdList.Count > 0)
             {
                 _nextCommand = _cmdList[0];
             }
             else 
             {
                 _nextCommand = null;
             }

             CommandNotify(command.GetCommandLine());
             _asyncSocket.Send(command.GetCommandLine());
         }
Esempio n. 4
0
        /// <summary>
        /// 准备命令,适宜的添加到执行列表
        /// </summary>
        /// <param name="command"></param>
         public void PrepareCommand(FtpCommand command)
         {
             if (_currentCommand != null || _isConnect == false)
             {
                 if (command.Command == "RETR" || command.Command == "STOR" || command.Command == "LIST")
                 {
                     AddCommandList(new FtpCommand("PASV", 227));// add pasv
                    //有偏移说明是断点下载
                    if(command .Offset != 0)
                    {
                        AddCommandList(new FtpCommand("REST",350,command.Offset .ToString ()));
                    }
                 }
                 AddCommandList(command);
             }
             else
             {
                 if (command.Command == "RETR" || command.Command == "STOR" || command.Command == "LIST")
                 {
                    //有偏移说明是断点下载
                    if (command.Offset != 0)
                    {
                        AddCommandList(new FtpCommand("REST", 350, command.Offset.ToString()));
                    }
                    AddCommandList(command);
                     ExcuteCommand(new FtpCommand("PASV", 227));//add pasv and send the pasv request
                 }
                 else
                 {
                     ExcuteCommand(command);
                 }

             }
         }
Esempio n. 5
0
 /// <summary>
 /// 添加命令到执行列表
 /// </summary>
 /// <param name="command"></param>
  private void AddCommandList(FtpCommand command)
  {
      if (_nextCommand == null)
      {
          _nextCommand = command;
      }
      _cmdList.Add(command);
  }
Esempio n. 6
0
         public void PrepareCommand(FtpCommand command)
         {
             if (_currentCommand != null || _isConnect == false)
             {
                 if (command.Command == "RETR" || command.Command == "STOR" || command.Command == "LIST")
                 {
                     AddCommandList(new FtpCommand("PASV", 227));// add pasv
                 }
                 AddCommandList(command);
             }
             else
             {
                 if (command.Command == "RETR" || command.Command == "STOR" || command.Command == "LIST")
                 {
                     AddCommandList(command);
                     ExcuteCommand(new FtpCommand("PASV", 227));//add pasv and send the pasv request
                 }
                 else
                 {
                     ExcuteCommand(command);
                 }

             }
         }