public static MonitoringConfig Load(XmlReader reader)
        {
            MonitoringConfig result = new MonitoringConfig();

            reader.GoToElement();
            reader.ReadStartElement();
            if (!reader.IsEmptyElement)
            {
                while (reader.GoToSibling())
                {
                    switch (reader.LocalName)
                    {
                        case "Diagnostics":
                            result.DiagnosticsConfig = DiagnosticsConfig.Load(reader);
                            break;
                        case "Logging":
                            result.LoggingConfig = LoggingConfig.Load(reader);
                            break;
                        case "AdditionalData":
                            string kvps = reader.ReadElementContentAsString();
                            foreach (var item in kvps.Split(','))
                            {
                                var kvp = item.Split('=');
                                result.AdditionalData.Add(kvp[0], kvp[1]);
                            }
                            break;
                        default:
                            reader.Skip();
                            break;
                    }
                }
            }

            return result;
        }
        /// <summary>
        /// Loads the SMFLogger from a local config file. Config file should use BuildAction=Content.
        /// </summary>
        /// <param name="configUri"></param>
        void LoadHealthMonitor(Uri configUri)
        {
            XmlReaderSettings xmlSettings = new XmlReaderSettings();

            xmlSettings.IgnoreWhitespace = true;

            using (XmlReader reader = XmlReader.Create(configUri.OriginalString, xmlSettings))
            {
                MonitoringConfig config = MonitoringConfig.Load(reader);
                monitor = new SMFLogger(config.DiagnosticsConfig, config.LoggingConfig);
                monitor.AdditionalLogData = config.AdditionalData;
            }
        }
        public static MonitoringConfig Load(XmlReader reader)
        {
            MonitoringConfig result = new MonitoringConfig();

            reader.GoToElement();
            reader.ReadStartElement();
            if (!reader.IsEmptyElement)
            {
                while (reader.GoToSibling())
                {
                    switch (reader.LocalName)
                    {
                    case "Diagnostics":
                        result.DiagnosticsConfig = DiagnosticsConfig.Load(reader);
                        break;

                    case "Logging":
                        result.LoggingConfig = LoggingConfig.Load(reader);
                        break;

                    case "AdditionalData":
                        string kvps = reader.ReadElementContentAsString();
                        foreach (var item in kvps.Split(','))
                        {
                            var kvp = item.Split('=');
                            result.AdditionalData.Add(kvp[0], kvp[1]);
                        }
                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }
            }

            return(result);
        }