-
Notifications
You must be signed in to change notification settings - Fork 3
/
MessageInColor.cs
2369 lines (2140 loc) · 88.7 KB
/
MessageInColor.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
============================================================================
Namespace: WizardWrx.ConsoleStreams
Class Name: MessageInColor
File Name: MessageInColor.cs
Synopsis: Expose a combination of static and instance methods that
reduce writing console messages in any supported
combination of foreground and background colors to
method calls that mirror the Console.Write and
Console.WriteLine methods that you already know and use.
Remarks: I put the remarks into the XML documentation blocks, to
make them visible to the Visual Studio editor, and with
the goal of generating help text from them in mind.
References: "Using Custom Classes with Application Settings,"
Richard Carr,
http://www.blackwasp.co.uk/CustomAppSettings.aspx
Author: David A. Gray
License: Copyright (C) 2014-2017, David A. Gray.
All rights reserved.
Redistribution and use in source and binary forms, with
or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of David A. Gray, nor the names of
his contributors may be used to endorse or promote
products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
David A. Gray BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Created: Monday, 06 January 2014 - Tuesday, 04 February 2014
----------------------------------------------------------------------------
Revision History
----------------------------------------------------------------------------
Date Version Author Description
---------- ------- ------ --------------------------------------------------
2014/02/04 3.2 DAG Initial implementation.
2014/02/05 3.4 DAG Make this class serializable as a string, to
simplify saving its attributes into application or
user settings.
2014/05/21 4.1 DAG CLASS RELOCATION NOTICE
It finally occurred to me that I already have a
class that is an ideal candidate to house these
classes that were the source of the tight coupling
between the WizardWrx.ApplicationHelpers and
WizardWrx.ConsoleAppAids2. Moving the tightly
coupled classes into this class, which was created
to house a single abstract base class decouples
both libraries from each other, in exchange fro a
common coupling to this class library, yielding a
much more robust architecture that will be easier
to maintain.
I elected to take the code breakage hits, which
are limited to a handful of new console programs,
mostly library test stands, in exchange for
eliminating some assembly reference conflicts that
are an even bigger nightmare, since Visual Studio
and the C# compiler both do a nice job of pointing
out the places that need to be fixed.
2014/06/24 5.1 DAG 1) Correct an oversight that left this class in
the old WizardWrx.ApplicationHelpers namespace.
Since this change affects only two other DLLs
and, at most, one user program, I took the
opportunity to promote the DLLServices2
namespace to the first rank under the overall
WizardWrx namespace.
2) Swap the method names, so that the instance
methods whose signatures exactly mirror those
of the Console.Write* methods have the same
base method names, while the static methods,
which require two additional arguments to name
the foreground and background colors have names
that make clear that you must specify colors in
any call.
The following table lists the substitutions.
------------------------------------------------------
FindStr ReplStr
------------------------ ---------------------------
public static void Write public static void RGBWrite
public void ColorWrite public void Write
------------------------------------------------------
This change means that any method that requires
additional arguments has a name that differs
slightly from that of the corresponding Console
method, and the difference is a prefix, to hint
that the colors go in front of the arguments to
the analogous console method. Likewise, methods
that have identical signatures have identical
base names to the corresponding Console method.
2015/06/21 5.5 DAG Define static methods to determine whether the
Standard Output, Standard Error, or Standard input
stream is redirected.
IsStdErrRedirected returns true if Standard
Error is redirected.
IsStdInpRedirected returns true if Standard
Error is redirected.
IsStdOutRedirected returns true if Standard
Output is redirected.
These methods apply something that I discovered
while experimenting with the PauseForPictures
routine in the test stand program. Since it can
leverage this discovery to suppress stops when
standard output is redirected, the third method
listed above, IsStdOutRedirected, stays.
2016/03/29 6.0 DAG Add methods to report their respective redirection
states, both of which are wrappers around existing
static StandardHandleState and GetStdHandleFQFN
methods on the StateManager class.
2016/04/06 6.0 DAG Move the redirection testers to StateManager.
2017/03/29 7.0 DAG Break this library apart, so that smaller subsets
of classes can be distributed and consumed
independently.
This module moved into WizardWrx.ConsoleStreams, a
new namespace, which is exported by a like named
dynamic-link library.
2017/07/11 7.0 DAG Override the ToString on the base (object) class.
2018/09/09 7.0 DAG Correct erroneous reference to a retired class,
EnhancedIOException, and the NewtonSoft NuGet
package that it used, and simplify handling of the
unexpected exception.
============================================================================
*/
#define SUPPRESS_TRACE
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
/* Added by DAG */
using System.Configuration;
using System.ComponentModel;
namespace WizardWrx.ConsoleStreams
{
/// <summary>
/// Console.Write and Console.WriteLine methods that write in living color.
/// </summary>
/// <remarks>
/// There are two identical sets of methods.
///
/// 1) Static methods write text in your choice of foreground and background
/// colors, then revert the console colors to their initial values (that is,
/// the values they had when the program loaded).
///
/// 2) Instance methods go a step further, by maintaining a record of the
/// current colors, so that the colors can progress through a range, without
/// reverting to the initial colors.
///
/// For each overload of Console.Write, there are corresponding static and
/// instance methods. The only difference in their signatures is that these
/// methods specify a foreground color and a background color, followed by
/// the same arguments that would apply to the corresponding overload of the
/// Console.Write method.
/// </remarks>
/// <seealso cref="ErrorMessagesInColor"/>
/// <seealso cref="WizardWrx.Core.PropertyDefaults"/>
[TypeConverter ( typeof ( MessageInColorConverter ) )]
[SettingsSerializeAs ( SettingsSerializeAs.String )]
public class MessageInColor
{
#region Private Instance Storage
ConsoleColor _clrOrigBackColor;
ConsoleColor _clrOrigForeColor;
ConsoleColor _clrSaveBackColor;
ConsoleColor _clrSaveForeColor;
ConsoleColor _clrTextBackColor;
ConsoleColor _clrTextForeColor;
#endregion // Private Instance Storage
#region Public Constructors
/// <summary>
/// Constructing an instance saves the current foreground and background
/// colors into two pairs of read only ConsoleColor properties. Methods
/// facilitate changing one or both colors, while retaining the original
/// colors in the other two ConsoleColor properties, which are never
/// changed after the class instance comes into being.
/// </summary>
/// <remarks>
/// This method is provided to facilitate construction of a List or
/// other sortable collection of MessageInColor objects, and allows for
/// a future version of this class to be exposed to COM.
/// </remarks>
public MessageInColor ( )
{
SaveOrigColors ( );
SaveTextColors (
_clrOrigForeColor ,
_clrOrigBackColor );
} // public MessageInColor constructor (1 of 2)
/// <summary>
/// This constructor creates an instance with its foreground and
/// background colors properties set to the specified ConsoleColor
/// values, which presumably differ from the initial foreground and
/// background colors.
/// </summary>
/// <param name="pclrTextForeColor">
/// Specify the ConsoleColor property to use as the text (foreground)
/// color in generated messages.
/// </param>
/// <param name="pclrTextBackColor">
/// Specify the ConsoleColor property to use as the background color in
/// generated messages.
/// </param>
public MessageInColor (
ConsoleColor pclrTextForeColor ,
ConsoleColor pclrTextBackColor )
{
SaveOrigColors ( );
SaveTextColors (
pclrTextForeColor ,
pclrTextBackColor );
} // public MessageInColor constructor (2 of 2)
#endregion // Public Constructors
#region Public Properties
/// <summary>
/// Gets the Console.BackgroundColor that was in force when the instance
/// was constructed.
/// </summary>
public ConsoleColor OriginalBackgroundColor
{
get { return _clrOrigBackColor; }
} // public ConsoleColor OriginalBackgroundColor Property
/// <summary>
/// Gets the Console.ForegroundColor that was in force when the instance
/// was constructed.
/// </summary>
public ConsoleColor OriginalForegroundColor
{
get { return _clrOrigForeColor; }
} // public ConsoleColor OriginalForegroundColor
/// <summary>
/// Gets or sets the Console.BackgroundColor to use for messages
/// generated by the instance Write and WriteLine methods.
/// </summary>
public ConsoleColor MessageBackgroundColor
{
get { return _clrTextBackColor; }
set { _clrTextBackColor = value; }
} // public ConsoleColor MessageBackgroundColor
/// <summary>
/// Gets or sets the Console.ForegroundColor to use for messages
/// generated by the instance Write and WriteLine methods.
/// </summary>
public ConsoleColor MessageForegroundColor
{
get { return _clrTextForeColor; }
set { _clrTextForeColor = value; }
} // public ConsoleColor MessageForegroundColor
#endregion // Public Properties
#region Public Object Method Overrides
/// <summary>
/// Override the default ToString method inherited from the base class
/// (object) to display the most significant properties, the text, or
/// foreground, and background colors set by the constructor, followed
/// by the fully qualified type name.
/// </summary>
/// <returns>
/// The return value is a string of the following format.
///
/// {Text = ConsoleColorText, Background = BackroundColor} WizardWrx.ConsoleStreams.MessageInColor
/// </returns>
/// <remarks>
/// Though this method could have easily been implemented inline, using
/// the shared message template, moving the implementation out of line
/// affords the flexibility to rearrange the display consistently, even
/// if that requires the properties to be reordered.
/// </remarks>
public override string ToString ( )
{
return ConsoleColorPropertyDisplay.MessageColorsToString (
_clrTextForeColor , // ConsoleColor pclrText
_clrTextBackColor , // ConsoleColor pclrBackground
this.GetType ( ) ); // Type ptypMessageType
} // public override string ToString
#endregion // Public Object Method Overrides
#region Instance ColorWriteLine (WriteLine) Methods
/// <summary>
/// Write the string representation of a bool (Boolean) variable.
/// </summary>
/// <param name="value">
/// Specify the Boolean value to display.
/// </param>
public void WriteLine (
bool value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (1 of 18)
/// <summary>
/// Write the string representation of a char (a Unicode character).
/// </summary>
/// <param name="value">
/// Specify the Unicode character to display.
/// </param>
public void WriteLine (
char value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (2 of 18)
/// <summary>
/// Write the string representation of a character array.
/// </summary>
/// <param name="buffer">
/// Specify the array of Unicode characters to display.
/// </param>
public void WriteLine (
char [ ] buffer )
{
SetMessageColors ( );
Console.Write ( buffer );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (3 of 18)
/// <summary>
/// Write the string representation of a decimal variable.
/// </summary>
/// <param name="value">
/// Specify the decimal value to display.
/// </param>
public void WriteLine (
decimal value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (4 of 18)
/// <summary>
/// Write the string representation of a double precision variable.
/// </summary>
/// <param name="value">
/// Specify the double precision value to display.
/// </param>
public void WriteLine (
double value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (5 of 18)
/// <summary>
/// Write the string representation of a floating point variable.
/// </summary>
/// <param name="value">
/// Specify the floating point value to display.
/// </param>
public void WriteLine (
float value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (6 of 18)
/// <summary>
/// Write the string representation of an integer variable.
/// </summary>
/// <param name="value">
/// Specify the integer value to display.
/// </param>
public void WriteLine (
int value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (7 of 18)
/// <summary>
/// Write the string representation of a long integer variable.
/// </summary>
/// <param name="value">
/// Specify the long integer value to display.
/// </param>
public void WriteLine (
long value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (8 of 18)
/// <summary>
/// Write the string representation of a generic Object variable.
/// </summary>
/// <param name="value">
/// Specify the object value to display.
/// </param>
public void WriteLine (
object value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (9 of 18)
/// <summary>
/// Write a string variable.
/// </summary>
/// <param name="value">
/// Specify the string value to display.
/// </param>
public void WriteLine (
string value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (10 of 18)
/// <summary>
/// Write the string representation of a uint (unsigned integer)
/// variable.
/// </summary>
/// <param name="value">
/// Specify the uint (unsigned integer) value to display.
/// </param>
public void WriteLine (
uint value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (11 of 18)
/// <summary>
/// Write the string representation of a ulong (unsigned long integer)
/// variable.
/// </summary>
/// <param name="value">
/// Specify the ulong (unsigned long integer) value to display.
/// </param>
public void WriteLine (
ulong value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (12 of 18)
/// <summary>
/// Write a formatted message that includes the string representation of
/// an generic object variable.
/// </summary>
/// <param name="format">
/// Use this string as the message template, which may include at most
/// one substitution token.
/// </param>
/// <param name="arg0">
/// Replace the substition token with the string representation of this
/// generic object.
/// </param>
public void WriteLine (
string format ,
object arg0 )
{
SetMessageColors ( );
Console.Write ( format , arg0 );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (13 of 18)
/// <summary>
/// Write a formatted message that includes the string representation of
/// an generic object variable.
/// </summary>
/// <param name="format">
/// Use this string as the message template, which may contains
/// substitution tokens for each object in an array of generic Object
/// variables.
/// </param>
/// <param name="arg">
/// Substitute elements from this array of generic Object variables into
/// the format string, replacing tokens with the element whose subscript
/// is the number within its brackets.
/// </param>
public void WriteLine (
string format ,
params object [ ] arg )
{
SetMessageColors ( );
Console.Write ( format , arg );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (14 of 18)
/// <summary>
/// Write a formatted message that includes a range of characters taken
/// from an array of Unicode characters.
/// </summary>
/// <param name="buffer">
/// Extract characters from this array of Unicode characters.
/// </param>
/// <param name="index">
/// Subscript of character to substitute for token {0} in format.
/// </param>
/// <param name="count">
/// Number of characters from buffer to substitute into string, which
/// must contain at least count - 1 substitution tokens.
/// </param>
public void WriteLine (
char [ ] buffer ,
int index ,
int count )
{
SetMessageColors ( );
Console.Write ( buffer , index , count );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (15 of 18)
/// <summary>
/// Write a formatted message that includes up to two substitution
/// tokens.
/// </summary>
/// <param name="format">
/// Use this string as the message template, which may contain up to two
/// substition tokens, {0} and {1}.
/// </param>
/// <param name="arg0">
/// The default string representation of this generic Object variable is
/// substituted into format for token {0}.
/// </param>
/// <param name="arg1">
/// The default string representation of this generic Object variable is
/// substituted into format for token {1}.
/// </param>
public void WriteLine (
string format ,
object arg0 ,
object arg1 )
{
SetMessageColors ( );
Console.Write ( format , arg0 , arg1 );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (16 of 18)
/// <summary>
/// Write a formatted message that includes up to three substitution
/// tokens.
/// </summary>
/// <param name="format">
/// Use this string as the message template, which may contain up to 3
/// substition tokens, {0}, {1}, and {2}.
/// </param>
/// <param name="arg0">
/// The default string representation of this generic Object variable is
/// substituted into format for token {0}.
/// </param>
/// <param name="arg1">
/// The default string representation of this generic Object variable is
/// substituted into format for token {1}.
/// </param>
/// <param name="arg2">
/// The default string representation of this generic Object variable is
/// substituted into format for token {2}.
/// </param>
public void WriteLine (
string format ,
object arg0 ,
object arg1 ,
object arg2 )
{
SetMessageColors ( );
Console.Write ( format , arg0 , arg1 , arg2 );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (17 of 18)
/// <summary>
/// Write a formatted message that includes up to four substitution
/// tokens.
/// </summary>
/// <param name="format">
/// Use this string as the message template, which may contain up to 4
/// substition tokens, {0}, {1}, {2}, and {3}.
/// </param>
/// <param name="arg0">
/// The default string representation of this generic Object variable is
/// substituted into format for token {0}.
/// </param>
/// <param name="arg1">
/// The default string representation of this generic Object variable is
/// substituted into format for token {1}.
/// </param>
/// <param name="arg2">
/// The default string representation of this generic Object variable is
/// substituted into format for token {2}.
/// </param>
/// <param name="arg3">
/// The default string representation of this generic Object variable is
/// substituted into format for token {3}.
/// </param>
public void WriteLine (
string format ,
object arg0 ,
object arg1 ,
object arg2 ,
object arg3 )
{
SetMessageColors ( );
Console.Write ( format , arg0 , arg1 , arg2 , arg3 );
RestoreMessageColors ( );
Console.WriteLine ( );
} // public void WriteLine (18 of 18)
#endregion // Instance WriteLine Methods
#region Instance ColorWrite (Write) Methods
/// <summary>
/// Write the string representation of a bool (Boolean) variable.
/// </summary>
/// <param name="value">
/// Specify the Boolean value to display.
/// </param>
public void Write (
bool value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (1 of 18)
/// <summary>
/// Write the string representation of a char (a Unicode character).
/// </summary>
/// <param name="value">
/// Specify the Unicode character to display.
/// </param>
public void Write (
char value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (2 of 18)
/// <summary>
/// Write the string representation of a character array.
/// </summary>
/// <param name="buffer">
/// Specify the array of Unicode characters to display.
/// </param>
public void Write (
char [ ] buffer )
{
SetMessageColors ( );
Console.Write ( buffer );
RestoreMessageColors ( );
} // public void Write (3 of 18)
/// <summary>
/// Write the string representation of a decimal variable.
/// </summary>
/// <param name="value">
/// Specify the decimal value to display.
/// </param>
public void Write (
decimal value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (4 of 18)
/// <summary>
/// Write the string representation of a double precision variable.
/// </summary>
/// <param name="value">
/// Specify the double precision value to display.
/// </param>
public void Write (
double value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (5 of 18)
/// <summary>
/// Write the string representation of a floating point variable.
/// </summary>
/// <param name="value">
/// Specify the floating point value to display.
/// </param>
public void Write (
float value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (6 of 18)
/// <summary>
/// Write the string representation of an integer variable.
/// </summary>
/// <param name="value">
/// Specify the integer value to display.
/// </param>
public void Write (
int value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (7 of 18)
/// <summary>
/// Write the string representation of a long integer variable.
/// </summary>
/// <param name="value">
/// Specify the long integer value to display.
/// </param>
public void Write (
long value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (8 of 18)
/// <summary>
/// Write the string representation of a generic Object variable.
/// </summary>
/// <param name="value">
/// Specify the object value to display.
/// </param>
public void Write (
object value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (9 of 18)
/// <summary>
/// Write a string variable.
/// </summary>
/// <param name="value">
/// Specify the string value to display.
/// </param>
public void Write (
string value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (10 of 18)
/// <summary>
/// Write the string representation of a uint (unsigned integer)
/// variable.
/// </summary>
/// <param name="value">
/// Specify the uint (unsigned integer) value to display.
/// </param>
public void Write (
uint value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (11 of 18)
/// <summary>
/// Write the string representation of a ulong (unsigned long integer)
/// variable.
/// </summary>
/// <param name="value">
/// Specify the ulong (unsigned long integer) value to display.
/// </param>
public void Write (
ulong value )
{
SetMessageColors ( );
Console.Write ( value );
RestoreMessageColors ( );
} // public void Write (12 of 18)
/// <summary>
/// Write a formatted message that includes the string representation of
/// an generic object variable.
/// </summary>
/// <param name="format">
/// Use this string as the message template, which may include at most
/// one substitution token.
/// </param>
/// <param name="arg0">
/// Replace the substition token with the string representation of this
/// generic object.
/// </param>
public void Write (
string format ,
object arg0 )
{
SetMessageColors ( );
Console.Write ( format , arg0 );
RestoreMessageColors ( );
} // public void Write (13 of 18)
/// <summary>
/// Write a formatted message that includes the string representation of
/// an generic object variable.
/// </summary>
/// <param name="format">
/// Use this string as the message template, which may contains
/// substitution tokens for each object in an array of generic Object
/// variables.
/// </param>
/// <param name="arg">
/// Substitute elements from this array of generic Object variables into
/// the format string, replacing tokens with the element whose subscript
/// is the number within its brackets.
/// </param>
public void Write (
string format ,
params object [ ] arg )
{
SetMessageColors ( );
Console.Write ( format , arg );
RestoreMessageColors ( );
} // public void Write (14 of 18)
/// <summary>
/// Write a formatted message that includes a range of characters taken
/// from an array of Unicode characters.
/// </summary>
/// <param name="buffer">
/// Extract characters from this array of Unicode characters.
/// </param>
/// <param name="index">
/// Subscript of character to substitute for token {0} in format.
/// </param>
/// <param name="count">
/// Number of characters from buffer to substitute into string, which
/// must contain at least count - 1 substitution tokens.
/// </param>
public void Write (
char [ ] buffer ,
int index ,
int count )
{
SetMessageColors ( );
Console.Write ( buffer , index , count );
RestoreMessageColors ( );
} // public void Write (15 of 18)
/// <summary>
/// Write a formatted message that includes up to two substitution
/// tokens.
/// </summary>
/// <param name="format">
/// Use this string as the message template, which may contain up to two
/// substition tokens, {0} and {1}.
/// </param>
/// <param name="arg0">
/// The default string representation of this generic Object variable is
/// substituted into format for token {0}.
/// </param>
/// <param name="arg1">
/// The default string representation of this generic Object variable is
/// substituted into format for token {1}.
/// </param>
public void Write (
string format ,
object arg0 ,
object arg1 )
{
SetMessageColors ( );
Console.Write ( format , arg0 , arg1 );
RestoreMessageColors ( );
} // public void Write (16 of 18)
/// <summary>