public void GenerateRss(StringBuilder sb, SlideShowRssMediaType rssType, SlideShowImageSize targetImageSize, bool insertSizes, bool debug) { string url = this.url; int width = this.width; int height = this.height; if (this.urlSizeAware) { url = url.Replace("<SIZE>", "s=" + ((int)targetImageSize).ToString()); width = SlideShow.slideShowImageWidths[(int)targetImageSize]; height = SlideShow.slideShowImageHeights[(int)targetImageSize]; } if (insertSizes) { if (width == -1) { width = SlideShow.slideShowImageWidths[(int)targetImageSize]; } if (height == -1) { height = SlideShow.slideShowImageHeights[(int)targetImageSize]; } } string linkUrl = ""; if (rssType == SlideShowRssMediaType.LinkMedia) { linkUrl = url; } else { linkUrl = "http://" + Config.GetSetting("HostSite"); } sb.Append("<item>"); sb.Append("<title>" + HttpUtility.HtmlEncode(this.title) + "</title>"); sb.Append("<link>" + HttpUtility.HtmlEncode(linkUrl) + "</link>"); sb.Append("<category>" + HttpUtility.HtmlEncode(this.title) + "</category>"); // Write out the description sb.Append("<description>"); sb.Append("<![CDATA["); sb.Append("<img src=\"" + url + "\"><br/>" + HttpUtility.HtmlEncode(this.title)); if (debug) { sb.Append("<br/>"); sb.Append("Expiraton date " + this.ExpDate.ToString() + "<br/>"); sb.Append("<a href=\"" + url + "\">" + HttpUtility.HtmlEncode(url) + "</a><br/>"); } sb.Append("]]>"); sb.Append("</description>"); // Write out the publish date (if we have one) // Format of date in RSS feed: Tue, 22 Jan 2008 20:26:39 -05:00 if (this.PubDate != DateTime.MinValue) { sb.Append("<pubDate>" + TimeUtil.DateToRSSString(this.PubDate) + "</pubDate>"); } if (rssType != SlideShowRssMediaType.LinkMedia) { string widthText = ""; string heightText = ""; string tag = ""; string durationText = ""; if (rssType == SlideShowRssMediaType.EnclosureRss) { tag = "enclosure"; } else if (rssType == SlideShowRssMediaType.MediaRss) { tag = "media:content"; if (width != -1) { widthText = "width=\"" + width + "\" "; } if (height != -1) { heightText = "height=\"" + height + "\" "; } } sb.Append("<" + tag + " type=\"image/jpeg\" " + widthText + heightText + "url=\"" + HttpUtility.HtmlEncode(url) + "\" " + durationText + "/>"); } sb.Append("</item>"); }