The Labs \ Source Viewer \ SSCLI \ Microsoft.JScript \ ScriptStream

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. namespace Microsoft.JScript
  16. {
  17.    
  18.     using System;
  19.    
  20.     //*************************************************************************************
  21.     // ScriptStream
  22.     //
  23.     // This class holds a couple of globals that are used to output messages.
  24.     // Being public the two globals can be overriden to catch messages.
  25.     //*************************************************************************************
  26.     public class ScriptStream
  27.     {
  28.         public static System.IO.TextWriter Out = Console.Out;
  29.         public static System.IO.TextWriter Error = Console.Error;
  30.        
  31.         public static void PrintStackTrace()
  32.         {
  33.             try {
  34.                 throw new Exception();
  35.             }
  36.             catch (Exception e) {
  37.                 ScriptStream.PrintStackTrace(e);
  38.             }
  39.         }
  40.        
  41.         public static void PrintStackTrace(Exception e)
  42.         {
  43.             ScriptStream.Out.WriteLine(e.StackTrace);
  44.             ScriptStream.Out.Flush();
  45.         }
  46.        
  47.         public static void Write(string str)
  48.         {
  49.             ScriptStream.Out.Write(str);
  50.         }
  51.        
  52.         public static void WriteLine(string str)
  53.         {
  54.             ScriptStream.Out.WriteLine(str);
  55.         }
  56.     }
  57.    
  58.    
  59. }

Developer Fusion