private Link ParseLink(KeyValuePair<string, object> property) { var ret = new Link { Name = property.Key }; var dic = (Dictionary<string, object>)property.Value; if (dic.ContainsKey("__deferred")) { ret.Uri = ((Dictionary<string, object>)dic["__deferred"])["uri"].ToString(); } return ret; }
private static Link ParseLink(XElement rootElement) { var ret = new Link { Value = rootElement.Value }; var attri = rootElement.Attribute("title"); if (null != attri) { ret.Name = attri.Value; } attri = rootElement.Attribute("rel"); if (null != attri) { ret.Rel = attri.Value; } attri = rootElement.Attribute("href"); if (null != attri) { ret.Uri = attri.Value; } attri = rootElement.Attribute("type"); if (null != attri) { ret.Type = attri.Value; } var inline = rootElement.Elements(MetadataNS + "inline").SingleOrDefault(); if (null != inline && inline.HasElements) { if (ret.Type.Contains("type=feed")) { ret.InlineFeed = new AtomResult(inline.Elements(AtomNS + "feed").SingleOrDefault()); } else if (ret.Type.Contains("type=entry")) { ret.InlineEntry = ParseEntry(inline.Elements(AtomNS + "entry").SingleOrDefault()); } else { throw new InvalidOperationException("Unrecognized inline type: " + ret.Type); } } return ret; }