Exemplo n.º 1
0
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="FtpSessionConnected"/> object and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!m_disposed)
            {
                try
                {
                    // This will be done regardless of whether the object is finalized or disposed.

                    if (disposing)
                    {
                        m_host    = null;
                        m_root    = null;
                        m_current = null;

                        if ((object)m_ctrlChannel != null)
                        {
                            m_ctrlChannel.Close();
                        }

                        m_ctrlChannel = null;

                        if ((object)m_dataStream != null)
                        {
                            m_dataStream.Dispose();
                        }

                        m_dataStream = null;
                    }
                }
                finally
                {
                    m_disposed = true;  // Prevent duplicate dispose.
                }
            }
        }
Exemplo n.º 2
0
 internal FtpFile(FtpDirectory parent, FtpDirectory.ItemInfo info)
 {
     m_parent     = parent;
     m_name       = info.Name;
     m_size       = info.Size;
     m_permission = info.Permission;
     m_timestamp  = info.TimeStamp.Value;
 }
Exemplo n.º 3
0
        internal FtpFileTransferer(FtpDirectory transferStarter, string localFile, string remoteFile, long totalBytes, TransferDirection dir)
        {
            TransferDirection = dir;
            m_session         = transferStarter.Session;
            LocalFileName     = localFile;
            RemoteFileName    = remoteFile;
            TotalBytes        = totalBytes;

            if (dir == TransferDirection.Upload)
            {
                m_streamCopyRoutine     = LocalToRemote;
                m_ftpFileCommandRoutine = m_session.ControlChannel.STOR;
            }
            else
            {
                m_streamCopyRoutine     = RemoteToLocal;
                m_ftpFileCommandRoutine = m_session.ControlChannel.RETR;
            }
        }
Exemplo n.º 4
0
 internal FtpFile(FtpDirectory parent, string name)
 {
     m_parent = parent;
     m_name   = name;
 }
Exemplo n.º 5
0
 internal void InitRootDirectory()
 {
     m_root    = new FtpDirectory(this, m_caseInsensitive, m_ctrlChannel.PWD());
     m_current = m_root;
 }