private static ConfigurationDocument LoadFromFile(string path, ConfigurationDocument configDoc, ConfigurationDocument.LineProcessor processLine)
 {
     try
     {
         if (File.Exists(path))
         {
             configDoc.LoadLines(path, processLine);
         }
         else
         {
             InternalBypassTrace.TracingConfigurationTracer.TraceDebug(0, 0L, "File {0} does not exist", new object[]
             {
                 path
             });
         }
     }
     catch (IOException)
     {
         configDoc = new ConfigurationDocument();
         InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "Clearing trace settings due to IOException opening file {0}", new object[]
         {
             path
         });
     }
     catch (UnauthorizedAccessException)
     {
         InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "Trace settings unchanged due to UnauthorizedAccessException opening file {0}", new object[]
         {
             path
         });
     }
     return(configDoc);
 }
        private void UpdateInMemory(ConfigurationDocument inMemoryTraceConfigDoc)
        {
            List <TraceComponentInfo> list;

            if (inMemoryTraceConfigDoc.FilteredTracingEnabled)
            {
                list = inMemoryTraceConfigDoc.BypassFilterEnabledComponentsList;
            }
            else
            {
                list = inMemoryTraceConfigDoc.EnabledComponentsList;
            }
            this.UpdateComponentsState(list, this.inMemoryComponentDictionary);
            inMemoryTraceConfigDoc.GetEnabledTypes(this.typeFlags, true);
            if (list != null && list.Count > 0)
            {
                this.inMemoryTracingEnabled = true;
            }
            else
            {
                this.inMemoryTracingEnabled = false;
            }
            InternalBypassTrace.TracingConfigurationTracer.TraceDebug(0, (long)this.GetHashCode(), "In Memory tracing is {0}", new object[]
            {
                this.inMemoryTracingEnabled ? "enabled" : "disabled"
            });
            this.version++;
        }
        private void UpdateTrace(ConfigurationDocument traceConfigDoc)
        {
            List <TraceComponentInfo> enabledComponentsFromFile;
            List <TraceComponentInfo> enabledComponentsFromFile2;

            if (traceConfigDoc.FilteredTracingEnabled)
            {
                enabledComponentsFromFile  = traceConfigDoc.BypassFilterEnabledComponentsList;
                enabledComponentsFromFile2 = traceConfigDoc.EnabledComponentsList;
            }
            else
            {
                enabledComponentsFromFile  = traceConfigDoc.EnabledComponentsList;
                enabledComponentsFromFile2 = new List <TraceComponentInfo>();
            }
            this.UpdateComponentsState(enabledComponentsFromFile, this.componentDictionary);
            this.UpdateComponentsState(enabledComponentsFromFile2, this.perThreadModeComponentDictionary);
            traceConfigDoc.GetEnabledTypes(this.typeFlags, false);
            this.perThreadTracingConfigured      = traceConfigDoc.FilteredTracingEnabled;
            this.customParameters                = traceConfigDoc.CustomParameters;
            this.consoleTracingEnabled           = traceConfigDoc.ConsoleTracingEnabled;
            this.systemDiagnosticsTracingEnabled = traceConfigDoc.SystemDiagnosticsTracingEnabled;
            bool anyExchangeTracingProvidersEnabled = ETWTrace.IsEnabled || this.InMemoryTracingEnabled || this.ConsoleTracingEnabled || this.SystemDiagnosticsTracingEnabled || this.FaultInjectionConfiguration.Count > 0;

            SystemTraceControl.Update(this.componentDictionary, this.EnabledTypesArray(), anyExchangeTracingProvidersEnabled);
            this.version++;
        }
        private void FaultInjectionConfigUpdate()
        {
            ConfigurationDocument configurationDocument = ConfigurationDocument.LoadFaultInjectionFromFile(ConfigFiles.FaultInjection.ConfigFilePath);

            this.faultInjectionConfiguration = configurationDocument.FaultInjectionConfig;
            InternalBypassTrace.FaultInjectionConfigurationTracer.TraceDebug(64047, 0L, "New FI configuration took effect", new object[0]);
            TraceConfigSync.Signal(configurationDocument.FileContentHash, this.ComponentInjection(), InternalBypassTrace.FaultInjectionConfigurationTracer);
        }
        private void InMemoryTraceConfigUpdate()
        {
            ConfigurationDocument configurationDocument = ConfigurationDocument.LoadFromFile(ConfigFiles.InMemory.ConfigFilePath);

            this.UpdateInMemory(configurationDocument);
            InternalBypassTrace.TracingConfigurationTracer.TraceDebug(49839, 0L, "New in-memory tracing configuration took effect", new object[0]);
            TraceConfigSync.Signal(configurationDocument.FileContentHash, this.ComponentInjection(), InternalBypassTrace.TracingConfigurationTracer);
        }
        public static ConfigurationDocument LoadFaultInjectionFromFile(string configFileName)
        {
            ConfigurationDocument configurationDocument = new ConfigurationDocument();

            return(ConfigurationDocument.LoadFromFile(configFileName, configurationDocument, new ConfigurationDocument.LineProcessor(configurationDocument.ProcessFaultInjectionLine)));
        }