@@ -82,13 +82,17 @@ public Style Push() {
82
82
/// <see cref="Style"/>.
83
83
/// </summary>
84
84
/// <param name="msg">The <see cref="String"/> to write.</param>
85
- /// <param name="style ">The <see cref="Style "/> to use whilst writing.</param>
85
+ /// <param name="writer ">The <see cref="IConsoleWriter "/> to use for writing.</param>
86
86
public void Write ( String msg , IConsoleWriter writer ) {
87
+ ArgumentNullException . ThrowIfNullOrEmpty ( msg ) ;
88
+ writer ??= Writers . NormalConsoleWriter ;
87
89
Style old_Style = this . Push ( ) ;
88
90
writer . Write ( msg ) ;
89
91
_ = old_Style . Push ( ) ;
90
92
}
91
93
public void WriteLine ( String msg , IConsoleWriter writer ) {
94
+ ArgumentNullException . ThrowIfNullOrEmpty ( msg ) ;
95
+ writer ??= Writers . NormalConsoleWriter ;
92
96
Style old_Style = this . Push ( ) ;
93
97
writer . WriteLine ( msg ) ;
94
98
_ = old_Style . Push ( ) ;
@@ -100,16 +104,19 @@ public void WriteLine(String msg, IConsoleWriter writer) {
100
104
/// </summary>
101
105
/// <param name="style">The <see cref="Style"/> to implicitly cast.</param>
102
106
public static implicit operator ( ConsoleColor fg , ConsoleColor bg ) ( Style style ) {
107
+ ArgumentNullException . ThrowIfNull ( style ) ;
103
108
return new ( style . Foreground , style . Background ) ;
104
109
}
110
+
105
111
/// <summary>
106
112
/// Explicitly casts a <see cref="Style"/> from a
107
113
/// <see cref="ConsoleColor"/> <see cref="Tuple"/>.
108
114
/// </summary>
109
- /// <param name="tup ">The <see cref="Tuple"/> to cast.</param>
115
+ /// <param name="tuple ">The <see cref="Tuple"/> to cast.</param>
110
116
public static explicit operator Style ( ( ConsoleColor fg , ConsoleColor bg ) tuple ) {
111
117
return new ( ) { Foreground = tuple . fg , Background = tuple . bg } ;
112
118
}
119
+
113
120
/// <summary>
114
121
/// Explicitly casts a <see cref="Style"/> from a
115
122
/// <see cref="ConsoleColor"/> instance.
@@ -119,6 +126,16 @@ public static explicit operator Style((ConsoleColor fg, ConsoleColor bg) tuple)
119
126
public static explicit operator Style ( ConsoleColor color ) {
120
127
return new ( color ) ;
121
128
}
129
+
130
+ public ( ConsoleColor fg , ConsoleColor bg ) ToValueTuple ( ) {
131
+ throw new NotImplementedException ( ) ;
132
+ }
133
+
134
+ public static Style ToStyle ( Style fg , Style bg ) {
135
+ return new ( ) { Foreground = fg , Background = bg } ;
136
+ throw new NotImplementedException ( ) ;
137
+ }
138
+
122
139
}
123
140
public class Menu {
124
141
#region Properties
0 commit comments