/// <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; }
/// <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); }
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); }
private void ReadHostReply() { this._reply = this.ReadHostReplyLine(); try { this._replyCode = (FtpResponseCode) int.Parse(this._reply.Substring(0, 3)); } catch { this._replyCode = FtpResponseCode.Unknown; } }
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; }
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; }
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); }