void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "shapes") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "page": Page = reader.ReadContentAsInt(); break; case "total": Total = reader.ReadContentAsInt(); break; case "pages": Pages = reader.ReadContentAsInt(); break; case "per_page": case "perpage": PerPage = reader.ReadContentAsInt(); break; case "woe_id": WoeId = reader.Value; break; case "place_id": PlaceId = reader.Value; break; case "place_type_id": PlaceType = (PlaceType)reader.ReadContentAsInt(); break; case "place_type": break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.LocalName == "shape") { var item = new ShapeData(); ((ITwentyThreeParsable)item).Load(reader); Add(item); } reader.Skip(); }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "usage": Usage = reader.ReadContentAsInt(); break; case "predicates": Predicates = reader.ReadContentAsInt(); break; } } reader.Read(); if (reader.NodeType == System.Xml.XmlNodeType.Text) { NamespaceName = reader.ReadContentAsString(); } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "nsid": case "id": GroupId = reader.Value; break; case "name": GroupName = reader.Value; break; case "admin": IsAdmin = reader.Value == "1"; break; case "privacy": Privacy = (PoolPrivacy)Enum.Parse(typeof(PoolPrivacy), reader.Value, true); break; case "iconserver": IconServer = reader.Value; break; case "iconfarm": IconFarm = reader.Value; break; case "photos": case "pool_count": Photos = long.Parse(reader.Value, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "member": IsMember = reader.Value == "1"; break; case "moderator": IsModerator = reader.Value == "1"; break; case "member_count": MemberCount = reader.ReadContentAsInt(); break; case "topic_count": TopicCount = reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": case "nsid": UserId = reader.Value; break; case "iconserver": IconServer = reader.Value; break; case "iconfarm": IconFarm = reader.Value; break; case "username": UserName = reader.Value; break; case "realname": RealName = reader.Value; break; case "added_by": AddedByUserId = reader.Value; break; case "path_alias": PathAlias = reader.Value; break; case "x": PositionX = reader.ReadContentAsInt(); break; case "y": PositionY = reader.ReadContentAsInt(); break; case "w": PositionWidth = reader.ReadContentAsInt(); break; case "h": PositionHeight = reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "ready": Ready = reader.Value == "1"; break; case "failed": Failed = reader.Value == "1"; break; case "pending": Pending = reader.Value == "1"; break; case "duration": if (String.IsNullOrEmpty(reader.Value)) { Duration = -1; } else { Duration = reader.ReadContentAsInt(); } break; case "width": if (String.IsNullOrEmpty(reader.Value)) { Width = -1; } else { Width = reader.ReadContentAsInt(); } break; case "height": if (String.IsNullOrEmpty(reader.Value)) { Height = -1; } else { Height = reader.ReadContentAsInt(); } break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { Load(reader, false); if (reader.LocalName == "photo") { return; } if (reader.LocalName != "stats") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "views": StatViews = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "comments": StatComments = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "favorites": StatFavorites = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "total_views": TotalViews = reader.ReadContentAsInt(); break; case "total_comments": TotalComments = reader.ReadContentAsInt(); break; case "total_favorites": TotalFavorites = reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); if (reader.LocalName == "description") { Description = reader.ReadElementContentAsString(); } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.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(); }
public void ReadXml(System.Xml.XmlReader reader) { XmlSerializer serializer; if (!reader.Read()) { return; } reader.ReadStartElement("type"); _type = (VariantType)reader.ReadContentAsInt(); reader.ReadEndElement(); reader.ReadStartElement("value"); switch (_type) { case VariantType.Int: _valueInt = reader.ReadContentAsInt(); break; case VariantType.Long: _valueLong = reader.ReadContentAsLong(); break; case VariantType.ULong: _valueULong = (ulong)reader.ReadContentAsLong(); break; case VariantType.Double: _valueDouble = (double)reader.ReadContentAsDouble(); break; case VariantType.String: _valueString = reader.ReadContentAsString(); break; case VariantType.ByteString: serializer = new XmlSerializer(typeof(byte[])); _valueByteArray = (byte[])serializer.Deserialize(reader); break; case VariantType.BitStream: serializer = new XmlSerializer(typeof(BitwiseStream)); _valueBitStream = (BitwiseStream)serializer.Deserialize(reader); break; } reader.ReadEndElement(); }
public override void ReadXml(System.Xml.XmlReader reader) { reader.MoveToContent(); reader.ReadStartElement(); reader.ReadStartElement("MyHPBarID"); this.MyHPBarID = (uint)reader.ReadContentAsInt(); reader.ReadEndElement(); reader.ReadStartElement("MyHPBarOutlineID"); this.MyHPBarOutlineID = (uint)reader.ReadContentAsInt(); reader.ReadEndElement(); base.ReadXml(reader); reader.ReadEndElement(); }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": LicenseId = (LicenseType)reader.ReadContentAsInt(); break; case "name": LicenseName = reader.Value; break; case "url": if (!string.IsNullOrEmpty(reader.Value)) { LicenseUrl = reader.Value; } break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": TicketId = reader.Value; break; case "invalid": InvalidTicketId = true; break; case "photoid": PhotoId = reader.Value; break; case "complete": CompleteStatus = reader.ReadContentAsInt(); break; } } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "source": SourceTag = reader.Value; break; case "total": TotalClusters = reader.ReadContentAsInt(); break; } } reader.Read(); while (reader.LocalName == "cluster") { var item = new Cluster(); ((IFlickrParsable)item).Load(reader); item.SourceTag = SourceTag; Add(item); } reader.Skip(); }
void ITwentyThreeParsable.Load(System.Xml.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(); }
public void ReadXml(System.Xml.XmlReader reader) { reader.Read(); reader.ReadStartElement("Value"); Value = reader.ReadContentAsInt(); reader.ReadEndElement(); }
/// <summary> /// Lê um xml e deserializa o objeto /// </summary> /// <param name="reader">objeto leitor</param> void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("DefinitionUid")) { DefinitionUid = reader.ReadContentAsInt(); } if (reader.MoveToAttribute("Name")) { Name = reader.ReadContentAsString(); } if (reader.MoveToAttribute("Description")) { Description = reader.ReadContentAsString(); } if (reader.MoveToAttribute("Type") && reader.HasValue) { TypeDefinition = Type.GetType(reader.ReadContentAsString(), true); } reader.MoveToElement(); if (!reader.IsEmptyElement) { this.Value = reader.ReadElementContentAs(TypeDefinition, null); } else { reader.Skip(); } }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "period": Period = reader.Value; break; case "count": TagCount = reader.ReadContentAsInt(); break; } } reader.Read(); while (reader.LocalName == "tag") { var item = new HotTag(); ((ITwentyThreeParsable)item).Load(reader); Add(item); } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.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 == System.Xml.XmlNodeType.Text) { PairName = reader.ReadContentAsString(); } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "photosets") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "cancreate": CanCreate = reader.Value == "1"; break; case "page": Page = reader.ReadContentAsInt(); break; case "perpage": PerPage = reader.ReadContentAsInt(); break; case "pages": Pages = reader.ReadContentAsInt(); break; case "total": Total = reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.LocalName == "photoset") { Photoset photoset = new Photoset(); ((IFlickrParsable)photoset).Load(reader); Add(photoset); } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "subscription") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "topic": Topic = reader.Value; break; case "callback": Callback = reader.Value; break; case "pending": IsPending = reader.Value == "1"; break; case "date_create": DateCreated = UtilityMethods.UnixTimestampToDate(reader.Value); break; case "lease_seconds": LeaseSeconds = reader.ReadContentAsInt(); break; case "expiry": Expiry = UtilityMethods.UnixTimestampToDate(reader.Value); break; case "verify_attempts": VerifyAttempts = reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Uid")) { Uid = reader.ReadContentAsInt(); } reader.Skip(); }
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("Name")) { Name = reader.ReadContentAsString(); } if (reader.MoveToAttribute("Direction")) { Direction = (Colosoft.Query.ParameterDirection)reader.ReadContentAsInt(); } if (reader.MoveToAttribute("Size")) { Size = reader.ReadContentAsInt(); } Type type = null; if (reader.MoveToAttribute("Type")) { var typeString = reader.ReadContentAsString(); if (!string.IsNullOrEmpty(typeString)) { type = Type.GetType(typeString, true); } } reader.MoveToElement(); if (!reader.IsEmptyElement) { if (type == typeof(byte[])) { var content = (string)reader.ReadElementContentAs(typeof(string), null); Value = Convert.FromBase64String(content); } else if (type != null) { Value = reader.ReadElementContentAs(type, null); } else { Value = null; } } else { reader.Skip(); } }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "groups") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "per_page": PerPage = reader.ReadContentAsInt(); break; case "page": Page = reader.ReadContentAsInt(); break; case "pages": Pages = reader.ReadContentAsInt(); break; case "total": Total = reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.LocalName == "group") { var member = new MemberGroupInfo(); ((IFlickrParsable)member).Load(reader); Add(member); } reader.Skip(); }
public override void ReadXml(System.Xml.XmlReader reader) { reader.ReadStartElement(); reader.ReadStartElement("TrashCount"); this.TrashCount = reader.ReadContentAsInt(); reader.ReadEndElement(); base.ReadXml(reader); reader.ReadEndElement(); }
public override void ReadXml(System.Xml.XmlReader reader) { reader.ReadStartElement(); reader.ReadStartElement("MyMutantID"); this.MyMutantID = (uint)reader.ReadContentAsInt(); reader.ReadEndElement(); base.ReadXml(reader); reader.ReadEndElement(); }
private void LoadAttributes(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": PhotoId = reader.Value; break; case "secret": Secret = reader.Value; break; case "server": Server = reader.Value; break; case "farm": Farm = reader.Value; break; case "originalformat": OriginalFormat = reader.Value; break; case "originalsecret": OriginalSecret = reader.Value; break; case "dateuploaded": DateUploaded = UtilityMethods.UnixTimestampToDate(reader.Value); break; case "isfavorite": IsFavorite = reader.Value == "1"; break; case "license": License = (LicenseType)int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "views": ViewCount = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "rotation": Rotation = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "media": Media = reader.Value == "photo" ? MediaType.Photos : MediaType.Videos; break; case "safety_level": SafetyLevel = (SafetyLevel)reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } if (reader.LocalName != "suggestions") { UtilityMethods.CheckParsingException(reader); return; } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "total": Total = reader.ReadContentAsInt(); break; case "page": Page = reader.ReadContentAsInt(); break; case "per_page": PerPage = reader.ReadContentAsInt(); break; } } reader.Read(); while (reader.LocalName == "suggestion") { var suggestion = new Suggestion(); ((IFlickrParsable)suggestion).Load(reader); Add(suggestion); } return; }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "label": Label = reader.Value; break; case "width": Width = reader.ReadContentAsInt(); break; case "height": Height = reader.ReadContentAsInt(); break; case "source": Source = reader.Value; break; case "url": Url = reader.Value; break; case "media": MediaType = reader.Value == "photo" ? MediaType.Photos : MediaType.Videos; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
public static DateTimeOffset ReadDateTimeOffset(this System.Xml.XmlReader a) { a.ReadStartElement(); a.ReadStartElement("DateTime"); var b = a.ReadContentAsDateTime(); a.ReadEndElement(); a.ReadStartElement("OffsetMinutes"); var c = (short)a.ReadContentAsInt(); a.ReadEndElement(); a.ReadEndElement(); return(new DateTimeOffset(b, TimeSpan.FromMinutes(c))); }
public static DateTimeOffset ReadDateTimeOffset(this System.Xml.XmlReader reader) { reader.ReadStartElement(); reader.ReadStartElement("DateTime"); var dateTime = reader.ReadContentAsDateTime(); reader.ReadEndElement(); reader.ReadStartElement("OffsetMinutes"); var offsetMinutes = (short)reader.ReadContentAsInt(); reader.ReadEndElement(); reader.ReadEndElement(); return(new DateTimeOffset(dateTime, TimeSpan.FromMinutes(offsetMinutes))); }
/// <summary> /// Function to call when deserializing this object from XML /// </summary> /// <param name="reader">The xml reader</param> public virtual void ReadXml(System.Xml.XmlReader reader) { #region read the size of the matrix and assign storage reader.MoveToAttribute("Rows"); int rows = reader.ReadContentAsInt(); reader.MoveToAttribute("Cols"); int cols = reader.ReadContentAsInt(); reader.MoveToAttribute("NumberOfChannels"); int numberOfChannels = reader.ReadContentAsInt(); AllocateData(rows, cols, numberOfChannels); #endregion reader.MoveToAttribute("CompressionRatio"); SerializationCompressionRatio = reader.ReadContentAsInt(); #region decode the data from Xml and assign the value to the matrix reader.MoveToContent(); reader.ReadToFollowing("Bytes"); int size = _sizeOfElement * ManagedArray.Length; if (SerializationCompressionRatio == 0) { Byte[] bytes = new Byte[size]; reader.ReadElementContentAsBase64(bytes, 0, bytes.Length); Bytes = bytes; } else { int extraHeaderBytes = 20000; Byte[] bytes = new Byte[size + extraHeaderBytes]; int countOfBytesRead = reader.ReadElementContentAsBase64(bytes, 0, bytes.Length); Array.Resize <Byte>(ref bytes, countOfBytesRead); Bytes = bytes; } //reader.MoveToElement(); #endregion }