The Labs \ Source Viewer \ SSCLI \ System.Diagnostics \ SystemDiagnosticsSection

  1. //------------------------------------------------------------------------------
  2. // <copyright file="SystemDiagnosticsSection.cs" company="Microsoft Corporation">
  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. // </copyright>
  14. //------------------------------------------------------------------------------
  15. using System.Configuration;
  16. namespace System.Diagnostics
  17. {
  18.     internal class SystemDiagnosticsSection : ConfigurationSection
  19.     {
  20.         private static readonly ConfigurationPropertyCollection _properties;
  21.         private static readonly ConfigurationProperty _propAssert = new ConfigurationProperty("assert", typeof(AssertSection), new AssertSection(), ConfigurationPropertyOptions.None);
  22.         private static readonly ConfigurationProperty _propPerfCounters = new ConfigurationProperty("performanceCounters", typeof(PerfCounterSection), new PerfCounterSection(), ConfigurationPropertyOptions.None);
  23.         private static readonly ConfigurationProperty _propSources = new ConfigurationProperty("sources", typeof(SourceElementsCollection), new SourceElementsCollection(), ConfigurationPropertyOptions.None);
  24.         private static readonly ConfigurationProperty _propSharedListeners = new ConfigurationProperty("sharedListeners", typeof(SharedListenerElementsCollection), new SharedListenerElementsCollection(), ConfigurationPropertyOptions.None);
  25.         private static readonly ConfigurationProperty _propSwitches = new ConfigurationProperty("switches", typeof(SwitchElementsCollection), new SwitchElementsCollection(), ConfigurationPropertyOptions.None);
  26.         private static readonly ConfigurationProperty _propTrace = new ConfigurationProperty("trace", typeof(TraceSection), new TraceSection(), ConfigurationPropertyOptions.None);
  27.        
  28.         static SystemDiagnosticsSection()
  29.         {
  30.             _properties = new ConfigurationPropertyCollection();
  31.             _properties.Add(_propAssert);
  32.             _properties.Add(_propPerfCounters);
  33.             _properties.Add(_propSources);
  34.             _properties.Add(_propSharedListeners);
  35.             _properties.Add(_propSwitches);
  36.             _properties.Add(_propTrace);
  37.         }
  38.        
  39.         [ConfigurationProperty("assert")]
  40.         public AssertSection Assert {
  41.             get { return (AssertSection)base[_propAssert]; }
  42.         }
  43.        
  44.         [ConfigurationProperty("performanceCounters")]
  45.         public PerfCounterSection PerfCounters {
  46.             get { return (PerfCounterSection)base[_propPerfCounters]; }
  47.         }
  48.        
  49.         protected override ConfigurationPropertyCollection Properties {
  50.             get { return _properties; }
  51.         }
  52.        
  53.         [ConfigurationProperty("sources")]
  54.         public SourceElementsCollection Sources {
  55.             get { return (SourceElementsCollection)base[_propSources]; }
  56.         }
  57.        
  58.         [ConfigurationProperty("sharedListeners")]
  59.         public ListenerElementsCollection SharedListeners {
  60.             get { return (ListenerElementsCollection)base[_propSharedListeners]; }
  61.         }
  62.        
  63.         [ConfigurationProperty("switches")]
  64.         public SwitchElementsCollection Switches {
  65.             get { return (SwitchElementsCollection)base[_propSwitches]; }
  66.         }
  67.        
  68.         [ConfigurationProperty("trace")]
  69.         public TraceSection Trace {
  70.             get { return (TraceSection)base[_propTrace]; }
  71.         }
  72.        
  73.         protected override void InitializeDefault()
  74.         {
  75.             Trace.Listeners.InitializeDefaultInternal();
  76.         }
  77.     }
  78. }

Developer Fusion