示例#1
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;
 }
示例#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;
 }
示例#3
0
 /// <summary>
 /// Constructor for FtpResponse.
 /// </summary>
 /// <param name="rawText">Raw text information sent from the FTP server.</param>
 public FtpResponse(string rawText)
 {
     _rawText = rawText;
     _text = ParseText(rawText);
     _code = ParseCode(rawText);
     _isInformational = ParseInformational(rawText);
 }
示例#4
0
 /// <summary>
 /// Constructor for FtpResponse.
 /// </summary>
 /// <param name="rawText">Raw text information sent from the FTP server.</param>
 public FtpResponse(string rawText)
 {
     _rawText         = rawText;
     _text            = ParseText(rawText);
     _code            = ParseCode(rawText);
     _isInformational = ParseInformational(rawText);
 }
示例#5
0
        private FtpResponseCode ParseCode(string rawText)
        {
            FtpResponseCode code = FtpResponseCode.None;

            if (rawText.Length >= 3)
            {
                string codeString = rawText.Substring(0, 3);
                int    codeInt    = 0;

                if (Int32.TryParse(codeString, out codeInt))
                {
                    code = (FtpResponseCode)codeInt;
                }
            }

            return(code);
        }
示例#6
0
 private void ReadHostReply()
 {
     this._reply = this.ReadHostReplyLine();
     try
     {
         this._replyCode = (FtpResponseCode) int.Parse(this._reply.Substring(0, 3));
     }
     catch
     {
         this._replyCode = FtpResponseCode.Unknown;
     }
 }
示例#7
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;
        }
示例#8
0
        private bool IsHappyResponse(FtpResponse response, FtpResponseCode[] happyResponseCodes)
        {
            if (happyResponseCodes.Length == 0)
            {
                return true;
            }

            for (int j = 0; j < happyResponseCodes.Length; j++)
            {
                if (happyResponseCodes[j] == response.Code)
                {
                    return true;
                }
            }

            return false;
        }
示例#9
0
        private bool IsHappyResponse(FtpResponse response, FtpResponseCode[] happyResponseCodes)
        {
            // always return true if there are no responses to validate
            if (happyResponseCodes.Length == 0)
                return true;

            return happyResponseCodes.Any(t => t == response.Code);
        }