Exemplo n.º 1
0
        public String getFeed(RPCConstants.Channel channelId)
        {
            Channel channel = channelDAO.FindChannel(channelId);

            MemoryStream ms = new MemoryStream();
            XmlTextWriter w = new XmlTextWriter(ms, System.Text.Encoding.UTF8);
            w.Formatting = Formatting.Indented;

            w.WriteStartDocument();
            w.WriteStartElement("rss");
            //w.WriteAttributeString("xmlns", "itunes", null, itunesXmlns);
            w.WriteAttributeString("version", "2.0");

            w.WriteStartElement("channel");
            channel.toRSSXml(w);

            IList<Item> items = itemDAO.FindItemsRSS(channelId);

            foreach (Item item in items)
            {
                item.toRSSXML(w);
            }

            w.WriteEndElement(); //channel

            w.WriteEndElement(); //rss
            w.WriteEndDocument();
            w.Flush();

            ms.Position = 0;

            StreamReader sr = new StreamReader(ms);

            return sr.ReadToEnd();
        }
Exemplo n.º 2
0
        public String getFeed(RPCConstants.Channel channelId)
        {
            Channel channel = channelDAO.FindChannel(channelId);

            MemoryStream ms = new MemoryStream();
            XmlTextWriter w = new XmlTextWriter(ms, System.Text.Encoding.UTF8);
            w.Formatting = Formatting.Indented;

            w.WriteStartDocument();
            w.WriteStartElement("rss");
            w.WriteAttributeString("xmlns", "itunes", null, itunesXmlns);
            w.WriteAttributeString("version", "2.0");

            w.WriteStartElement("channel");
            channel.toItunesXml(w);

            /*IList items = itemDAO.findItemsPodcast(channelId);

            foreach (Item item in items)
            {
                item.toItunesXML(w);
            }*/

            IList<BlogEntry> items = BlogManager.GetSermonPosts();
            foreach (BlogEntry item in items)
            {
                if (!item.Scheduled)
                    WriteItunesXML(item, w);
            }

            w.WriteEndElement(); //channel

            w.WriteEndElement(); //rss
            w.WriteEndDocument();
            w.Flush();

            ms.Position = 0;

            StreamReader sr = new StreamReader(ms);

            return sr.ReadToEnd();
        }