/// <summary> /// /// </summary> /// <param name="line"></param> public FtpCommandResultLine(String line) { Match m = RegexList.FtpResultLine.Match(line); if (m.Success == false) { throw new FtpClientException("Invalid format response." + line); } this.Text = line; Int32.TryParse(m.Groups["StatusCode"].Value, out this._CodeNumber); this._StatusCode = (FtpCommandResultCode)this.CodeNumber; this.FirstLine = true; this.LastLine = m.Groups["HasNextLine"].Value == " "; this.Message = m.Groups["Message"].Value; }
/// <summary> /// /// </summary> /// <param name="lines"></param> public FtpCommandResult(FtpCommandResultLine[] lines) { StringBuilder sb = new StringBuilder(); if (lines.Length == 0) { throw new ArgumentException("line must not be zero length."); } this._StatusCode = lines[0].StatusCode; for (int i = 0; i < lines.Length; i++) { sb.Append(lines[i].Text); if (i < lines.Length - 1) { sb.AppendLine(); } } this.Text = sb.ToString(); }
/// <summary> /// /// </summary> /// <param name="code"></param> /// <param name="line"></param> public FtpCommandResultLine(FtpCommandResultCode code, String line) { Match m = RegexList.FtpResultLine.Match(line); this.Text = line; this._StatusCode = code; this._CodeNumber = (Int32)code; if (m.Success == true) { this.FirstLine = false; this.LastLine = m.Groups["HasNextLine"].Value == " "; this.Message = m.Groups["Message"].Value; } else { this.Message = line; } }