本文整理汇总了C#中System.Xml.XmlReader.ReadContentAsInt方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadContentAsInt方法的具体用法?C# XmlReader.ReadContentAsInt怎么用?C# XmlReader.ReadContentAsInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadContentAsInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "label":
this.Label = reader.Value;
continue;
case "width":
this.Width = reader.ReadContentAsInt();
continue;
case "height":
this.Height = reader.ReadContentAsInt();
continue;
case "source":
this.Source = reader.Value;
continue;
case "url":
this.Url = reader.Value;
continue;
case "media":
this.MediaType = reader.Value == "photo" ? MediaType.Photos : MediaType.Videos;
continue;
default:
continue;
}
}
reader.Read();
}
示例2: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "ready":
this.Ready = reader.Value == "1";
continue;
case "failed":
this.Failed = reader.Value == "1";
continue;
case "pending":
this.Pending = reader.Value == "1";
continue;
case "duration":
this.Duration = !string.IsNullOrEmpty(reader.Value) ? reader.ReadContentAsInt() : -1;
continue;
case "width":
this.Width = !string.IsNullOrEmpty(reader.Value) ? reader.ReadContentAsInt() : -1;
continue;
case "height":
this.Height = !string.IsNullOrEmpty(reader.Value) ? reader.ReadContentAsInt() : -1;
continue;
default:
continue;
}
}
reader.Read();
}
示例3: while
void IFlickrParsable.Load(XmlReader reader)
{
if (!(reader.LocalName != "subscription"))
;
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "topic":
this.Topic = reader.Value;
continue;
case "callback":
this.Callback = reader.Value;
continue;
case "pending":
this.IsPending = reader.Value == "1";
continue;
case "date_create":
this.DateCreated = UtilityMethods.UnixTimestampToDate(reader.Value);
continue;
case "lease_seconds":
this.LeaseSeconds = reader.ReadContentAsInt();
continue;
case "expiry":
this.Expiry = UtilityMethods.UnixTimestampToDate(reader.Value);
continue;
case "verify_attempts":
this.VerifyAttempts = reader.ReadContentAsInt();
continue;
default:
continue;
}
}
reader.Read();
}
示例4: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "usage":
this.Usage = reader.ReadContentAsInt();
continue;
case "predicate":
this.PredicateName = reader.Value;
continue;
case "namespace":
this.NamespaceName = reader.Value;
continue;
case "first_added":
this.DateFirstAdded = new DateTime?(UtilityMethods.UnixTimestampToDate(reader.Value));
continue;
case "last_added":
this.DateLastUsed = new DateTime?(UtilityMethods.UnixTimestampToDate(reader.Value));
continue;
default:
continue;
}
}
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
this.ValueText = reader.ReadContentAsString();
reader.Read();
}
示例5: while
void IFlickrParsable.Load(XmlReader reader)
{
if (reader.LocalName != "place_type")
UtilityMethods.CheckParsingException(reader);
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "place_type_id":
case "id":
Id = reader.ReadContentAsInt();
break;
default:
UtilityMethods.CheckParsingException(reader);
break;
}
}
reader.Read();
Name = reader.ReadContentAsString();
reader.Skip();
}
示例6: readInt
public static int readInt(XmlReader reader, string nodeName)
{
reader.ReadStartElement(nodeName);
int i = reader.ReadContentAsInt();
reader.ReadEndElement();
return i;
}
示例7: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "id":
this.LicenseId = (LicenseType) reader.ReadContentAsInt();
continue;
case "name":
this.LicenseName = reader.Value;
continue;
case "url":
if (!string.IsNullOrEmpty(reader.Value))
{
this.LicenseUrl = reader.Value;
continue;
}
else
continue;
default:
continue;
}
}
reader.Read();
}
示例8: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "usage":
Usage = reader.ReadContentAsInt();
break;
case "predicate":
PredicateName = reader.Value;
break;
case "namespace":
NamespaceName = reader.Value;
break;
case "first_added":
DateFirstAdded = UtilityMethods.UnixTimestampToDate(reader.Value);
break;
case "last_added":
DateLastUsed = UtilityMethods.UnixTimestampToDate(reader.Value);
break;
}
}
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
ValueText = reader.ReadContentAsString();
reader.Read();
}
示例9: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "usage":
Usage = reader.ReadContentAsInt();
break;
case "predicate":
PredicateName = reader.Value;
break;
case "namespace":
NamespaceName = reader.Value;
break;
}
}
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
PairName = reader.ReadContentAsString();
reader.Read();
}
示例10: DeserializeSpecVersion
//public static string HostAddress
//{
// get
// {
// foreach (IPAddress address in Dns.GetHostAddresses (Dns.GetHostName ())) {
// if (address.AddressFamily == AddressFamily.InterNetwork) {
// return address;
// }
// }
// }
//}
public static Version DeserializeSpecVersion(XmlReader reader)
{
try {
// We assume the elements appear in this order
reader.ReadToFollowing ("major");
reader.Read ();
var major = reader.ReadContentAsInt ();
reader.ReadToFollowing ("minor");
reader.Read ();
var minor = reader.ReadContentAsInt ();
return new Version (major, minor);
} catch (Exception e) {
throw new UpnpDeserializationException ("There was a problem deserializing a spec version.", e);
} finally {
reader.Close ();
}
}
示例11: FromXml
public void FromXml(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
if (reader.Name == "Width")
Width = reader.ReadContentAsInt();
else if (reader.Name == "Height")
Height = reader.ReadContentAsInt();
else if (reader.Name == "Name")
Name = reader.ReadContentAsString();
else if (reader.Name == "PositionNaming")
{
var index = reader.ReadContentAsInt();
if (index < PositionNamings.Defined.Length) PositionNaming = PositionNamings.Defined[index];
}
}
reader.MoveToElement();
}
示例12: ResponseXmlException
void IFlickrParsable.Load(XmlReader reader)
{
if (reader == null) throw new ArgumentNullException("reader");
if (!reader.ReadToFollowing("photos"))
throw new ResponseXmlException("Unable to find \"photos\" element in response.");
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "maxdisplaypx":
MaximumDisplayPixels = reader.ReadContentAsInt();
break;
case "maxupload":
MaximumPhotoUpload = reader.ReadContentAsLong();
break;
default:
UtilityMethods.CheckParsingException(reader);
break;
}
}
if (!reader.ReadToFollowing("videos"))
throw new ResponseXmlException("Unable to find \"videos\" element in response.");
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "maxduration":
MaximumVideoDuration = reader.ReadContentAsInt();
break;
case "maxupload":
MaximumVideoUpload = reader.ReadContentAsLong();
break;
default:
UtilityMethods.CheckParsingException(reader);
break;
}
}
reader.Skip();
}
示例13: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "count":
this.Count = reader.ReadContentAsInt();
continue;
case "mode":
this.Mode = GroupThrottleInfo.ParseMode(reader.Value);
continue;
case "remaining":
this.Remaining = reader.ReadContentAsInt();
continue;
default:
continue;
}
}
reader.Read();
}
示例14: while
void IFlickrParsable.Load(XmlReader reader)
{
while (reader.MoveToNextAttribute())
{
switch (reader.LocalName)
{
case "usage":
this.Usage = reader.ReadContentAsInt();
continue;
case "predicates":
this.Predicates = reader.ReadContentAsInt();
continue;
default:
continue;
}
}
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
this.NamespaceName = reader.ReadContentAsString();
reader.Read();
}
示例15: load
public static Firewall load(XmlReader reader)
{
while (reader.Name != "firewall")
reader.Read();
var complexity = 0;
string solution = null;
var additionalTime = 0.0f;
if (reader.MoveToAttribute("complexity"))
complexity = reader.ReadContentAsInt();
if (reader.MoveToAttribute("solution"))
solution = reader.ReadContentAsString();
if (reader.MoveToAttribute("additionalDelay"))
additionalTime = reader.ReadContentAsFloat();
return new Firewall(complexity, solution, additionalTime);
}