-
Notifications
You must be signed in to change notification settings - Fork 154
/
Copy pathExtendedTextWrapper.cs
127 lines (113 loc) · 3.84 KB
/
ExtendedTextWrapper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
using System.IO;
using System.Text;
namespace NUnit.TextDisplay
{
/// <summary>
/// ExtendedTextWrapper wraps a TextWriter and makes it
/// look like an ExtendedTextWriter. All style indications
/// are ignored. It's used when text is being written
/// to a file.
/// </summary>
public class ExtendedTextWrapper : ExtendedTextWriter
{
private readonly TextWriter _writer;
public ExtendedTextWrapper(TextWriter writer)
{
_writer = writer;
}
/// <summary>
/// Write a single char value
/// </summary>
public override void Write(char value)
{
_writer.Write(value);
}
/// <summary>
/// Write a string value
/// </summary>
public override void Write(string? value)
{
_writer.Write(value);
}
/// <summary>
/// Write a string value followed by a NewLine
/// </summary>
public override void WriteLine(string? value)
{
_writer.WriteLine(value);
}
/// <summary>
/// Gets the encoding for this ExtendedTextWriter
/// </summary>
public override Encoding Encoding
{
get { return _writer.Encoding; }
}
/// <summary>
/// Dispose the Extended TextWriter
/// </summary>
protected override void Dispose(bool disposing)
{
_writer.Dispose();
}
/// <summary>
/// Writes the value with the specified style.
/// </summary>
/// <param name="style">The style.</param>
/// <param name="value">The value.</param>
public override void Write(ColorStyle style, string value)
{
Write(value);
}
/// <summary>
/// Writes the value with the specified style
/// </summary>
/// <param name="style">The style.</param>
/// <param name="value">The value.</param>
public override void WriteLine(ColorStyle style, string value)
{
WriteLine(value);
}
/// <summary>
/// Writes the label and the option that goes with it.
/// </summary>
/// <param name="label">The label.</param>
/// <param name="option">The option.</param>
public override void WriteLabel(string label, object option)
{
Write(label);
Write(option.ToString());
}
/// <summary>
/// Writes the label and the option that goes with it.
/// </summary>
/// <param name="label">The label.</param>
/// <param name="option">The option.</param>
/// <param name="valueStyle">The color to display the value with</param>
public override void WriteLabel(string label, object option, ColorStyle valueStyle)
{
WriteLabel(label, option);
}
/// <summary>
/// Writes the label and the option that goes with it followed by a new line.
/// </summary>
/// <param name="label">The label.</param>
/// <param name="option">The option.</param>
public override void WriteLabelLine(string label, object option)
{
WriteLabel(label, option);
WriteLine();
}
/// <summary>
/// Writes the label and the option that goes with it followed by a new line.
/// </summary>
/// <param name="label">The label.</param>
/// <param name="option">The option.</param>
/// <param name="valueStyle">The color to display the value with</param>
public override void WriteLabelLine(string label, object option, ColorStyle valueStyle)
{
WriteLabelLine(label, option);
}
}
}