The Labs \ Source Viewer \ SSCLI \ System.Runtime.Serialization.Formatters \ InternalST

  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. /*============================================================
  16. **
  17. ** Class: SerTrace
  18. **
  19. **
  20. ** Purpose: Routine used for Debugging
  21. **
  22. **
  23. ===========================================================*/
  24. namespace System.Runtime.Serialization.Formatters
  25. {
  26.     using System;
  27.     using System.Runtime.Serialization;
  28.     using System.Security.Permissions;
  29.     using System.Reflection;
  30.     using System.Diagnostics;
  31.    
  32.     // To turn on tracing, add the following to the per-machine
  33.     // rotor.ini file, inside the [Rotor] section:
  34.     // ManagedLogFacility=0x32
  35.     // where:
  36.     // 0x2 is System.Runtime.Serialization
  37.     // 0x10 is Binary Formatter
  38.     // 0x20 is Soap Formatter
  39.     //
  40.     // Turn on Logging in the jitmgr
  41.    
  42.    
  43.     // remoting Wsdl logging
  44.     /// <internalonly/>
  45.     [StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0x" + AssemblyRef.EcmaPublicKeyFull, Name = "System.Runtime.Remoting")]
  46.     [System.Runtime.InteropServices.ComVisible(true)]
  47.     public sealed class InternalRM
  48.     {
  49.         /// <internalonly/>
  50.         [System.Diagnostics.Conditional("_LOGGING")]
  51.         public static void InfoSoap(params object[] messages)
  52.         {
  53.             BCLDebug.Trace("SOAP", messages);
  54.         }
  55.        
  56.         //[System.Diagnostics.Conditional("_LOGGING")]
  57.         /// <internalonly/>
  58.         public static bool SoapCheckEnabled()
  59.         {
  60.             return BCLDebug.CheckEnabled("SOAP");
  61.         }
  62.     }
  63.    
  64.     /// <internalonly/>
  65.     [StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0x" + AssemblyRef.MicrosoftPublicKeyFull, Name = "System.Runtime.Serialization.Formatters.Soap")]
  66.     [System.Runtime.InteropServices.ComVisible(true)]
  67.     public sealed class InternalST
  68.     {
  69.         private InternalST()
  70.         {
  71.         }
  72.        
  73.         /// <internalonly/>
  74.         [System.Diagnostics.Conditional("_LOGGING")]
  75.         public static void InfoSoap(params object[] messages)
  76.         {
  77.             BCLDebug.Trace("SOAP", messages);
  78.         }
  79.        
  80.         //[System.Diagnostics.Conditional("_LOGGING")]
  81.         /// <internalonly/>
  82.         public static bool SoapCheckEnabled()
  83.         {
  84.             return BCLDebug.CheckEnabled("Soap");
  85.         }
  86.        
  87.         /// <internalonly/>
  88.         [System.Diagnostics.Conditional("SER_LOGGING")]
  89.         public static void Soap(params object[] messages)
  90.         {
  91.             if (!(messages[0] is string))
  92.                 messages[0] = (messages[0].GetType()).Name + " ";
  93.             else
  94.                 messages[0] = messages[0] + " ";
  95.            
  96.             BCLDebug.Trace("SOAP", messages);
  97.         }
  98.        
  99.         /// <internalonly/>
  100.         [System.Diagnostics.Conditional("_DEBUG")]
  101.         public static void SoapAssert(bool condition, string message)
  102.         {
  103.             BCLDebug.Assert(condition, message);
  104.         }
  105.        
  106.         /// <internalonly/>
  107.         public static void SerializationSetValue(FieldInfo fi, object target, object value)
  108.         {
  109.             if (fi == null)
  110.                 throw new ArgumentNullException("fi");
  111.            
  112.             if (target == null)
  113.                 throw new ArgumentNullException("target");
  114.            
  115.             if (value == null)
  116.                 throw new ArgumentNullException("value");
  117.            
  118.             FormatterServices.SerializationSetValue(fi, target, value);
  119.         }
  120.        
  121.         /// <internalonly/>
  122.         public static Assembly LoadAssemblyFromString(string assemblyString)
  123.         {
  124.             return FormatterServices.LoadAssemblyFromString(assemblyString);
  125.         }
  126.     }
  127.    
  128.     static internal class SerTrace
  129.     {
  130.         [Conditional("_LOGGING")]
  131.         static internal void InfoLog(params object[] messages)
  132.         {
  133.             BCLDebug.Trace("BINARY", messages);
  134.         }
  135.        
  136.         [Conditional("SER_LOGGING")]
  137.         static internal void Log(params object[] messages)
  138.         {
  139.             if (!(messages[0] is string))
  140.                 messages[0] = (messages[0].GetType()).Name + " ";
  141.             else
  142.                 messages[0] = messages[0] + " ";
  143.             BCLDebug.Trace("BINARY", messages);
  144.         }
  145.     }
  146. }

Developer Fusion