本文整理汇总了C#中XmlReader.GoToElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.GoToElement方法的具体用法?C# XmlReader.GoToElement怎么用?C# XmlReader.GoToElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlReader
的用法示例。
在下文中一共展示了XmlReader.GoToElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
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;
}
示例2: Load
internal static EdgeServerConfig Load(XmlReader reader)
{
if (reader == null) throw new ArgumentNullException("reader");
var result = new EdgeServerConfig();
reader.GoToElement();
reader.ReadStartElement();
if (!reader.IsEmptyElement)
{
while (reader.GoToSibling())
{
switch (reader.LocalName)
{
case "EdgeServerRules":
if (!reader.IsEmptyElement)
{
result.EdgeServerRulesCollection.Add(EdgeServerRules.Load(reader));
}
else
reader.Skip();
break;
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
}
else
reader.Skip();
return result;
}
示例3: Load
internal static BatchingConfig Load(XmlReader reader)
{
BatchingConfig result = null;
IBatchAgent batchAgent = null;
reader.GoToElement();
if (reader.LocalName != "Configuration")
throw new Exception("Invalid config Xml");
reader.ReadStartElement();
if (!reader.IsEmptyElement)
{
while (reader.GoToSibling())
{
switch (reader.LocalName)
{
case "BatchingConfig":
result = BatchingConfig.Load(reader);
break;
case "Service":
batchAgent = BatchAgentFactory.Load(reader);
break;
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
}
else
reader.Skip();
if (result == null || batchAgent == null)
throw new Exception("Invalid Configuraiton");
result.BatchAgent = batchAgent;
return result;
}
示例4: Load
/// <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;
}
示例5: Load
internal static QualityConfig Load(XmlReader reader)
{
if (reader == null)
throw new ArgumentNullException("reader");
QualityConfig result = new QualityConfig();
reader.GoToElement();
if (!reader.IsEmptyElement)
{
reader.ReadStartElement();
while (reader.GoToSibling())
{
switch (reader.LocalName)
{
case "DroppedFrames":
result.DroppedFrames = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "RenderedFrames":
result.RenderedFrames = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "ProcessCPULoad":
result.ProcessCpuLoad = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "SystemCPULoad":
result.SystemCpuLoad = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "Bitrate":
result.Bitrate = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "BitrateMax":
result.BitrateMax = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "BitrateMaxDuration":
result.BitrateMaxDuration = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "PerceivedBandwidth":
result.PerceivedBandwidth = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "VideoBufferSize":
result.VideoBufferSize = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "AudioBufferSize":
result.AudioBufferSize = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "Buffering":
result.Buffering = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "BitrateChangeCount":
result.BitrateChangeCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "VideoDownloadLatency":
result.VideoDownloadLatency = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "AudioDownloadLatency":
result.AudioDownloadLatency = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "DvrOperationCount":
result.DvrOperationCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "FullScreenChangeCount":
result.FullScreenChangeCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "HttpErrorCount":
result.DownloadErrorCount = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
}
else
reader.Skip();
return result;
}