示例#1
0
 /// <summary>
 /// Constructor for FtpResponse.
 /// </summary>
 /// <param name="response">FtpResponse object.</param>
 public FtpsResponse(FtpsResponse response)
 {
     _rawText         = response.RawText;
     _text            = response.Text;
     _code            = response.Code;
     _isInformational = response.IsInformational;
 }
示例#2
0
 /// <summary>
 /// Constructor for FtpResponse.
 /// </summary>
 /// <param name="rawText">Raw text information sent from the FTP server.</param>
 public FtpsResponse(string rawText)
 {
     _rawText         = rawText;
     _text            = ParseText(rawText);
     _code            = ParseCode(rawText);
     _isInformational = ParseInformational(rawText);
 }
 /// <summary>
 /// Constructor for FtpResponse.
 /// </summary>
 /// <param name="response">FtpResponse object.</param>
 public FtpsResponse(FtpsResponse response)
 {
     _rawText = response.RawText;
     _text = response.Text;
     _code = response.Code;
     _isInformational = response.IsInformational;
 }
 /// <summary>
 /// Constructor for FtpResponse.
 /// </summary>
 /// <param name="rawText">Raw text information sent from the FTP server.</param>
 public FtpsResponse(string rawText)
 {
     _rawText = rawText;
     _text = ParseText(rawText);
     _code = ParseCode(rawText);
     _isInformational = ParseInformational(rawText);
 }
示例#5
0
        private FtpsResponseCode ParseCode(string rawText)
        {
            FtpsResponseCode code = FtpsResponseCode.None;

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

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

            return(code);
        }
示例#6
0
        private bool IsHappyResponse(FtpsResponse response, FtpsResponseCode[] 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;
        }