// // // // // $Revision$ // using System; using System.Text; namespace Gallio.Extension { public class MultiLineTestResultText { StringBuilder textBuilder = new StringBuilder(); public MultiLineTestResultText(string text) { EncodeText(text); } public override string ToString() { return textBuilder.ToString(); } /// /// Replaces the first character on each new line with a space. /// The first line does not have the extra space added. /// void EncodeText(string text) { if (String.IsNullOrEmpty(text)) { return; } text = text.TrimEnd(Environment.NewLine.ToCharArray()); foreach (char ch in text) { switch (ch) { case '\n': textBuilder.Append("\r\n "); break; case '\r': // Ignore. break; default: textBuilder.Append(ch); break; } } } } }