internal void Execute(int timeout, Stream userStream, string file, long length) { SetProgress(true); try { CreateDTP(); string cmd = "STOR " + file; _currentDTP.Execute(timeout, cmd, _client.DataType, -1, new DTPStreamCommon(userStream, DTPStreamType.ForReading, length)); } finally { if (null != _currentDTP) { _currentDTP.Dispose(); _currentDTP = null; } SetProgress(false); } }
internal string Execute(int timeout, Stream userStream, long length) { SetProgress(true); _uniqueFileName = null; try { CreateDTP(); string cmd = "STOU"; _cc.ResponseReceived += new FtpControlConnection.ResponseReceivedEventHandler(CC_ResponseReceived); _currentDTP.Execute(timeout, cmd, _client.DataType, -1, new DTPStreamCommon(userStream, DTPStreamType.ForReading, length)); } finally { if (null != _currentDTP) { _currentDTP.Dispose(); _currentDTP = null; } _cc.ResponseReceived -= new FtpControlConnection.ResponseReceivedEventHandler(CC_ResponseReceived); SetProgress(false); } return(_uniqueFileName); }
internal FtpItem[] Execute(int timeout, string dir) { FtpItem[] items = null; SetProgress(true); try { CreateDTP(); _linesBuilder.NewLineEvent += new LinesBuilder.NewLineEventHandler(List_OnNewLineEvent); _items.Clear(); _linesBuilder.Reset(); string cmd = "LIST"; if (null != dir) { cmd += " " + dir; } _currentDTP.DataTransfered += new Cmd_RunDTP.DataTransferedEventHandler(List_OnDataTransfered); try { _currentDTP.Execute(timeout, cmd, FtpDataType.Ascii, -1, new DTPStreamCommon(Stream.Null, DTPStreamType.ForWriting)); } finally { _currentDTP.DataTransfered -= new Cmd_RunDTP.DataTransferedEventHandler(List_OnDataTransfered); } items = new FtpItem[_items.Count]; _items.CopyTo(items); } finally { if (null != _currentDTP) { _currentDTP.Dispose(); _currentDTP = null; } _linesBuilder.NewLineEvent -= new LinesBuilder.NewLineEventHandler(List_OnNewLineEvent); SetProgress(false); } return(items); }
internal void Execute(int timeout, Stream userStream, string file, long offset, long length) { SetProgress(true); try { CreateDTP(); string cmd = "RETR " + file; _currentDTP.Execute(timeout, cmd, _client.DataType, offset, new DTPStreamCommon(userStream, DTPStreamType.ForWriting, length)); } finally { SetProgress(false); CheckDisposed(); } }