private bool OverrideWithGroupPoliciesAndGenerateWmiObjectsForTraceSource(
            TraceSourceData traceSourceData,
            bool readGroupPolicies,
            IRegistryKey machineKey,
            IRegistryKey userKey,
            bool generateWmiObjects,
            ICollection <ConfigurationSetting> wmiSettings,
            String sourceKind)
        {
            if (readGroupPolicies)
            {
                IRegistryKey policyKey = machineKey != null ? machineKey : userKey;
                if (policyKey != null)
                {
                    if (policyKey.IsPolicyKey && !policyKey.GetBoolValue(PolicyValueName).Value)
                    {
                        return(false);
                    }
                    try
                    {
                        SourceLevels?defaultLevelOverride = policyKey.GetEnumValue <SourceLevels>(SourceDefaultLevelPropertyName);

                        // the key where the values for the source listeners are stored
                        // might not exist if no listener is selected
                        traceSourceData.TraceListeners.Clear();
                        using (IRegistryKey listenersOverrideKey = policyKey.OpenSubKey(SourceTraceListenersPropertyName))
                        {
                            if (listenersOverrideKey != null)
                            {
                                foreach (String valueName in listenersOverrideKey.GetValueNames())
                                {
                                    traceSourceData.TraceListeners.Add(new TraceListenerReferenceData(valueName));
                                }
                            }
                        }
                        traceSourceData.DefaultLevel = defaultLevelOverride.Value;
                    }
                    catch (RegistryAccessException ex)
                    {
                        LogExceptionWhileOverriding(ex);
                    }
                }
            }
            if (generateWmiObjects)
            {
                LoggingSettingsWmiMapper.GenerateTraceSourceDataWmiObjects(traceSourceData, wmiSettings, sourceKind);
            }

            return(true);
        }
 protected override bool SaveChanges(ConfigurationElement sourceElement)
 {
     return(LoggingSettingsWmiMapper.SaveChanges(this, sourceElement));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="configurationSection"></param>
 /// <param name="wmiSettings"></param>
 protected override void GenerateWmiObjectsForConfigurationSection(
     LoggingSettings configurationSection,
     ICollection <ConfigurationSetting> wmiSettings)
 {
     LoggingSettingsWmiMapper.GenerateWmiObjects(configurationSection, wmiSettings);
 }
 /// <summary>
 /// <para>This method supports the Enterprise Library Manageability Extensions infrastructure and is not intended to
 /// be used directly from your code.</para>
 /// Initializes a new instance of the <see cref="LoggingSettingsManageabilityProvider"/> class with a
 /// given set of manageability providers to use when dealing with the configuration for filters, formatters and trace listeners.
 /// </summary>
 /// <param name="subProviders">The mapping from configuration element type to
 /// <see cref="ConfigurationElementManageabilityProvider"/>.</param>
 public LoggingSettingsManageabilityProvider(IDictionary <Type, ConfigurationElementManageabilityProvider> subProviders)
     : base(subProviders)
 {
     LoggingSettingsWmiMapper.RegisterWmiTypes();
 }