Пример #1
0
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="FtpControlChannel"/> 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_lastResponse = null;

                        if ((object)m_connection != null)
                        {
                            m_connection.Close();
                        }
                        m_connection = null;
                    }
                }
                finally
                {
                    m_disposed = true;  // Prevent duplicate dispose.
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Refresh response from control channel.
        /// </summary>
        public void RefreshResponse()
        {
            if ((object)m_connection == null)
            {
                return;
            }

            lock (this)
            {
                m_lastResponse = new FtpResponse(m_connection.GetStream());
            }

            foreach (string s in m_lastResponse.Respones)
            {
                m_sessionHost.OnResponseReceived(s);
            }
        }
Пример #3
0
        /// <summary>
        /// Connects the <see cref="FtpControlChannel"/>.
        /// </summary>
        public void Connect()
        {
            if ((object)m_connection == null)
            {
                return;
            }
            m_connection.Connect(m_server, m_port);

            try
            {
                m_lastResponse = new FtpResponse(m_connection.GetStream());

                if (m_lastResponse.Code != FtpResponse.ServiceReady)
                {
                    throw new FtpServerDownException("FTP service unavailable.", m_lastResponse);
                }
            }
            catch
            {
                Close();
                throw;
            }
        }
Пример #4
0
 internal FtpExceptionBase(string message, FtpResponse ftpResponse)
     : base(message)
 {
     m_ftpResponse = ftpResponse;
 }
Пример #5
0
        /// <summary>
        /// Connects the <see cref="FtpControlChannel"/>.
        /// </summary>
        public void Connect()
        {
            if ((object)m_connection == null)
                return;
            m_connection.Connect(m_server, m_port);

            try
            {
                m_lastResponse = new FtpResponse(m_connection.GetStream());

                if (m_lastResponse.Code != FtpResponse.ServiceReady)
                    throw new FtpServerDownException("FTP service unavailable.", m_lastResponse);
            }
            catch
            {
                Close();
                throw;
            }
        }
Пример #6
0
 internal FtpResumeNotSupportedException(FtpResponse ftpResponse)
     : base("Data transfer error: server does not support resuming.", ftpResponse)
 {
 }
Пример #7
0
 internal FtpCommandException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
Пример #8
0
 internal FtpServerDownException(FtpResponse ftpResponse)
     : this("FTP service was down.", ftpResponse)
 {
 }
Пример #9
0
 internal FtpServerDownException(FtpResponse ftpResponse)
     : this("FTP service was down.", ftpResponse)
 {
 }
Пример #10
0
 internal FtpAuthenticationException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
Пример #11
0
 internal FtpInvalidResponseException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
        /// <summary>
        /// Refresh response from control channel.
        /// </summary>
        public void RefreshResponse()
        {
            if ((object)m_connection == null)
                return;

            lock (this)
            {
                m_lastResponse = new FtpResponse(m_connection.GetStream());
            }

            foreach (string s in m_lastResponse.Respones)
            {
                m_sessionHost.OnResponseReceived(s);
            }
        }
        /// <summary>
        /// Connects the <see cref="FtpControlChannel"/>.
        /// </summary>
        public void Connect()
        {
            if ((object)m_connection == null)
                return;

            m_connection.Connect(m_server, m_port);

            try
            {
                NetworkStream stream = m_connection.GetStream();

                stream.ReadTimeout = m_timeout;
                stream.WriteTimeout = m_timeout;
                m_lastResponse = new FtpResponse(stream);

                if (m_lastResponse.Code != FtpResponse.ServiceReady)
                    throw new FtpServerDownException("FTP service unavailable.", m_lastResponse);
            }
            catch
            {
                Close();
                throw;
            }
        }
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="FtpControlChannel"/> 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_lastResponse = null;

                        if ((object)m_connection != null)
                            m_connection.Close();

                        m_connection = null;
                    }
                }
                finally
                {
                    m_disposed = true;  // Prevent duplicate dispose.
                }
            }
        }
Пример #15
0
 internal FtpInvalidResponseException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
Пример #16
0
 internal FtpAuthenticationException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
Пример #17
0
 internal FtpServerDownException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
Пример #18
0
 internal FtpServerDownException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
Пример #19
0
 internal FtpCommandException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
Пример #20
0
 internal FtpDataTransferException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
Пример #21
0
 internal FtpDataTransferException(string message, FtpResponse ftpResponse)
     : base(message, ftpResponse)
 {
 }
Пример #22
0
 internal FtpExceptionBase(string message, FtpResponse ftpResponse)
     : base(message)
 {
     m_ftpResponse = ftpResponse;
 }
Пример #23
0
 internal FtpResumeNotSupportedException(FtpResponse ftpResponse)
     : base("Data transfer error: server does not support resuming.", ftpResponse)
 {
 }