internal IAsyncResult BeginExecute(int timeout, Stream userStream, string file, long offset, long length, AsyncCallback cb, object state) { GetFile_SO stateObj = null; SetProgress(true); try { CreateDTP(); stateObj = new GetFile_SO(userStream, cb, state); string cmd = "RETR " + file; _currentDTP.BeginExecute(timeout, cmd, _client.DataType, offset, new DTPStreamCommon(userStream, DTPStreamType.ForWriting, length), new AsyncCallback(this.RunDTP_End), stateObj); } catch { SetProgress(false); CheckDisposed(); throw; } return(stateObj); }
internal IAsyncResult BeginExecute(int timeout, string path, AsyncCallback cb, object state) { List_SO stateObj = null; SetProgress(true); try { CreateDTP(); stateObj = new List_SO(new DTPStreamCommon(Stream.Null, DTPStreamType.ForWriting), cb, state); _linesBuilder.NewLineEvent += new LinesBuilder.NewLineEventHandler(List_OnNewLineEvent); _items.Clear(); _linesBuilder.Reset(); string cmd = "LIST"; if (null != path) { cmd += " " + path; } _currentDTP.DataTransfered += new Cmd_RunDTP.DataTransferedEventHandler(List_OnDataTransfered); try { _currentDTP.BeginExecute(timeout, cmd, FtpDataType.Ascii, -1, stateObj.UserStream, new AsyncCallback(RunCmd_End), stateObj); } catch (Exception e) { _currentDTP.DataTransfered -= new Cmd_RunDTP.DataTransferedEventHandler(List_OnDataTransfered); throw e; } } catch (Exception e) { if (null != _currentDTP) { _currentDTP.Dispose(); _currentDTP = null; } SetProgress(false); throw e; } return(stateObj); }
internal IAsyncResult BeginExecute(int timeout, Stream userStream, long length, AsyncCallback cb, object state) { PutFileUnique_SO stateObj = null; SetProgress(true); _uniqueFileName = null; try { CreateDTP(); stateObj = new PutFileUnique_SO(userStream, cb, state); _cc.ResponseReceived += new FtpControlConnection.ResponseReceivedEventHandler(CC_ResponseReceived); string cmd = "STOU"; _currentDTP.BeginExecute(timeout, cmd, _client.DataType, -1, new DTPStreamCommon(userStream, DTPStreamType.ForReading, length), new AsyncCallback(this.RunDTP_End), stateObj); } catch (Exception e) { if (null != _currentDTP) { _currentDTP.Dispose(); _currentDTP = null; } _cc.ResponseReceived -= new FtpControlConnection.ResponseReceivedEventHandler(CC_ResponseReceived); SetProgress(false); throw e; } return(stateObj); }
internal IAsyncResult BeginExecute(int timeout, Stream userStream, string fileName, long length, AsyncCallback cb, object state) { PutFile_SO stateObj = null; SetProgress(true); try { CreateDTP(); stateObj = new PutFile_SO(userStream, cb, state); string cmd = "STOR " + fileName; _currentDTP.BeginExecute(timeout, cmd, _client.DataType, -1, new DTPStreamCommon(userStream, DTPStreamType.ForReading, length), new AsyncCallback(this.RunDTP_End), stateObj); } catch (Exception e) { if (null != _currentDTP) { _currentDTP.Dispose(); _currentDTP = null; } SetProgress(false); throw e; } return(stateObj); }