internal MonitorOverrideProcessor(ManagementPackUnitMonitor monitor, bool watchMPImport = false) { Monitor = monitor; IList <ManagementPackOverrideableParameter> allParams = Monitor.GetOverrideableParameters(); defaultValues = new Dictionary <ManagementPackOverrideableParameter, string>(allParams.Count); XmlDocument monitorConfiguration = new XmlDocument(); monitorConfiguration.LoadXml("<Config>" + Monitor.Configuration + "</Config>"); XPathNavigator xpathNavigator = monitorConfiguration.CreateNavigator(); // Create a dictionary of parameters and their default values foreach (ManagementPackOverrideableParameter param in allParams) { foreach (XPathNavigator selectors in xpathNavigator.Select(param.Selector.Trim(new char[] { '$' }))) { defaultValues.Add(param, selectors.IsEmptyElement ? null : selectors.Value); break; // virtual .First() } } if (watchMPImport) { Monitor.ManagementGroup.ManagementPacks.OnManagementPackCacheRefresh += ManagementPacks_OnManagementPackCacheRefresh; } }
public static MonitorOverrideProcessor PrepareOverrideProcessor(this ManagementPackUnitMonitor monitor) { return(new MonitorOverrideProcessor(monitor)); }