[Android] Enable access to up-to-date tzdata on Android 10+ (#20350)
[mono-project.git] / mcs / class / corlib / System / Console.cs
blob0830e4ff079fac7aa891758f36bbbacc31ac1cd7
1 //
2 // System.Console.cs
3 //
4 // Author:
5 // Dietmar Maurer (dietmar@ximian.com)
6 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 //
8 // (C) Ximian, Inc. http://www.ximian.com
9 // (C) 2004,2005 Novell, Inc. (http://www.novell.com)
10 // Copyright 2013 Xamarin Inc. (http://www.xamarin.com)
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.Diagnostics;
33 using System.IO;
34 using System.Runtime.CompilerServices;
35 using System.Runtime.InteropServices;
36 using System.Security;
37 using System.Security.Permissions;
38 using System.Text;
39 using System.Threading;
41 namespace System
43 public static partial class Console
45 #if MONO_FEATURE_CONSOLE
46 private class WindowsConsole
48 public static bool ctrlHandlerAdded = false;
49 private delegate bool WindowsCancelHandler (int keyCode);
50 private static WindowsCancelHandler cancelHandler = new WindowsCancelHandler (DoWindowsConsoleCancelEvent);
52 [DllImport ("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
53 private static extern int GetConsoleCP ();
54 [DllImport ("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
55 private static extern int GetConsoleOutputCP ();
57 [DllImport ("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
58 private static extern bool SetConsoleCtrlHandler (WindowsCancelHandler handler, bool addHandler);
60 // Only call the event handler if Control-C was pressed (code == 0), nothing else
61 private static bool DoWindowsConsoleCancelEvent (int keyCode)
63 if (keyCode == 0)
64 DoConsoleCancelEvent ();
65 return keyCode == 0;
68 [MethodImpl (MethodImplOptions.NoInlining)]
69 public static int GetInputCodePage ()
71 return GetConsoleCP ();
74 [MethodImpl (MethodImplOptions.NoInlining)]
75 public static int GetOutputCodePage ()
77 return GetConsoleOutputCP ();
80 public static void AddCtrlHandler ()
82 SetConsoleCtrlHandler (cancelHandler, true);
83 ctrlHandlerAdded = true;
86 public static void RemoveCtrlHandler ()
88 SetConsoleCtrlHandler (cancelHandler, false);
89 ctrlHandlerAdded = false;
92 #endif
94 internal static TextWriter stdout;
95 private static TextWriter stderr;
96 private static TextReader stdin;
98 static Console ()
100 #if MONO_FEATURE_CONSOLE
101 if (Environment.IsRunningOnWindows) {
103 // On Windows, follow the Windows tradition
105 try {
106 inputEncoding = Encoding.GetEncoding (WindowsConsole.GetInputCodePage ());
107 outputEncoding = Encoding.GetEncoding (WindowsConsole.GetOutputCodePage ());
108 // ArgumentException and NotSupportedException can be thrown as well
109 } catch {
110 // FIXME: I18N assemblies are not available when compiling mcs
111 // Use Latin 1 as it is fast and UTF-8 is never used as console code page
112 inputEncoding = outputEncoding = Encoding.Default;
114 } else
115 #endif
118 // On Unix systems (128), do not output the
119 // UTF-8 ZWNBSP (zero-width non-breaking space).
121 int code_page = 0;
122 EncodingHelper.InternalCodePage (ref code_page);
124 if (code_page != -1 && ((code_page & 0x0fffffff) == 3 // UTF8Encoding.UTF8_CODE_PAGE
125 || ((code_page & 0x10000000) != 0)))
126 inputEncoding = outputEncoding = EncodingHelper.UTF8Unmarked;
127 else
128 inputEncoding = outputEncoding = Encoding.Default;
131 SetupStreams (inputEncoding, outputEncoding);
134 static void SetupStreams (Encoding inputEncoding, Encoding outputEncoding)
136 #if MONO_FEATURE_CONSOLE
137 if (!Environment.IsRunningOnWindows && ConsoleDriver.IsConsole) {
138 stdin = new CStreamReader (OpenStandardInput (0), inputEncoding);
139 stdout = TextWriter.Synchronized (new CStreamWriter (OpenStandardOutput (0), outputEncoding, true) { AutoFlush = true });
140 stderr = TextWriter.Synchronized (new CStreamWriter (OpenStandardError (0), outputEncoding, true) { AutoFlush = true });
141 } else
142 #endif
144 stdin = TextReader.Synchronized (new UnexceptionalStreamReader (OpenStandardInput (0), inputEncoding));
146 #if MONOTOUCH
147 stdout = new NSLogWriter ();
148 stderr = new NSLogWriter ();
149 #else
150 stdout = TextWriter.Synchronized (new UnexceptionalStreamWriter (OpenStandardOutput (0), outputEncoding) { AutoFlush = true });
151 stderr = TextWriter.Synchronized (new UnexceptionalStreamWriter (OpenStandardError (0), outputEncoding) { AutoFlush = true });
153 #if MONODROID && !MOBILE_DESKTOP_HOST
154 if (LogcatTextWriter.IsRunningOnAndroid ()) {
155 stdout = TextWriter.Synchronized (new LogcatTextWriter ("mono-stdout", stdout));
156 stderr = TextWriter.Synchronized (new LogcatTextWriter ("mono-stderr", stderr));
158 #endif // MONODROID
159 #endif // MONOTOUCH
162 GC.SuppressFinalize (stdout);
163 GC.SuppressFinalize (stderr);
164 GC.SuppressFinalize (stdin);
167 public static TextWriter Error {
168 get {
169 return stderr;
173 public static TextWriter Out {
174 get {
175 return stdout;
179 public static TextReader In {
180 get {
181 return stdin;
185 private static Stream Open (IntPtr handle, FileAccess access, int bufferSize)
187 try {
188 // TODO: Should use __ConsoleStream from reference sources
189 var stream = new FileStream (handle, access, false, bufferSize, false, true);
190 // Don't run the finalizer on the underlying stream so that System.WriteLine can be
191 // called inside a finalizer during shutdown or domain unload.
192 GC.SuppressFinalize (stream);
193 return stream;
194 } catch (IOException) {
195 return Stream.Null;
199 public static Stream OpenStandardError ()
201 return OpenStandardError (0);
204 // calling any FileStream constructor with a handle normally
205 // requires permissions UnmanagedCode permissions. In this
206 // case we assert this permission so the console can be used
207 // in partial trust (i.e. without having UnmanagedCode).
208 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
209 public static Stream OpenStandardError (int bufferSize)
211 return Open (MonoIO.ConsoleError, FileAccess.Write, bufferSize);
214 public static Stream OpenStandardInput ()
216 return OpenStandardInput (0);
219 // calling any FileStream constructor with a handle normally
220 // requires permissions UnmanagedCode permissions. In this
221 // case we assert this permission so the console can be used
222 // in partial trust (i.e. without having UnmanagedCode).
223 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
224 public static Stream OpenStandardInput (int bufferSize)
226 return Open (MonoIO.ConsoleInput, FileAccess.Read, bufferSize);
229 public static Stream OpenStandardOutput ()
231 return OpenStandardOutput (0);
234 // calling any FileStream constructor with a handle normally
235 // requires permissions UnmanagedCode permissions. In this
236 // case we assert this permission so the console can be used
237 // in partial trust (i.e. without having UnmanagedCode).
238 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
239 public static Stream OpenStandardOutput (int bufferSize)
241 return Open (MonoIO.ConsoleOutput, FileAccess.Write, bufferSize);
244 [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
245 public static void SetError (TextWriter newError)
247 if (newError == null)
248 throw new ArgumentNullException ("newError");
250 stderr = TextWriter.Synchronized (newError);
253 [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
254 public static void SetIn (TextReader newIn)
256 if (newIn == null)
257 throw new ArgumentNullException ("newIn");
259 stdin = TextReader.Synchronized (newIn);
262 [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
263 public static void SetOut (TextWriter newOut)
265 if (newOut == null)
266 throw new ArgumentNullException ("newOut");
268 stdout = TextWriter.Synchronized (newOut);
271 public static void Write (bool value)
273 stdout.Write (value);
276 public static void Write (char value)
278 stdout.Write (value);
281 public static void Write (char[] buffer)
283 stdout.Write (buffer);
286 public static void Write (decimal value)
288 stdout.Write (value);
291 public static void Write (double value)
293 stdout.Write (value);
296 public static void Write (int value)
298 stdout.Write (value);
301 public static void Write (long value)
303 stdout.Write (value);
306 public static void Write (object value)
308 stdout.Write (value);
311 public static void Write (float value)
313 stdout.Write (value);
316 public static void Write (string value)
318 stdout.Write (value);
321 [CLSCompliant (false)]
322 public static void Write (uint value)
324 stdout.Write (value);
327 [CLSCompliant (false)]
328 public static void Write (ulong value)
330 stdout.Write (value);
333 public static void Write (string format, object arg0)
335 stdout.Write (format, arg0);
338 public static void Write (string format, params object[] arg)
340 if (arg == null)
341 stdout.Write (format);
342 else
343 stdout.Write (format, arg);
346 public static void Write (char[] buffer, int index, int count)
348 stdout.Write (buffer, index, count);
351 public static void Write (string format, object arg0, object arg1)
353 stdout.Write (format, arg0, arg1);
356 public static void Write (string format, object arg0, object arg1, object arg2 )
358 stdout.Write (format, arg0, arg1, arg2);
361 [CLSCompliant (false)]
362 public static void Write (string format, object arg0, object arg1, object arg2, object arg3, __arglist)
364 ArgIterator iter = new ArgIterator (__arglist);
365 int argCount = iter.GetRemainingCount();
367 object[] args = new object [argCount + 4];
368 args [0] = arg0;
369 args [1] = arg1;
370 args [2] = arg2;
371 args [3] = arg3;
372 for (int i = 0; i < argCount; i++) {
373 TypedReference typedRef = iter.GetNextArg ();
374 args [i + 4] = TypedReference.ToObject (typedRef);
377 stdout.Write (String.Format (format, args));
380 public static void WriteLine ()
382 stdout.WriteLine ();
385 public static void WriteLine (bool value)
387 stdout.WriteLine (value);
390 public static void WriteLine (char value)
392 stdout.WriteLine (value);
395 public static void WriteLine (char[] buffer)
397 stdout.WriteLine (buffer);
400 public static void WriteLine (decimal value)
402 stdout.WriteLine (value);
405 public static void WriteLine (double value)
407 stdout.WriteLine (value);
410 public static void WriteLine (int value)
412 stdout.WriteLine (value);
415 public static void WriteLine (long value)
417 stdout.WriteLine (value);
420 public static void WriteLine (object value)
422 stdout.WriteLine (value);
425 public static void WriteLine (float value)
427 stdout.WriteLine (value);
430 public static void WriteLine (string value)
432 stdout.WriteLine (value);
435 [CLSCompliant (false)]
436 public static void WriteLine (uint value)
438 stdout.WriteLine (value);
441 [CLSCompliant (false)]
442 public static void WriteLine (ulong value)
444 stdout.WriteLine (value);
447 public static void WriteLine (string format, object arg0)
449 stdout.WriteLine (format, arg0);
452 public static void WriteLine (string format, params object[] arg)
454 if (arg == null)
455 stdout.WriteLine (format);
456 else
457 stdout.WriteLine (format, arg);
460 public static void WriteLine (char[] buffer, int index, int count)
462 stdout.WriteLine (buffer, index, count);
465 public static void WriteLine (string format, object arg0, object arg1)
467 stdout.WriteLine (format, arg0, arg1);
470 public static void WriteLine (string format, object arg0, object arg1, object arg2)
472 stdout.WriteLine (format, arg0, arg1, arg2);
475 [CLSCompliant (false)]
476 public static void WriteLine (string format, object arg0, object arg1, object arg2, object arg3, __arglist)
478 ArgIterator iter = new ArgIterator (__arglist);
479 int argCount = iter.GetRemainingCount();
481 object[] args = new object [argCount + 4];
482 args [0] = arg0;
483 args [1] = arg1;
484 args [2] = arg2;
485 args [3] = arg3;
486 for (int i = 0; i < argCount; i++) {
487 TypedReference typedRef = iter.GetNextArg ();
488 args [i + 4] = TypedReference.ToObject (typedRef);
491 stdout.WriteLine (String.Format (format, args));
493 #if MONO_FEATURE_CONSOLE
494 public static int Read ()
496 if ((stdin is CStreamReader) && ConsoleDriver.IsConsole) {
497 return ConsoleDriver.Read ();
498 } else {
499 return stdin.Read ();
503 public static string ReadLine ()
505 if ((stdin is CStreamReader) && ConsoleDriver.IsConsole) {
506 return ConsoleDriver.ReadLine ();
507 } else {
508 return stdin.ReadLine ();
511 #else
512 public static int Read ()
514 return stdin.Read ();
517 public static string ReadLine ()
519 return stdin.ReadLine ();
521 #endif
523 // FIXME: Console should use these encodings when changed
524 static Encoding inputEncoding;
525 static Encoding outputEncoding;
527 public static Encoding InputEncoding {
528 get { return inputEncoding; }
529 set {
530 inputEncoding = value;
531 SetupStreams (inputEncoding, outputEncoding);
535 public static Encoding OutputEncoding {
536 get { return outputEncoding; }
537 set {
538 outputEncoding = value;
539 SetupStreams (inputEncoding, outputEncoding);
543 #if MONO_FEATURE_CONSOLE
544 public static ConsoleColor BackgroundColor {
545 get { return ConsoleDriver.BackgroundColor; }
546 set { ConsoleDriver.BackgroundColor = value; }
549 public static int BufferHeight {
550 get { return ConsoleDriver.BufferHeight; }
551 [MonoLimitation ("Implemented only on Windows")]
552 set { ConsoleDriver.BufferHeight = value; }
555 public static int BufferWidth {
556 get { return ConsoleDriver.BufferWidth; }
557 [MonoLimitation ("Implemented only on Windows")]
558 set { ConsoleDriver.BufferWidth = value; }
561 [MonoLimitation ("Implemented only on Windows")]
562 public static bool CapsLock {
563 get { return ConsoleDriver.CapsLock; }
566 public static int CursorLeft {
567 get { return ConsoleDriver.CursorLeft; }
568 set { ConsoleDriver.CursorLeft = value; }
571 public static int CursorTop {
572 get { return ConsoleDriver.CursorTop; }
573 set { ConsoleDriver.CursorTop = value; }
576 public static int CursorSize {
577 get { return ConsoleDriver.CursorSize; }
578 set { ConsoleDriver.CursorSize = value; }
581 public static bool CursorVisible {
582 get { return ConsoleDriver.CursorVisible; }
583 set { ConsoleDriver.CursorVisible = value; }
586 public static ConsoleColor ForegroundColor {
587 get { return ConsoleDriver.ForegroundColor; }
588 set { ConsoleDriver.ForegroundColor = value; }
591 public static bool KeyAvailable {
592 get { return ConsoleDriver.KeyAvailable; }
595 public static int LargestWindowHeight {
596 get { return ConsoleDriver.LargestWindowHeight; }
599 public static int LargestWindowWidth {
600 get { return ConsoleDriver.LargestWindowWidth; }
603 public static bool NumberLock {
604 get { return ConsoleDriver.NumberLock; }
607 public static string Title {
608 get { return ConsoleDriver.Title; }
609 set { ConsoleDriver.Title = value; }
612 public static bool TreatControlCAsInput {
613 get { return ConsoleDriver.TreatControlCAsInput; }
614 set { ConsoleDriver.TreatControlCAsInput = value; }
617 public static int WindowHeight {
618 get { return ConsoleDriver.WindowHeight; }
619 set { ConsoleDriver.WindowHeight = value; }
622 public static int WindowLeft {
623 get { return ConsoleDriver.WindowLeft; }
624 set { ConsoleDriver.WindowLeft = value; }
627 public static int WindowTop {
628 get { return ConsoleDriver.WindowTop; }
629 set { ConsoleDriver.WindowTop = value; }
632 public static int WindowWidth {
633 get { return ConsoleDriver.WindowWidth; }
634 set { ConsoleDriver.WindowWidth = value; }
637 public static bool IsErrorRedirected {
638 get {
639 return ConsoleDriver.IsErrorRedirected;
643 public static bool IsOutputRedirected {
644 get {
645 return ConsoleDriver.IsOutputRedirected;
649 public static bool IsInputRedirected {
650 get {
651 return ConsoleDriver.IsInputRedirected;
655 public static void Beep ()
657 Beep (1000, 500);
660 public static void Beep (int frequency, int duration)
662 if (frequency < 37 || frequency > 32767)
663 throw new ArgumentOutOfRangeException ("frequency");
665 if (duration <= 0)
666 throw new ArgumentOutOfRangeException ("duration");
668 ConsoleDriver.Beep (frequency, duration);
671 public static void Clear ()
673 ConsoleDriver.Clear ();
676 [MonoLimitation ("Implemented only on Windows")]
677 public static void MoveBufferArea (int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight,
678 int targetLeft, int targetTop)
680 ConsoleDriver.MoveBufferArea (sourceLeft, sourceTop, sourceWidth, sourceHeight, targetLeft, targetTop);
683 [MonoLimitation ("Implemented only on Windows")]
684 public static void MoveBufferArea (int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight,
685 int targetLeft, int targetTop, Char sourceChar,
686 ConsoleColor sourceForeColor, ConsoleColor sourceBackColor)
688 ConsoleDriver.MoveBufferArea (sourceLeft, sourceTop, sourceWidth, sourceHeight, targetLeft, targetTop,
689 sourceChar, sourceForeColor, sourceBackColor);
692 public static ConsoleKeyInfo ReadKey ()
694 return ReadKey (false);
697 public static ConsoleKeyInfo ReadKey (bool intercept)
699 return ConsoleDriver.ReadKey (intercept);
702 public static void ResetColor ()
704 ConsoleDriver.ResetColor ();
707 [MonoLimitation ("Only works on windows")]
708 public static void SetBufferSize (int width, int height)
710 ConsoleDriver.SetBufferSize (width, height);
713 public static void SetCursorPosition (int left, int top)
715 ConsoleDriver.SetCursorPosition (left, top);
718 public static void SetWindowPosition (int left, int top)
720 ConsoleDriver.SetWindowPosition (left, top);
723 public static void SetWindowSize (int width, int height)
725 ConsoleDriver.SetWindowSize (width, height);
728 static ConsoleCancelEventHandler cancel_event;
729 public static event ConsoleCancelEventHandler CancelKeyPress {
730 add {
731 if (ConsoleDriver.Initialized == false)
732 ConsoleDriver.Init ();
734 cancel_event += value;
736 if (Environment.IsRunningOnWindows && !WindowsConsole.ctrlHandlerAdded)
737 WindowsConsole.AddCtrlHandler();
739 remove {
740 if (ConsoleDriver.Initialized == false)
741 ConsoleDriver.Init ();
743 cancel_event -= value;
745 if (cancel_event == null && Environment.IsRunningOnWindows)
747 // Need to remove our hook if there's nothing left in the event
748 if (WindowsConsole.ctrlHandlerAdded)
749 WindowsConsole.RemoveCtrlHandler();
754 static void DoConsoleCancelEventInBackground ()
756 ThreadPool.UnsafeQueueUserWorkItem (_ => DoConsoleCancelEvent(), null);
759 static void DoConsoleCancelEvent ()
761 bool exit = true;
762 if (cancel_event != null) {
763 ConsoleCancelEventArgs args = new ConsoleCancelEventArgs (ConsoleSpecialKey.ControlC);
764 Delegate [] delegates = cancel_event.GetInvocationList ();
765 foreach (ConsoleCancelEventHandler d in delegates){
766 try {
767 // Sender is always null here.
768 d (null, args);
769 } catch {} // Ignore any exception.
771 exit = !args.Cancel;
774 if (exit)
775 Environment.Exit (58);
777 #else
778 // largely inspired by https://github.com/dotnet/corefx/blob/be8d2ce3964968cec9322a64211e37682085db70/src/System.Console/src/System/ConsolePal.WinRT.cs, because it's a similar platform where a console might not be available
780 // provide simply color tracking that allows round-tripping
781 internal const ConsoleColor UnknownColor = (ConsoleColor)(-1);
782 private static ConsoleColor s_trackedForegroundColor = UnknownColor;
783 private static ConsoleColor s_trackedBackgroundColor = UnknownColor;
785 public static ConsoleColor ForegroundColor
789 return s_trackedForegroundColor;
793 lock (Console.Out) // synchronize with other writers
795 s_trackedForegroundColor = value;
800 public static ConsoleColor BackgroundColor
804 return s_trackedBackgroundColor;
808 lock (Console.Out) // synchronize with other writers
810 s_trackedBackgroundColor = value;
815 public static int BufferWidth
817 get { throw new PlatformNotSupportedException (); }
818 set { throw new PlatformNotSupportedException (); }
821 public static int BufferHeight
823 get { throw new PlatformNotSupportedException (); }
824 set { throw new PlatformNotSupportedException (); }
827 public static bool CapsLock { get { throw new PlatformNotSupportedException (); } }
829 public static int CursorLeft
831 get { throw new PlatformNotSupportedException (); }
832 set { throw new PlatformNotSupportedException (); }
835 public static int CursorTop
837 get { throw new PlatformNotSupportedException (); }
838 set { throw new PlatformNotSupportedException (); }
841 public static int CursorSize
843 get { return 100; }
844 set { throw new PlatformNotSupportedException(); }
847 public static bool CursorVisible
849 get { throw new PlatformNotSupportedException (); }
850 set { throw new PlatformNotSupportedException (); }
853 public static bool KeyAvailable { get { throw new PlatformNotSupportedException (); } }
855 public static int LargestWindowWidth
857 get { throw new PlatformNotSupportedException (); }
858 set { throw new PlatformNotSupportedException (); }
861 public static int LargestWindowHeight
863 get { throw new PlatformNotSupportedException (); }
864 set { throw new PlatformNotSupportedException (); }
867 public static bool NumberLock { get { throw new PlatformNotSupportedException (); } }
869 public static string Title
871 get { throw new PlatformNotSupportedException (); }
872 set { throw new PlatformNotSupportedException (); }
875 public static bool TreatControlCAsInput
877 get { throw new PlatformNotSupportedException (); }
878 set { throw new PlatformNotSupportedException (); }
881 public static int WindowHeight
883 get { throw new PlatformNotSupportedException (); }
884 set { throw new PlatformNotSupportedException (); }
887 public static int WindowLeft
889 get { return 0; }
890 set { throw new PlatformNotSupportedException (); }
893 public static int WindowTop
895 get { return 0; }
896 set { throw new PlatformNotSupportedException (); }
899 public static int WindowWidth
901 get { throw new PlatformNotSupportedException (); }
902 set { throw new PlatformNotSupportedException (); }
905 public static bool IsErrorRedirected { get { throw new PlatformNotSupportedException (); } }
907 public static bool IsInputRedirected { get { throw new PlatformNotSupportedException (); } }
909 public static bool IsOutputRedirected { get { throw new PlatformNotSupportedException (); } }
911 public static void Beep () { throw new PlatformNotSupportedException (); }
913 public static void Beep (int frequency, int duration) { throw new PlatformNotSupportedException (); }
915 public static void Clear () { throw new PlatformNotSupportedException (); }
917 public static void MoveBufferArea (int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop) { throw new PlatformNotSupportedException(); }
919 public static void MoveBufferArea (int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop, char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor) { throw new PlatformNotSupportedException(); }
922 public static ConsoleKeyInfo ReadKey ()
924 return ReadKey (false);
927 public static ConsoleKeyInfo ReadKey (bool intercept) { throw new PlatformNotSupportedException (); }
929 public static void ResetColor ()
931 lock (Console.Out) // synchronize with other writers
933 s_trackedForegroundColor = UnknownColor;
934 s_trackedBackgroundColor = UnknownColor;
938 public static void SetBufferSize (int width, int height) { throw new PlatformNotSupportedException (); }
940 public static void SetCursorPosition (int left, int top) { throw new PlatformNotSupportedException (); }
942 public static void SetWindowPosition (int left, int top) { throw new PlatformNotSupportedException (); }
944 public static void SetWindowSize (int width, int height) { throw new PlatformNotSupportedException (); }
946 public static event ConsoleCancelEventHandler CancelKeyPress {
947 add {
948 throw new PlatformNotSupportedException ();
950 remove {
951 throw new PlatformNotSupportedException ();
954 #endif