Esempio n. 1
0
 /// <summary>
 /// Adds an Response object to the end of the FtpResponseQueue.
 /// </summary>
 /// <param name="item">An FtpResponse item.</param>
 public void Enqueue(FtpResponse item)
 {
     lock (this)
     {
         _queue.Enqueue(item);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Constructor for FtpResponse.
 /// </summary>
 /// <param name="response">FtpResponse object.</param>
 public FtpResponse(FtpResponse response)
 {
     _rawText = response.RawText;
     _text = response.Text;
     _code = response.Code;
     _isInformational = response.IsInformational;
 }
Esempio n. 3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpItemParsingException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpDataCompressionException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpLoginException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
Esempio n. 6
0
 private bool IsUnhappyResponse(FtpResponse response)
 {
     if (
          response.Code == FtpResponseCode.ServiceNotAvailableClosingControlConnection
         || response.Code == FtpResponseCode.CannotOpenDataConnection
         || response.Code == FtpResponseCode.ConnectionClosedSoTransferAborted
         || response.Code == FtpResponseCode.RequestedFileActionNotTaken
         || response.Code == FtpResponseCode.RequestedActionAbortedDueToLocalErrorInProcessing
         || response.Code == FtpResponseCode.RequestedActionNotTakenInsufficientStorage
         || response.Code == FtpResponseCode.SyntaxErrorCommandUnrecognized
         || response.Code == FtpResponseCode.SyntaxErrorInParametersOrArguments
         || response.Code == FtpResponseCode.CommandNotImplemented
         || response.Code == FtpResponseCode.BadSequenceOfCommands
         || response.Code == FtpResponseCode.CommandNotImplementedForThatParameter
         || response.Code == FtpResponseCode.NotLoggedIn
         || response.Code == FtpResponseCode.NeedAccountForStoringFiles
         || response.Code == FtpResponseCode.RequestedActionNotTakenFileUnavailable
         || response.Code == FtpResponseCode.RequestedActionAbortedPageTypeUnknown
         || response.Code == FtpResponseCode.RequestedFileActionAbortedExceededStorageAllocation
         || response.Code == FtpResponseCode.RequestedActionNotTakenFileNameNotAllowed)
         return true;
     else
         return false;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpConnectionBrokenException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpFileIntegrityException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpConnectionOpenException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
Esempio n. 10
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpConnectionOpenException(string message, FtpResponse response, Exception innerException)
     :  base(message, response, innerException)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpConnectionClosedException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpCommandNotSupportedException(string message, FtpResponse response, Exception innerException)
     :
     base(message, response, innerException)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpHashingInvalidAlgorithmException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 14
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpItemParsingException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpConnectionClosedException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 16
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="response">FtpResponse object.</param>
 public FtpResponseEventArgs(FtpResponse response)
 {
     _response = response;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpDataConnectionTimeoutException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpConnectionBrokenException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 19
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpCommandResponseTimeoutException(string message, FtpResponse response, Exception innerException)
     :
     base(message, response, innerException)
 {
 }
Esempio n. 20
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpAuthenticationException(string message, FtpResponse response, Exception innerException)
     :
     base(message, response, innerException)
 {
 }
Esempio n. 21
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpCommandResponseTimeoutException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 22
0
        private void DontWaitForHappyCodes()
        {
            if (_responseQueue.Count == 0)
                return;

            _responseList.Clear();
            while (_responseQueue.Count > 0)
            {
                FtpResponse response = _responseQueue.Dequeue();
                _responseList.Add(response);
                RaiseServerResponseEvent(new FtpResponse(response));
            }
            _response = _responseList.GetLast();
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpAsynchronousOperationException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 24
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpLoginException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpHashingServerBusyException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpCommandResponseTimeoutException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpHashingServerBusyException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 28
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpFeatureException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpSecureConnectionException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpAuthenticationException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpDataConnectionTimeoutException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpSecureConnectionException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpNetworkVersionException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
Esempio n. 34
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpDataTransferException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpNetworkVersionException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpDataTransferException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpDataCompressionException(string message, FtpResponse response, Exception innerException)
     :  base(message, response, innerException)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpAsynchronousOperationException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpDataCompressionException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpFileIntegrityException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpCertificateValidationException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 42
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpAuthenticationException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 43
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpException(string message, FtpResponse response, Exception innerException)
     : base(message, innerException)
 {
     _response = response;
 }
Esempio n. 44
0
        /// <summary>
        /// Waits until a happy code has been returned by the FTP server or times out.
        /// </summary>
        /// <param name="timeout">Maximum time to wait before timing out.</param>
        /// <param name="happyResponseCodes">Server response codes to wait for.</param>
        protected internal void WaitForHappyCodes(int timeout, params FtpResponseCode[] happyResponseCodes)
        {
            _responseList.Clear();
            do
            {
                FtpResponse response = GetNextCommandResponse(timeout);
                _responseList.Add(response);
                RaiseServerResponseEvent(new FtpResponse(response));

                if (!response.IsInformational)
                {
                    if (IsHappyResponse(response, happyResponseCodes))
                        break;

                    if (IsUnhappyResponse(response))
                    {
                        _response = response;
                        throw new FtpResponseException("FTP command failed.", response);
                    }
                }
            } while (true);

            _response = _responseList.GetLast();
        }
Esempio n. 45
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpException(string message, FtpResponse response)
     : base(message)
 {
     _response = response;
 }
Esempio n. 46
0
        private bool IsHappyResponse(FtpResponse response, FtpResponseCode[] happyResponseCodes)
        {
            // always return true if there are no responses to validate
            if (happyResponseCodes.Length == 0)
                return true;

            for (int j = 0; j < happyResponseCodes.Length; j++)
            {
                if (happyResponseCodes[j] == response.Code)
                    return true;
            }
            return false;
        }
Esempio n. 47
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpException(string message, FtpResponse response, Exception innerException)
     :
     base(message, innerException)
 {
     _response = response;
 }
Esempio n. 48
0
 private void RaiseServerResponseEvent(FtpResponse response)
 {
     if (ServerResponse != null)
         ServerResponse(this, new FtpResponseEventArgs(response));
 }
Esempio n. 49
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpException(string message, FtpResponse response)
     : base(message)
 {
     _response = response;
 }
Esempio n. 50
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpProxyException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 51
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="response">FtpResponse object.</param>
 public FtpResponseEventArgs(FtpResponse response)
 {
     _response = response;
 }
Esempio n. 52
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpLoginException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 53
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpFileIntegrityException(string message, FtpResponse response, Exception innerException)
     :  base(message, response, innerException)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpCommandResponseTimeoutException(string message, FtpResponse response)
     : base(message, response)
 {
 }
Esempio n. 55
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpFileIntegrityException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpDataCompressionException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 /// <param name="innerException">The inner exception object.</param>
 public FtpAuthenticationException(string message, FtpResponse response, Exception innerException)
     : base(message, response, innerException)
 {
 }
Esempio n. 58
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpFeatureException(string message, FtpResponse response)
     : base(message, response)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="response">Ftp response object.</param>
 public FtpCertificateValidationException(string message, FtpResponse response)
     : base(message, response)
 {
 }