protected virtual void Dispose(bool disposing) { lock (this) { _disposed = true; if (disposing) { } try { FtpDataConnection dc = _currentDC; if (null != dc) { dc.Dispose(); } } catch (Exception e) { NSTrace.WriteLineError("DTP.Dispose() ex: " + e.ToString()); } catch { NSTrace.WriteLineError("DTP.Dispose() non cls ex: " + Environment.StackTrace); } } }
void RunDTP_End(IAsyncResult ar) { RunDTP_SO stateObj = (RunDTP_SO)ar.AsyncState; try { stateObj.UpdateContext(); _currentDC.DataTransfered -= new FtpDataConnection.DataTransferedEventHandler(OnDataTransfered); _currentDC.Completed -= new FtpDataConnection.CompletedEventHandler(OnCompleted); try { //finish DTP... _currentDC.EndRunDTPStream(ar); stateObj.ManuallyClosed = _currentDC.ManuallyClosed; } catch (FtpAbortedException ex) { stateObj.AbortEx = ex; } finally { _currentDC.Dispose(); _currentDC = null; } //---------------------------------------- //Lock control connection again - reading //responses _cc.BeginLock(Timeout.Infinite, new WaitOrTimerCallback(LockLast_End), stateObj); } catch (Exception e) { HandleCatch(e, stateObj); } catch { HandleCatch(null, stateObj); } }