private void ParseFileSize(XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "maxbytes": case "max": FileSizeMax = reader.ReadContentAsLong(); break; case "maxkb": FileSizeMaxKB = reader.ReadContentAsLong(); break; case "maxmb": FileSizeMaxMB = reader.ReadContentAsLong(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
private void ParseSets(XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "created": if (!string.IsNullOrEmpty(reader.Value)) { SetsCreated = reader.ReadContentAsInt(); } break; case "remaining": if (!string.IsNullOrEmpty(reader.Value) && reader.Value != "lots") { SetsRemaining = reader.ReadContentAsInt(); } break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "photocount") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "count": Count = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "fromdate": FromDate = System.Text.RegularExpressions.Regex.IsMatch(reader.Value, "^\\d+$") ? UtilityMethods.UnixTimestampToDate(reader.Value) : UtilityMethods.MySqlToDate(reader.Value); break; case "todate": ToDate = System.Text.RegularExpressions.Regex.IsMatch(reader.Value, "^\\d+$") ? UtilityMethods.UnixTimestampToDate(reader.Value) : UtilityMethods.MySqlToDate(reader.Value); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void ITwentyThreeParsable.Load(XmlReader reader) { if (reader.LocalName != "set") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": SetId = reader.Value; break; case "title": Title = reader.Value; break; case "description": Description = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Skip(); }
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) { if (reader.LocalName != "url") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "type": UrlType = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); Url = reader.ReadContentAsString(); reader.Skip(); }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "count" && !reader.ReadToFollowing("count")) { UtilityMethods.CheckParsingException(reader); return; } Count = reader.ReadElementContentAsInt(); if (reader.LocalName != "prevphotos") { reader.ReadToFollowing("prevphotos"); } reader.ReadToDescendant("photo"); while (reader.LocalName == "photo") { var photo = new FavoriteContextPhoto(); ((ITwentyThreeParsable)photo).Load(reader); PreviousPhotos.Add(photo); } if (reader.LocalName != "nextphotos") { reader.ReadToFollowing("nextphotos"); } reader.ReadToDescendant("photo"); while (reader.LocalName == "photo") { var photo = new FavoriteContextPhoto(); ((ITwentyThreeParsable)photo).Load(reader); NextPhotos.Add(photo); } }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "stats") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "views": Views = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "comments": Comments = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "favorites": Favorites = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Skip(); }
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(XmlReader reader) { if (reader.LocalName != "error") { return; } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "code": Code = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "message": Message = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); if (reader.NodeType == XmlNodeType.Text) { Description = reader.ReadContentAsString(); reader.Read(); } }
private void ParseDates(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "posted": DatePosted = UtilityMethods.UnixTimestampToDate(reader.Value); break; case "taken": DateTaken = UtilityMethods.ParseDateWithGranularity(reader.Value); break; case "takengranularity": DateTakenGranularity = (DateGranularity)int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "lastupdate": DateLastUpdated = UtilityMethods.UnixTimestampToDate(reader.Value); break; case "takenunknown": DateTakenUnknown = reader.Value == "1"; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void ITwentyThreeParsable.Load(XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "clean": CleanTag = reader.ReadContentAsString(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.LocalName == "raw") { RawTags.Add(reader.ReadElementContentAsString()); } reader.Read(); }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { reader.Read(); while (reader.LocalName != "photos") { switch (reader.LocalName) { case "firstdatetaken": FirstTakenDate = UtilityMethods.ParseDateWithGranularity(reader.ReadElementContentAsString()); break; case "firstdate": FirstDate = UtilityMethods.UnixTimestampToDate(reader.ReadElementContentAsString()); break; case "count": PhotoCount = reader.ReadElementContentAsInt(); break; case "views": Views = reader.ReadElementContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); reader.Skip(); break; } } reader.Read(); }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "category") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": SubcategoryId = reader.Value; break; case "name": SubcategoryName = reader.Value; break; case "count": GroupCount = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
private void LoadElements(XmlReader reader) { while (reader.LocalName != "item") { switch (reader.LocalName) { case "title": Title = reader.ReadElementContentAsString(); break; case "activity": reader.ReadToDescendant("event"); while (reader.LocalName == "event") { var e = new ActivityEvent(); ((ITwentyThreeParsable)e).Load(reader); Events.Add(e); } reader.Read(); break; default: UtilityMethods.CheckParsingException(reader); reader.Skip(); break; } } reader.Read(); }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { reader.Read(); while (reader.LocalName != "auth") { switch (reader.LocalName) { case "token": Token = reader.ReadElementContentAsString(); break; case "perms": Permissions = (AuthLevel)Enum.Parse(typeof(AuthLevel), reader.ReadElementContentAsString(), true); break; case "user": User = new FoundUser(); ((ITwentyThreeParsable)User).Load(reader); break; default: UtilityMethods.CheckParsingException(reader); reader.Skip(); break; } } }
private void ParseVisibility(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "isfamily": IsFamily = reader.Value == "1"; break; case "ispublic": IsPublic = reader.Value == "1"; break; case "isfriend": IsFriend = reader.Value == "1"; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void ITwentyThreeParsable.Load(XmlReader reader) { if (reader.LocalName != "argument") { return; } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "name": Name = reader.Value; break; case "optional": IsOptional = reader.Value == "1"; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); if (reader.NodeType == XmlNodeType.Text) { Description = reader.ReadContentAsString(); reader.Read(); } }
private void ParseUsage(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "canblog": CanBlog = reader.Value == "1"; break; case "candownload": CanDownload = reader.Value == "1"; break; case "canprint": CanPrint = reader.Value == "1"; break; case "canshare": CanShare = reader.Value == "1"; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void ITwentyThreeParsable.Load(XmlReader reader) { if (reader.LocalName != "brand") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": BrandId = reader.Value; break; case "name": BrandName = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Skip(); }
void ITwentyThreeParsable.Load(XmlReader reader) { if (reader.LocalName != "comments") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "photo_id": PhotoId = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.LocalName == "comment") { var comment = new PhotoComment(); ((ITwentyThreeParsable)comment).Load(reader); Add(comment); } reader.Skip(); }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "referrer") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "url": Url = reader.Value; break; case "searchterm": SearchTerm = reader.Value; break; case "views": Views = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; default: UtilityMethods.CheckParsingException(reader); break; } } 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(); }
void ITwentyThreeParsable.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 ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "nsid": InstitutionId = reader.Value; break; case "date_launch": DateLaunched = UtilityMethods.UnixTimestampToDate(reader.Value); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { switch (reader.LocalName) { case "name": InstitutionName = reader.ReadElementContentAsString(); break; case "urls": reader.Read(); while (reader.LocalName == "url") { string type = reader.GetAttribute("type"); string url = reader.ReadElementContentAsString(); switch (type) { case "site": SiteUrl = url; break; case "flickr": FlickrUrl = url; break; case "license": LicenseUrl = url; break; } } reader.Read(); break; } } reader.Read(); }
void ITwentyThreeParsable.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(); }
private void LoadElements(System.Xml.XmlReader reader) { while (reader.LocalName != "person") { switch (reader.LocalName) { case "username": UserName = reader.ReadElementContentAsString(); break; case "location": Location = reader.ReadElementContentAsString(); break; case "realname": RealName = reader.ReadElementContentAsString(); break; case "photosurl": PhotosUrl = reader.ReadElementContentAsString(); break; case "profileurl": ProfileUrl = reader.ReadElementContentAsString(); break; case "mobileurl": MobileUrl = reader.ReadElementContentAsString(); break; case "photos": PhotosSummary = new PersonPhotosSummary(); ((ITwentyThreeParsable)PhotosSummary).Load(reader); break; case "mbox_sha1sum": MailboxSha1Hash = reader.ReadElementContentAsString(); break; case "timezone": TimeZoneLabel = reader.GetAttribute("label"); TimeZoneOffset = reader.GetAttribute("offset"); reader.Read(); break; case "description": Description = reader.ReadElementContentAsString(); break; default: UtilityMethods.CheckParsingException(reader); reader.Skip(); break; } } }
void ITwentyThreeParsable.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(); }
void ITwentyThreeParsable.Load(XmlReader reader) { if (reader.LocalName != "group") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "nsid": GroupId = reader.Value; break; case "name": GroupName = reader.Value; break; case "eighteenplus": EighteenPlus = reader.Value == "1"; break; case "iconserver": IconServer = reader.Value; break; case "iconfarm": IconFarm = reader.Value; break; case "members": Members = reader.ReadContentAsInt(); break; case "pool_count": PoolCount = reader.ReadContentAsInt(); break; case "topic_count": TopicCount = reader.ReadContentAsInt(); break; case "privacy": Privacy = (PoolPrivacy)reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Skip(); }
private void LoadElements(XmlReader reader) { if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "photo") { return; } if (reader.NodeType == XmlNodeType.Element && reader.Name == "geoperms") { return; } while (reader.NodeType != XmlNodeType.EndElement) { switch (reader.LocalName) { case "neighbourhood": Neighbourhood = new Place(); ((ITwentyThreeParsable)Neighbourhood).Load(reader); break; case "locality": Locality = new Place(); ((ITwentyThreeParsable)Locality).Load(reader); break; case "county": County = new Place(); ((ITwentyThreeParsable)County).Load(reader); break; case "region": Region = new Place(); ((ITwentyThreeParsable)Region).Load(reader); break; case "country": Country = new Place(); ((ITwentyThreeParsable)Country).Load(reader); break; case "shapedata": ShapeData = new ShapeData(); ((ITwentyThreeParsable)ShapeData).Load(reader); break; default: UtilityMethods.CheckParsingException(reader); reader.Skip(); break; } } reader.Read(); }