本文整理汇总了C#中System.Xml.XmlReader.ReadContentAsGuid方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadContentAsGuid方法的具体用法?C# XmlReader.ReadContentAsGuid怎么用?C# XmlReader.ReadContentAsGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadContentAsGuid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Restore
public bool Restore(XmlReader reader)
{
int count = reader.AttributeCount;
for (int i = 0; i < count; ++i)
{
reader.MoveToAttribute(i);
switch (reader.Name)
{
case "id":
_id = reader.ReadContentAsGuid();
break;
case "type":
MatchType = reader.ReadContentAsEnum<QuickFilterMatchType>();
break;
case "value":
Value = reader.Value;
break;
case "ignorecase":
IgnoreCase = reader.ReadContentAsBool();
break;
case "isinclude":
IsInverted = reader.ReadContentAsBool();
break;
}
}
if (Id == Guid.Empty)
return false;
return true;
}
示例2: Restore
public void Restore(XmlReader reader, out bool neededPatching)
{
int count = reader.AttributeCount;
for (int i = 0; i < count; ++i)
{
reader.MoveToAttribute(i);
switch (reader.Name)
{
case "file":
File = reader.Value;
break;
case "followtail":
FollowTail = reader.ReadContentAsBool();
break;
case "showlinenumbers":
ShowLineNumbers = reader.ReadContentAsBool();
break;
case "stringfilter":
case "searchterm":
SearchTerm = reader.Value;
break;
case "levelfilter":
LevelFilter = reader.ReadContentAsEnum<LevelFlags>();
break;
case "colorbylevel":
ColorByLevel = reader.ReadContentAsBool();
break;
case "visibleentryindex":
VisibleLogLine = reader.ReadContentAsInt();
break;
case "id":
Id = reader.ReadContentAsGuid();
break;
case "parentid":
ParentId = reader.ReadContentAsGuid();
break;
case "lastviewed":
LastViewed = reader.ReadContentAsDateTime2();
break;
case "horizontaloffset":
HorizontalOffset = reader.ReadContentAsDouble2();
break;
}
}
if (Id == Guid.Empty)
{
Id = Guid.NewGuid();
Log.InfoFormat("Data Source '{0}' doesn't have an ID yet, setting it to: {1}",
File,
Id
);
neededPatching = true;
}
else
{
neededPatching = false;
}
reader.MoveToContent();
XmlReader subtree = reader.ReadSubtree();
while (subtree.Read())
{
switch (subtree.Name)
{
case "activatedquickfilters":
IEnumerable<Guid> filters = ReadActivatedQuickFilters(reader);
ActivatedQuickFilters.Clear();
ActivatedQuickFilters.AddRange(filters);
break;
}
}
}
示例3: ReadActivatedQuickFilters
private IEnumerable<Guid> ReadActivatedQuickFilters(XmlReader reader)
{
var guids = new List<Guid>();
XmlReader subtree = reader.ReadSubtree();
while (subtree.Read())
{
switch (subtree.Name)
{
case "quickfilter":
int count = reader.AttributeCount;
for (int i = 0; i < count; ++i)
{
reader.MoveToAttribute(i);
switch (reader.Name)
{
case "id":
guids.Add(reader.ReadContentAsGuid());
break;
}
}
break;
}
}
return guids;
}