// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the content of the RssMediaEmbed object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.MEDIA_NS); if (url.Length > 0) { xUtil.AddAttr(parEl, ATTR_URL, url); } if (width >= 0) { xUtil.AddAttr(parEl, ATTR_WIDTH, width.ToString()); } if (height > 0) { xUtil.AddAttr(parEl, ATTR_HEIGHT, height.ToString()); } for (int i = 0; i < lstParams.Count; i++) { XElement el = xUtil.AddNsEl(parEl, RSS.MEDIA_NS, TAG_PARAM, lstParams[i].Value); xUtil.AddAttr(el, ATTR_NAME, lstParams[i].Key); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RssMediaPrice object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.MEDIA_NS); if (type.Length > 0) { xUtil.AddAttr(parEl, ATTR_TYPE, type); } if (info.Length > 0) { xUtil.AddAttr(parEl, ATTR_INFO, info); } if (price >= 0M) { xUtil.AddAttr(parEl, ATTR_PRICE, price.ToString("0.00")); } if (currency.Length > 0) { xUtil.AddAttr(parEl, ATTR_CURRENCY, currency); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets RssMediaLocation object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.MEDIA_NS); if (description.Length > 0) { xUtil.AddAttr(parEl, ATTR_DESCRIPTION, description); } if (start > TimeSpan.MinValue) { xUtil.AddAttr(parEl, ATTR_START, start.ToString("hh\\:mm\\:ss")); } if (end > TimeSpan.MinValue) { xUtil.AddAttr(parEl, ATTR_END, end.ToString("hh\\:mm\\:ss")); } XElement whereEl = xUtil.AddNsEl(parEl, RSS.GEORSS_NS, TAG_WHERE); XElement pointEl = xUtil.AddNsEl(whereEl, RSS.GML_NS, TAG_POINT); string latlong = latitude.ToString("0.0000") + " " + longitude.ToString("0.0000"); XElement posEl = xUtil.AddNsEl(pointEl, RSS.GML_NS, TAG_POS, latlong); return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RssMediaText object's properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, text, RSS.MEDIA_NS); if (type.Length > 0) { xUtil.AddAttr(parEl, ATTR_TYPE, type); } if (lang.Length > 0) { xUtil.AddAttr(parEl, ATTR_LANG, lang); } if (start > TimeSpan.MinValue) { xUtil.AddAttr(parEl, ATTR_START, start.ToString("hh\\:mm\\:ss\\.fff")); } if (end > TimeSpan.MinValue) { xUtil.AddAttr(parEl, ATTR_END, end.ToString("hh\\:mm\\:ss\\.fff")); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the channel as an XElement (root element) /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { // create root element rss. Note, it is NOT in a namespace. XElement parEl = xUtil.CreateEl(TAG_ROOT); // add the version attribute xUtil.AddAttr(parEl, ATTR_VERSION, RSS_VERSION); // add the default namespace attributes for (int i = 0; i < NamespaceAttributes.Count; i++) { // now add the media namespace attributes XAttribute attr = new XAttribute(XNamespace.Xmlns + NamespaceAttributes[i].Prefix, NamespaceAttributes[i].Url); xUtil.AddAttr(parEl, attr); } // get the document. XElement channelEl = channel.GetEl(); parEl.Add(channelEl); // return return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RssMediaRestriction object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, restriction, RSS.MEDIA_NS); xUtil.AddAttr(parEl, ATTR_RELATIONSHIP, relationship); if (type.Length > 0) { xUtil.AddAttr(parEl, ATTR_TYPE, type); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the properties of the RssMediaCategory object as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, category, RSS.MEDIA_NS); if (scheme.Length > 0) { xUtil.AddAttr(parEl, ATTR_SCHEME, scheme); } if (label.Length > 0) { xUtil.AddAttr(parEl, ATTR_LABEL, label); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RsMediaCredit object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, credit, RSS.MEDIA_NS); if (role.Length > 0) { xUtil.AddAttr(parEl, ATTR_ROLE, role); } if (scheme.Length > 0) { xUtil.AddAttr(parEl, ATTR_SCHEME, scheme); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// gets the RssMediaLicense object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, license, RSS.MEDIA_NS); if (type.Length > 0) { xUtil.AddAttr(parEl, ATTR_TYPE, type); } if (href.Length > 0) { xUtil.AddAttr(parEl, ATTR_HREF, href); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RssMediaStatus object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.MEDIA_NS); if (state.Length > 0) { xUtil.AddAttr(parEl, ATTR_STATE, state); } if (reason.Length > 0) { xUtil.AddAttr(parEl, ATTR_REASON, reason); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RssMediaPlayer object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.MEDIA_NS); xUtil.AddAttr(parEl, ATTR_URL, url); if (width > 0) { xUtil.AddAttr(parEl, ATTR_WIDTH, width.ToString()); } if (height > 0) { xUtil.AddAttr(parEl, ATTR_HEIGHT, height.ToString()); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RssMediaDescription object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, description, RSS.MEDIA_NS); if (type.Length > 0) { xUtil.AddAttr(parEl, ATTR_TYPE, type); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RssMediaCopyright object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, copyright, RSS.MEDIA_NS); if (url.Length > 0) { xUtil.AddAttr(parEl, ATTR_URL, url); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the properties of the RssMediaHash object as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, hash, RSS.MEDIA_NS); if (algo.Length > 0) { xUtil.AddAttr(parEl, ATTR_ALGO, algo); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// gets the RssMediaRights object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.MEDIA_NS); if (status.Length > 0) { xUtil.AddAttr(parEl, ATTR_STATUS, status); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RssAtomLink object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.ATOM_NS); xUtil.AddAttr(parEl, ATTR_HREF, href); if (rel.Length > 0) { xUtil.AddAttr(parEl, ATTR_REL, rel); } if (type.Length > 0) { xUtil.AddAttr(parEl, ATTR_TYPE, type); } if (hreflang.Length > 0) { xUtil.AddAttr(parEl, ATTR_HREFLANG, hreflang); } if (title.Length > 0) { xUtil.AddAttr(parEl, ATTR_TITLE, title); } if (length > 0) { xUtil.AddAttr(parEl, ATTR_LENGTH, length); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the Rss Channel as an XElement /// </summary> /// <returns>XElement (root node)</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = new XElement(TAG_ROOT); xUtil.AddAttr(parEl, ATTR_VERSION, RSS_VERSION); if (channel != null) { XElement channelEl = channel.GetEl(); parEl.Add(channelEl); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the properties of the RssMediaThumbnail object as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.MEDIA_NS); xUtil.AddAttr(parEl, ATTR_URL, url); if (width > 0) { xUtil.AddAttr(parEl, ATTR_WIDTH, width.ToString()); } if (height > 0) { xUtil.AddAttr(parEl, ATTR_HEIGHT, height.ToString()); } if (time > TimeSpan.MinValue) { string time_string = time.ToString("hh\\:mm\\:ss\\.fff"); xUtil.AddAttr(parEl, ATTR_TIME, time_string); } return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the RssMediaCommunity object properties as an XElement /// </summary> /// <returns>XElement</returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.MEDIA_NS); XElement el = xUtil.CreateNSEl(TAG_STARRATING, RSS.MEDIA_NS); if (starRatingAverage >= 0) { xUtil.AddAttr(el, ATTR_STARRATING_AVERAGE, starRatingAverage.ToString("0.00")); } if (starRatingCount >= 0) { xUtil.AddAttr(el, ATTR_STARRATING_COUNT, starRatingCount.ToString()); } if (starRatingMin >= 0) { xUtil.AddAttr(el, ATTR_STARRATING_MIN, starRatingMin.ToString()); } if (starRatingMax >= 0) { xUtil.AddAttr(el, ATTR_STARRATING_MAX, starRatingMax); } parEl.Add(el); el = xUtil.CreateNSEl(TAG_STATISTICS, RSS.MEDIA_NS); if (statisticsViews >= 0) { xUtil.AddAttr(el, ATTR_STATISTICS_VIEWS, statisticsViews); } if (statisticsFavorites >= 0) { xUtil.AddAttr(el, ATTR_STATISTICS_FAVORITES, statisticsFavorites); } parEl.Add(el); el = xUtil.CreateNSEl(TAG_TAGS, Concatenate(), RSS.MEDIA_NS); parEl.Add(el); return(parEl); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Gets the Media Content Properties as an XElement /// </summary> /// <returns></returns> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public XElement GetEl() { XElement parEl = xUtil.CreateNSEl(TAG_PARENT, RSS.MEDIA_NS); if (url.Length > 0) { xUtil.AddAttr(parEl, ATTR_URL, url); } if (fileSize > 0) { xUtil.AddAttr(parEl, ATTR_FILESIZE, fileSize.ToString()); } if (type.Length > 0) { xUtil.AddAttr(parEl, ATTR_TYPE, type); } if (medium.Length > 0) { xUtil.AddAttr(parEl, ATTR_MEDIUM, medium); } if (isDefault) { xUtil.AddAttr(parEl, ATTR_ISDEFAULT, "true"); } if (expression.Length > 0) { xUtil.AddAttr(parEl, ATTR_EXPRESSION, expression); } if (bitrate > 0) { xUtil.AddAttr(parEl, ATTR_BITRATE, bitrate.ToString()); } if (samplingrate > 0.0) { xUtil.AddAttr(parEl, ATTR_SAMPLINGRATE, samplingrate.ToString("0.0")); } if (channels > 0) { xUtil.AddAttr(parEl, ATTR_CHANNELS, channels); } if (duration > 0) { xUtil.AddAttr(parEl, ATTR_DURATION, duration.ToString()); } if (height > 0) { xUtil.AddAttr(parEl, ATTR_HEIGHT, height); } if (width > 0) { xUtil.AddAttr(parEl, ATTR_WIDTH, width); } if (lang.Length > 0) { xUtil.AddAttr(parEl, ATTR_LANG, lang); } mediaOptions.Parent = this; mediaOptions.SetEl(parEl); return(parEl); }