internal static LoggingConfig Load(XmlReader reader) { if (reader == null) throw new ArgumentNullException("reader"); LoggingConfig result = new LoggingConfig(); reader.GoToElement(); if (!reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.GoToSibling()) { switch (reader.LocalName) { default: reader.Skip(); break; } } reader.ReadEndElement(); } else reader.Skip(); return result; }
internal static LoggingConfig Load(XmlReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } LoggingConfig result = new LoggingConfig(); reader.GoToElement(); if (!reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.GoToSibling()) { switch (reader.LocalName) { default: reader.Skip(); break; } } reader.ReadEndElement(); } else { reader.Skip(); } return(result); }
/// <summary> /// Creates an instance of the main diagnostic config object from an XmlReader /// </summary> internal static AnalyticsConfig Load(XmlReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } var result = new AnalyticsConfig(); result.LatencyAlertThreshold = null; reader.GoToElement(); reader.ReadStartElement(); if (!reader.IsEmptyElement) { while (reader.GoToSibling()) { switch (reader.LocalName) { case "AdditionalData": result.AdditionalData = reader.ReadElementContentAsString().Split(',').Select(kvp => kvp.Split('=')).ToDictionary(kvp => kvp[0], kvp => kvp[1]); break; case "Logging": if (!reader.IsEmptyElement) { result.LoggingConfig = LoggingConfig.Load(reader); } else { reader.Skip(); } break; case "Diagnostics": if (!reader.IsEmptyElement) { reader.ReadStartElement(); while (reader.GoToSibling()) { switch (reader.LocalName) { case "TrackQuality": result.TrackQuality = Convert.ToBoolean(reader.ReadElementContentAsInt()); break; case "TrackDownloadErrors": result.TrackDownloadErrors = Convert.ToBoolean(reader.ReadElementContentAsInt()); break; case "AggregationIntervalMilliseconds": result.AggregationInterval = TimeSpan.FromMilliseconds(reader.ReadElementContentAsInt()); break; case "PollingMilliseconds": result.PollingInterval = TimeSpan.FromMilliseconds(reader.ReadElementContentAsInt()); break; case "LatencyAlertThreshold": result.LatencyAlertThreshold = reader.ReadElementContentAsDouble(); break; case "QualityTracking": result.QualityConfig = QualityConfig.Load(reader); break; default: reader.Skip(); break; } } reader.ReadEndElement(); } else { reader.Skip(); } break; default: reader.Skip(); break; } } reader.ReadEndElement(); } else { reader.Skip(); } return(result); }