public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable <CategoriesDocument> categories, IEnumerable <string> accepts)
 {
     this.extensions = new ExtensibleSyndicationObject();
     if (title == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("title");
     }
     if (link == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("link");
     }
     this.title = title;
     this.link  = link;
     if (categories != null)
     {
         this.categories = new NullNotAllowedCollection <CategoriesDocument>();
         foreach (CategoriesDocument document in categories)
         {
             this.categories.Add(document);
         }
     }
     if (accepts != null)
     {
         this.accepts = new NullNotAllowedCollection <string>();
         foreach (string str in accepts)
         {
             this.accepts.Add(str);
         }
     }
 }
Exemplo n.º 2
0
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable <CategoriesDocument> categories, IEnumerable <string> accepts)
 {
     if (title == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("title");
     }
     if (link == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("link");
     }
     _title = title;
     _link  = link;
     if (categories != null)
     {
         _categories = new NullNotAllowedCollection <CategoriesDocument>();
         foreach (CategoriesDocument category in categories)
         {
             _categories.Add(category);
         }
     }
     if (accepts != null)
     {
         _accepts = new NullNotAllowedCollection <string>();
         foreach (string accept in accepts)
         {
             _accepts.Add(accept);
         }
     }
 }
Exemplo n.º 3
0
 protected SyndicationItem(SyndicationItem source)
 {
     this.extensions = new ExtensibleSyndicationObject();
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     this.extensions      = source.extensions.Clone();
     this.authors         = FeedUtils.ClonePersons(source.authors);
     this.categories      = FeedUtils.CloneCategories(source.categories);
     this.content         = (source.content != null) ? source.content.Clone() : null;
     this.contributors    = FeedUtils.ClonePersons(source.contributors);
     this.copyright       = FeedUtils.CloneTextContent(source.copyright);
     this.id              = source.id;
     this.lastUpdatedTime = source.lastUpdatedTime;
     this.links           = FeedUtils.CloneLinks(source.links);
     this.publishDate     = source.publishDate;
     if (source.SourceFeed != null)
     {
         this.sourceFeed       = source.sourceFeed.Clone(false);
         this.sourceFeed.Items = new Collection <SyndicationItem>();
     }
     this.summary = FeedUtils.CloneTextContent(source.summary);
     this.baseUri = source.baseUri;
     this.title   = FeedUtils.CloneTextContent(source.title);
 }
Exemplo n.º 4
0
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable <CategoriesDocument> categories, IEnumerable <string> accepts)
 {
     if (title == null)
     {
         throw new ArgumentNullException(nameof(title));
     }
     if (link == null)
     {
         throw new ArgumentNullException(nameof(link));
     }
     _title = title;
     _link  = link;
     if (categories != null)
     {
         _categories = new NullNotAllowedCollection <CategoriesDocument>();
         foreach (CategoriesDocument category in categories)
         {
             _categories.Add(category);
         }
     }
     if (accepts != null)
     {
         _accepts = new NullNotAllowedCollection <string>();
         foreach (string accept in accepts)
         {
             _accepts.Add(accept);
         }
     }
 }
Exemplo n.º 5
0
 public SyndicationFeed(string title, string description,
                        Uri feedAlternateLink) : this()
 {
     this.title       = new TextSyndicationContent(title);
     this.description = new TextSyndicationContent(description);
     links.Add(SyndicationLink.CreateAlternateLink(feedAlternateLink));
 }
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable<CategoriesDocument> categories, IEnumerable<string> accepts)
 {
     this.extensions = new ExtensibleSyndicationObject();
     if (title == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("title");
     }
     if (link == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("link");
     }
     this.title = title;
     this.link = link;
     if (categories != null)
     {
         this.categories = new NullNotAllowedCollection<CategoriesDocument>();
         foreach (CategoriesDocument document in categories)
         {
             this.categories.Add(document);
         }
     }
     if (accepts != null)
     {
         this.accepts = new NullNotAllowedCollection<string>();
         foreach (string str in accepts)
         {
             this.accepts.Add(str);
         }
     }
 }
Exemplo n.º 7
0
		protected TextSyndicationContent (TextSyndicationContent source)
		{
			if (source == null)
				throw new ArgumentNullException ("source");
			text = source.text;
			kind = source.kind;
		}
Exemplo n.º 8
0
 protected SyndicationItem(SyndicationItem source)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(source));
     }
     _extensions      = source._extensions.Clone();
     _authors         = FeedUtils.ClonePersons(source._authors);
     _categories      = FeedUtils.CloneCategories(source._categories);
     _content         = (source._content != null) ? source._content.Clone() : null;
     _contributors    = FeedUtils.ClonePersons(source._contributors);
     _copyright       = FeedUtils.CloneTextContent(source._copyright);
     _id              = source._id;
     _lastUpdatedTime = source._lastUpdatedTime;
     _links           = FeedUtils.CloneLinks(source._links);
     _publishDate     = source._publishDate;
     if (source.SourceFeed != null)
     {
         _sourceFeed       = source._sourceFeed.Clone(false);
         _sourceFeed.Items = new Collection <SyndicationItem>();
     }
     _summary = FeedUtils.CloneTextContent(source._summary);
     _baseUri = source._baseUri;
     _title   = FeedUtils.CloneTextContent(source._title);
 }
Exemplo n.º 9
0
        public SyndicationFeedFormatter CreateFeed()
        {
            string serverUrl = ConfigurationManager.AppSettings["CatMyVideoUrl"];
            // Create a new Syndication Feed.
            SyndicationFeed feed = new SyndicationFeed();

            feed.Id = "#CatMyVideo URL";

            List<SyndicationItem> items = new List<SyndicationItem>();

            feed.Title = new TextSyndicationContent("Last trends on CatMyVideo");
            feed.Description = new TextSyndicationContent(String.Format("Todays' top {0} hottest videos on CatMyVideo", MAXVIDEO));
            feed.Copyright = new TextSyndicationContent("Copy/Paste rights CatMyVideo");
            feed.Generator = "CatMyVideo RSS Feeder 1.0";
            feed.Authors.Add(new SyndicationPerson("*****@*****.**"));

            feed.LastUpdatedTime = new DateTimeOffset(DateTime.Now);

            var trendingVideos = Engine.BusinessManagement.Video.ListVideos(Engine.Dbo.Video.Order.UploadDate, false, MAXVIDEO, 0, true);
            for (int i = 0; i < trendingVideos.Count; i++)
            {
                SyndicationItem item = new SyndicationItem();

                string itemUrl = serverUrl + "/Video/Display/" + trendingVideos[i].Id;
                item.Id = itemUrl;

                var itemLink = new SyndicationLink(new Uri(itemUrl));
                itemLink.MediaType = "text/html";
                itemLink.Title = "Watch me !";
                item.Links.Add(itemLink);

                string htmlContent = String.Format("<!DOCTYPE html><html><head></head><body><h1>{0}</h1><p>{1}</p><a href=\"{2}\">Check this out !</a></body></html>",
                                                    trendingVideos[i].Title,
                                                    trendingVideos[i].Description,
                                                    itemUrl);
                TextSyndicationContent content = new TextSyndicationContent(htmlContent, TextSyndicationContentKind.Html);

                // Fill some properties for the item
                item.Title = new TextSyndicationContent("#" + (i + 1));
                item.LastUpdatedTime = DateTime.Now;
                item.PublishDate = trendingVideos[i].UploadDate;

                item.Content = content;
                items.Add(item);
            }
            feed.Items = items;

            string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
            SyndicationFeedFormatter formatter = null;
            if (query == "atom")
            {
                formatter = new Atom10FeedFormatter(feed);
            }
            else
            {
                formatter = new Rss20FeedFormatter(feed);
            }

            return formatter;
        }
Exemplo n.º 10
0
		public SyndicationFeed(string title, string description,
													 Uri feedAlternateLink) : this()
		{
			this.title = new TextSyndicationContent(title);
			this.description = new TextSyndicationContent(description);
			links.Add(SyndicationLink.CreateAlternateLink(feedAlternateLink));
		}
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            string url = @"https://www.google.co.jp/alerts/feeds/09047520966360389555/18173224082898862477";


            using (XmlReader rdr = XmlReader.Create(url))
            {
                SyndicationFeed feed = SyndicationFeed.Load(rdr);

                foreach (SyndicationItem item in feed.Items)
                {
                    System.ServiceModel.Syndication.
                    TextSyndicationContent c = (TextSyndicationContent)item.Content;

                    Console.WriteLine("item Title:" + item.Title.Text);
                    Console.WriteLine("item Title:" + item.Content.Type);
                    Console.WriteLine("item Title:" + c.Text);

                    //Console.WriteLine("link:" + (item.Links.Count > 0
                    //                ? item.Links[0].Uri.AbsolutePath : ""));
                }
            }

            Console.WriteLine("--- ReadKey ---");
            Console.ReadKey();
        }
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable<CategoriesDocument> categories, IEnumerable<string> accepts)
     : this(title, link, categories, true)
 {
     if (accepts == null)
         throw new ArgumentNullException ("accepts");
     foreach (var a in accepts)
         Accepts.Add (a);
 }
Exemplo n.º 13
0
 internal static TextSyndicationContent CloneTextContent(TextSyndicationContent content)
 {
     if (content == null)
     {
         return(null);
     }
     return((TextSyndicationContent)(content.Clone()));
 }
Exemplo n.º 14
0
 static internal TextSyndicationContent CloneTextContent(TextSyndicationContent content)
 {
     if (content == null)
     {
         return null;
     }
     return (TextSyndicationContent)(content.Clone());
 }
Exemplo n.º 15
0
 public Workspace(TextSyndicationContent title, IEnumerable<ResourceCollectionInfo> collections)
     : this()
 {
     Title = title;
     if (collections != null)
         foreach (var i in collections)
             Collections.Add (i);
 }
Exemplo n.º 16
0
 protected TextSyndicationContent(TextSyndicationContent source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     text = source.text;
     kind = source.kind;
 }
 protected TextSyndicationContent(TextSyndicationContent source) : base(source)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     this.text     = source.text;
     this.textKind = source.textKind;
 }
 protected TextSyndicationContent(TextSyndicationContent source) : base(source)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     this.text = source.text;
     this.textKind = source.textKind;
 }
Exemplo n.º 19
0
		public void HtmlSimple ()
		{
			TextSyndicationContent shtml = new TextSyndicationContent (validhtml, TextSyndicationContentKind.Html);

			Assert.AreEqual (typeof (TextSyndicationContent), shtml.GetType (), "#HS1");
			Assert.AreEqual (typeof (string), shtml.Text.GetType (), "#HS2");
			// check for content and type
			Assert.AreEqual (validhtml, shtml.Text.ToString (), "#HS3");
			Assert.AreEqual (text_types [(int) TextSyndicationContentKind.Html], shtml.Type, "#HS4");
		}
 protected TextSyndicationContent(TextSyndicationContent source)
     : base(source)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(source));
     }
     _text     = source._text;
     _textKind = source._textKind;
 }
Exemplo n.º 21
0
 protected TextSyndicationContent(TextSyndicationContent source)
     : base(source)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     _text     = source._text;
     _textKind = source._textKind;
 }
        public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable<CategoriesDocument> categories, bool allowsNewEntries)
            : this(title, link)
        {
            if (categories == null)
                throw new ArgumentNullException ("categories");

            foreach (var c in categories)
                Categories.Add (c);
            allow_new_entries = allowsNewEntries;
        }
Exemplo n.º 23
0
		public void Clone ()
		{
			TextSyndicationContent t = new TextSyndicationContent ("test");
			t = t.Clone () as TextSyndicationContent;
			Assert.AreEqual ("test", t.Text, "#1");
			Assert.AreEqual ("text", t.Type, "#2");

			t = new TextSyndicationContent ("test", TextSyndicationContentKind.Html);
			t = t.Clone () as TextSyndicationContent;
			Assert.AreEqual ("html", t.Type, "#3");
		}
Exemplo n.º 24
0
 public Workspace(TextSyndicationContent title, IEnumerable <ResourceCollectionInfo> collections)
 {
     Title = title;
     if (collections != null)
     {
         _collections = new NullNotAllowedCollection <ResourceCollectionInfo>();
         foreach (ResourceCollectionInfo collection in collections)
         {
             _collections.Add(collection);
         }
     }
 }
Exemplo n.º 25
0
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable <CategoriesDocument> categories, IEnumerable <string> accepts)
     : this(title, link, categories, true)
 {
     if (accepts == null)
     {
         throw new ArgumentNullException("accepts");
     }
     foreach (var a in accepts)
     {
         Accepts.Add(a);
     }
 }
Exemplo n.º 26
0
 public Workspace(TextSyndicationContent title, IEnumerable <ResourceCollectionInfo> collections)
     : this()
 {
     Title = title;
     if (collections != null)
     {
         foreach (var i in collections)
         {
             Collections.Add(i);
         }
     }
 }
Exemplo n.º 27
0
 public Workspace(TextSyndicationContent title, IEnumerable<ResourceCollectionInfo> collections)
 {
     this.title = title;
     if (collections != null)
     {
         this.collections = new NullNotAllowedCollection<ResourceCollectionInfo>();
         foreach (ResourceCollectionInfo collection in collections)
         {
             this.collections.Add(collection);
         }
     }
 }
Exemplo n.º 28
0
 public Workspace(TextSyndicationContent title, IEnumerable <ResourceCollectionInfo> collections)
 {
     this.extensions = new ExtensibleSyndicationObject();
     this.title      = title;
     if (collections != null)
     {
         this.collections = new NullNotAllowedCollection <ResourceCollectionInfo>();
         foreach (ResourceCollectionInfo info in collections)
         {
             this.collections.Add(info);
         }
     }
 }
Exemplo n.º 29
0
		public void WriteTo ()
		{
			TextSyndicationContent t = new TextSyndicationContent (null);
			StringWriter sw = new StringWriter ();
			using (XmlWriter w = CreateWriter (sw))
				t.WriteTo (w, "root", String.Empty);
			Assert.AreEqual ("<root type=\"text\"></root>", sw.ToString ());

			t = new TextSyndicationContent ("broken<b>html", TextSyndicationContentKind.Html);
			sw = new StringWriter ();
			using (XmlWriter w = CreateWriter (sw))
				t.WriteTo (w, "root", String.Empty);
			Assert.AreEqual ("<root type=\"html\">broken&lt;b&gt;html</root>", sw.ToString ());
		}
 public SyndicationItem(string title, SyndicationContent content, Uri itemAlternateLink, string id, DateTimeOffset lastUpdatedTime)
 {
     if (title != null)
     {
         Title = new TextSyndicationContent(title);
     }
     Content = content;
     if (itemAlternateLink != null)
     {
         Links.Add(SyndicationLink.CreateAlternateLink(itemAlternateLink));
     }
     Id = id;
     _lastUpdatedTime = lastUpdatedTime;
 }
Exemplo n.º 31
0
        public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable <CategoriesDocument> categories, bool allowsNewEntries)
            : this(title, link)
        {
            if (categories == null)
            {
                throw new ArgumentNullException("categories");
            }

            foreach (var c in categories)
            {
                Categories.Add(c);
            }
            allow_new_entries = allowsNewEntries;
        }
Exemplo n.º 32
0
		internal void WriteXml(XmlWriter writer, SyndicationContent content,
													 string outerElementName, bool writeEmptyNodes)
		{
			if (content != null)
				{
					content.WriteTo(writer, outerElementName, FeedNamespace);
					return;
				}

			if (!writeEmptyNodes) return;
			 
			// write out empty node if necessary
			TextSyndicationContent emptyNode = new TextSyndicationContent("");
			emptyNode.WriteTo(writer, outerElementName, FeedNamespace);
		}
Exemplo n.º 33
0
		public void Constructor ()
		{
			TextSyndicationContent t = new TextSyndicationContent (null); // hmm, null is allowed...
			Assert.IsNull (t.Text, "#0");

			t = new TextSyndicationContent ("test");
			Assert.AreEqual ("test", t.Text, "#1");
			Assert.AreEqual ("text", t.Type, "#2");

			t = new TextSyndicationContent ("test", TextSyndicationContentKind.Html);
			Assert.AreEqual ("html", t.Type, "#3");

			t = new TextSyndicationContent ("test", TextSyndicationContentKind.XHtml);
			Assert.AreEqual ("xhtml", t.Type, "#4");
		}
Exemplo n.º 34
0
 protected SyndicationItem(SyndicationItem source)
 {
     extensions        = source.extensions.Clone();
     categories        = Copy <SyndicationCategory> (source.categories);
     authors           = Copy <SyndicationPerson> (source.authors);
     contributors      = Copy <SyndicationPerson> (source.contributors);
     links             = Copy <SyndicationLink> (source.links);
     base_uri          = source.base_uri;    // copy by reference !!
     copyright         = source.copyright == null ? null : source.copyright.Clone() as TextSyndicationContent;
     summary           = source.summary == null ? null : source.summary.Clone() as TextSyndicationContent;
     title             = source.title == null ? null : source.title.Clone() as TextSyndicationContent;
     content           = source.content == null ? null : source.content.Clone();
     id                = source.id;
     last_updated_time = source.last_updated_time;
     published_date    = source.published_date;
     source_feed       = source.source_feed == null ? null : source.source_feed.Clone(false);
 }
Exemplo n.º 35
0
 public SyndicationFeed(string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime, IEnumerable <SyndicationItem> items)
 {
     if (title != null)
     {
         _title = new TextSyndicationContent(title);
     }
     if (description != null)
     {
         _description = new TextSyndicationContent(description);
     }
     if (feedAlternateLink != null)
     {
         this.Links.Add(SyndicationLink.CreateAlternateLink(feedAlternateLink));
     }
     _id = id;
     _lastUpdatedTime = lastUpdatedTime;
     _items           = items;
 }
 public SyndicationFeed(string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime, IEnumerable <SyndicationItem> items)
 {
     this.extensions = new ExtensibleSyndicationObject();
     if (title != null)
     {
         this.title = new TextSyndicationContent(title);
     }
     if (description != null)
     {
         this.description = new TextSyndicationContent(description);
     }
     if (feedAlternateLink != null)
     {
         this.Links.Add(SyndicationLink.CreateAlternateLink(feedAlternateLink));
     }
     this.id = id;
     this.lastUpdatedTime = lastUpdatedTime;
     this.items           = items;
 }
Exemplo n.º 37
0
        internal void WriteXml(XmlWriter writer, SyndicationContent content,
                               string outerElementName, bool writeEmptyNodes)
        {
            if (content != null)
            {
                content.WriteTo(writer, outerElementName, FeedNamespace);
                return;
            }

            if (!writeEmptyNodes)
            {
                return;
            }

            // write out empty node if necessary
            TextSyndicationContent emptyNode = new TextSyndicationContent("");

            emptyNode.WriteTo(writer, outerElementName, FeedNamespace);
        }
Exemplo n.º 38
0
        TextSyndicationContent ReadTextSyndicationContent(XmlReader reader)
        {
            TextSyndicationContentKind kind = TextSyndicationContentKind.Plaintext;

            switch (reader.GetAttribute("type"))
            {
            case "html":
                kind = TextSyndicationContentKind.Html;
                break;

            case "xhtml":
                kind = TextSyndicationContentKind.XHtml;
                break;
            }
            string text = reader.ReadElementContentAsString();
            TextSyndicationContent t = new TextSyndicationContent(text, kind);

            return(t);
        }
Exemplo n.º 39
0
        protected SyndicationFeed(SyndicationFeed source, bool cloneItems)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            _authors         = FeedUtils.ClonePersons(source._authors);
            _categories      = FeedUtils.CloneCategories(source._categories);
            _contributors    = FeedUtils.ClonePersons(source._contributors);
            _copyright       = FeedUtils.CloneTextContent(source._copyright);
            _description     = FeedUtils.CloneTextContent(source._description);
            _extensions      = source._extensions.Clone();
            _generator       = source._generator;
            _id              = source._id;
            _imageUrl        = source._imageUrl;
            _language        = source._language;
            _lastUpdatedTime = source._lastUpdatedTime;
            _links           = FeedUtils.CloneLinks(source._links);
            _title           = FeedUtils.CloneTextContent(source._title);
            _baseUri         = source._baseUri;
            IList <SyndicationItem> srcList = source._items as IList <SyndicationItem>;

            if (srcList != null)
            {
                Collection <SyndicationItem> tmp = new NullNotAllowedCollection <SyndicationItem>();
                for (int i = 0; i < srcList.Count; ++i)
                {
                    tmp.Add((cloneItems) ? srcList[i].Clone() : srcList[i]);
                }
                _items = tmp;
            }
            else
            {
                if (cloneItems)
                {
                    throw new InvalidOperationException(SR.UnbufferedItemsCannotBeCloned);
                }

                _items = source._items;
            }
        }
Exemplo n.º 40
0
		public void TextSimple ()
		{
			TextSyndicationContent stext = new TextSyndicationContent (lorem, TextSyndicationContentKind.Plaintext);

			Assert.AreEqual (typeof (TextSyndicationContent), stext.GetType (), "#TS1");
			Assert.AreEqual (typeof (string), stext.Text.GetType (), "#TS2");
			// check for content and type
			Assert.AreEqual (lorem, stext.Text.ToString (), "#TS3");
			Assert.AreEqual (text_types [(int) TextSyndicationContentKind.Plaintext], stext.Type.ToString (), "#TS4");

			stext = new TextSyndicationContent (null);

			// Be sure .Text is null
			try
			{
				Assert.AreEqual (typeof (string), stext.Text.GetType (), "#TS6");
				Assert.Fail ("#TS7 Expected an NullReferenceException to be thrown.");
			}
			catch (NullReferenceException) {}
		}
Exemplo n.º 41
0
        protected internal virtual bool TryParseElement(XmlReader reader, string version)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            reader.MoveToContent();

            if (reader.LocalName != "collection" || reader.NamespaceURI != version)
            {
                return(false);
            }

            for (int i = 0; i < reader.AttributeCount; i++)
            {
                reader.MoveToAttribute(i);
                if (!TryParseAttribute(reader.LocalName, reader.NamespaceURI, reader.Value, version))
                {
                    AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), reader.Value);
                }
            }
            reader.MoveToElement();

            if (!reader.IsEmptyElement)
            {
                reader.Read();
                for (reader.MoveToContent(); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent())
                {
                    if (reader.LocalName == "title" && reader.NamespaceURI == Namespaces.Atom10)
                    {
                        Title = Atom10FeedFormatter.ReadTextSyndicationContent(reader);
                    }
                    else
                    {
                        ElementExtensions.Add(new SyndicationElementExtension(reader));
                    }
                }
            }
            reader.Read();
            return(true);
        }
Exemplo n.º 42
0
        protected internal virtual bool TryParseElement(XmlReader reader, string version)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            reader.MoveToContent();
            if (reader.LocalName != "workspace" || reader.NamespaceURI != version)
            {
                return(false);
            }

            bool isEmpty = reader.IsEmptyElement;

            reader.ReadStartElement();
            if (isEmpty)
            {
                return(true);
            }

            for (reader.MoveToContent(); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent())
            {
                if (reader.LocalName == "title" && reader.NamespaceURI == Namespaces.Atom10)
                {
                    Title = Atom10FeedFormatter.ReadTextSyndicationContent(reader);
                    continue;
                }
                else if (reader.LocalName == "collection" && reader.NamespaceURI == version)
                {
                    var rc = new ResourceCollectionInfo();
                    if (rc.TryParseElement(reader, version))
                    {
                        Collections.Add(rc);
                        continue;
                    }
                }
                ElementExtensions.Add(new SyndicationElementExtension(reader));
            }
            return(true);
        }
        protected SyndicationFeed(SyndicationFeed source, bool cloneItems)
        {
            this.extensions = new ExtensibleSyndicationObject();
            if (source == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
            }
            this.authors         = FeedUtils.ClonePersons(source.authors);
            this.categories      = FeedUtils.CloneCategories(source.categories);
            this.contributors    = FeedUtils.ClonePersons(source.contributors);
            this.copyright       = FeedUtils.CloneTextContent(source.copyright);
            this.description     = FeedUtils.CloneTextContent(source.description);
            this.extensions      = source.extensions.Clone();
            this.generator       = source.generator;
            this.id              = source.id;
            this.imageUrl        = source.imageUrl;
            this.language        = source.language;
            this.lastUpdatedTime = source.lastUpdatedTime;
            this.links           = FeedUtils.CloneLinks(source.links);
            this.title           = FeedUtils.CloneTextContent(source.title);
            this.baseUri         = source.baseUri;
            IList <SyndicationItem> items = source.items as IList <SyndicationItem>;

            if (items != null)
            {
                Collection <SyndicationItem> collection = new NullNotAllowedCollection <SyndicationItem>();
                for (int i = 0; i < items.Count; i++)
                {
                    collection.Add(cloneItems ? items[i].Clone() : items[i]);
                }
                this.items = collection;
            }
            else
            {
                if (cloneItems)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("UnbufferedItemsCannotBeCloned")));
                }
                this.items = source.items;
            }
        }
        protected SyndicationFeed(SyndicationFeed source, bool cloneItems)
        {
            if (source == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
            }
            this.authors         = FeedUtils.ClonePersons(source.authors);
            this.categories      = FeedUtils.CloneCategories(source.categories);
            this.contributors    = FeedUtils.ClonePersons(source.contributors);
            this.copyright       = FeedUtils.CloneTextContent(source.copyright);
            this.description     = FeedUtils.CloneTextContent(source.description);
            this.extensions      = source.extensions.Clone();
            this.generator       = source.generator;
            this.id              = source.id;
            this.imageUrl        = source.imageUrl;
            this.language        = source.language;
            this.lastUpdatedTime = source.lastUpdatedTime;
            this.links           = FeedUtils.CloneLinks(source.links);
            this.title           = FeedUtils.CloneTextContent(source.title);
            this.baseUri         = source.baseUri;
            IList <SyndicationItem> srcList = source.items as IList <SyndicationItem>;

            if (srcList != null)
            {
                Collection <SyndicationItem> tmp = new NullNotAllowedCollection <SyndicationItem>();
                for (int i = 0; i < srcList.Count; ++i)
                {
                    tmp.Add((cloneItems) ? srcList[i].Clone() : srcList[i]);
                }
                this.items = tmp;
            }
            else
            {
                if (cloneItems)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.UnbufferedItemsCannotBeCloned)));
                }
                this.items = source.items;
            }
        }
Exemplo n.º 45
0
        /*
         output-file=<f>
         root-url=<url>
         package-source=<dir>
         package-url=<url>

         actual-url=<url>
         recursive
         title=<title>
         */
        public AtomFeed(string outputFilename, string rootUrl, string packageUrl, string actualUrl = null, string title = null)
            : this()
        {
            Title = new TextSyndicationContent(title ?? "CoApp Package Feed");

            _rootUrl = rootUrl.EndsWith("/") ? rootUrl : rootUrl + "/";
            _actualUrl = actualUrl ?? _rootUrl + Path.GetFileName(outputFilename);

            if( !packageUrl.Contains("://")) {
                packageUrl = _rootUrl + (packageUrl.StartsWith("/") ? packageUrl.Substring(1) : packageUrl);
            }
            _packageUrlPrefix = (packageUrl.EndsWith("/") ? packageUrl : packageUrl+"/");

            var selfLink = CreateLink();
            selfLink.RelationshipType = "self";
            selfLink.MediaType = "application/atom+xml";
            selfLink.Title = "Feed Location";
            selfLink.Uri = new Uri(_actualUrl);
            Links.Add(selfLink);

            Generator = "CoAppEngine";
            _outputFilename = outputFilename;
        }
Exemplo n.º 46
0
        protected SyndicationFeed(SyndicationFeed source, bool cloneItems)
        {
            extensions        = source.extensions.Clone();
            categories        = source.categories == null ? null : new Collection <SyndicationCategory> (source.categories);
            authors           = source.authors == null ? null : new Collection <SyndicationPerson> (source.authors);
            contributors      = source.contributors == null ? null : new Collection <SyndicationPerson> (source.contributors);
            links             = source.links == null ? null : new Collection <SyndicationLink> (source.links);
            base_uri          = source.base_uri; // copy by reference !!
            copyright         = source.copyright == null ? null : source.copyright.Clone() as TextSyndicationContent;
            title             = source.title == null ? null : source.title.Clone() as TextSyndicationContent;
            id                = source.id;
            last_updated_time = source.last_updated_time;

            description = source.description == null ? null : source.description.Clone() as TextSyndicationContent;
            generator   = source.generator;
            image_url   = source.image_url; // copy by reference !!
            language    = source.language;

            if (cloneItems && source.items != null)
            {
                items = new Collection <SyndicationItem> (new List <SyndicationItem> (source.items));
            }
        }
Exemplo n.º 47
0
        protected internal virtual bool TryParseElement(XmlReader reader, string version)
        {
            if (reader == null)
                throw new ArgumentNullException ("reader");

            reader.MoveToContent ();
            if (reader.LocalName != "workspace" || reader.NamespaceURI != version)
                return false;

            bool isEmpty = reader.IsEmptyElement;

            reader.ReadStartElement ();
            if (isEmpty)
                return true;

            for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
                if (reader.LocalName == "title" && reader.NamespaceURI == Namespaces.Atom10) {
                    Title = Atom10FeedFormatter.ReadTextSyndicationContent (reader);
                    continue;
                } else if (reader.LocalName == "collection" && reader.NamespaceURI == version) {
                    var rc = new ResourceCollectionInfo ();
                    if (rc.TryParseElement (reader, version)) {
                        Collections.Add (rc);
                        continue;
                    }
                }
                ElementExtensions.Add (new SyndicationElementExtension (reader));
            }
            return true;
        }
Exemplo n.º 48
0
        private SyndicationItem GetRSSEntryForTicket(Ticket ticket)
        {
            string viewTicket = "/ViewTicket.aspx?id=" + ticket.TicketId.ToString();
            string link = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority +
            HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + viewTicket;
            Uri uri = new Uri(link);

            TextSyndicationContent content = new TextSyndicationContent(GetItemBody(ticket, link), TextSyndicationContentKind.Html);

            SyndicationItem item = new SyndicationItem(ticket.Title, "", uri, ticket.TicketId.ToString(), (DateTimeOffset)ticket.LastUpdateDate);
            item.Content = content;

            return item;
        }
Exemplo n.º 49
0
        /// <summary>
        ///   This needs to be called after anything in the model is changed.
        /// </summary>
        public void SyncFromModel()
        {
            // this pulls down information from the Model element into the atom item.
            Id = Model.CanonicalName;
            Title = new TextSyndicationContent(Model.CosmeticName);
            Summary = new TextSyndicationContent(Model.PackageDetails.SummaryDescription);
            PublishDate = Model.PackageDetails.PublishDate;
            Authors.Clear();
            Contributors.Clear();
            Categories.Clear();
            Links.Clear();

            if (Model.PackageDetails.Publisher != null) {
                Authors.Add(CreatePerson().With(a => {
                    a.Name = Model.PackageDetails.Publisher.Name;
                    a.Email = Model.PackageDetails.Publisher.Email;
                    a.Uri = Model.PackageDetails.Publisher.Location == null ? string.Empty : Model.PackageDetails.Publisher.Location.ToString();
                }));
            }
            if (!Model.PackageDetails.Contributors.IsNullOrEmpty()) {
                foreach (var c in Model.PackageDetails.Contributors) {
                    var contributor = c;
                    Contributors.Add(CreatePerson().With(a => {
                        a.Name = contributor.Name;
                        a.Email = contributor.Email;
                        a.Uri = contributor.Location == null ? string.Empty : contributor.Location.ToString();
                    }));
                }
            }

            if (!string.IsNullOrEmpty(Model.PackageDetails.CopyrightStatement)) {
                Copyright = new TextSyndicationContent(Model.PackageDetails.CopyrightStatement);
            }

            if (!Model.PackageDetails.Tags.IsNullOrEmpty()) {
                foreach (var tag in Model.PackageDetails.Tags) {
                    Categories.Add(new SyndicationCategory(tag, "/Tags", tag));
                }
            }

            if (!Model.PackageDetails.Categories.IsNullOrEmpty()) {
                foreach (var category in Model.PackageDetails.Categories) {
                    Categories.Add(new SyndicationCategory(category, "/Categories", category));
                }
            }

            if (Model.PackageDetails.Description != null) {
                Content = SyndicationContent.CreateHtmlContent(Model.PackageDetails.Description);
            }

            if (!Model.Locations.IsNullOrEmpty()) {
                foreach (var l in Model.Locations) {
                    var location = l;
                    Links.Add(CreateLink().With(link => {
                        link.RelationshipType = "enclosure";
                        link.MediaType = "application/package";
                        link.Uri = location;
                        link.Title = Model.Name;
                    }));

                    Links.Add(CreateLink().With(link => {
                        link.Uri = location;
                    }));
                }
            }
            // and serialize that out.
            ElementExtensions.Add(Model, Model.XmlSerializer);
        }
Exemplo n.º 50
0
		public void Advanced ()
		{
			// Defaults to Plaintext
			TextSyndicationContent stext = new TextSyndicationContent (lorem);

			Assert.AreEqual (text_types [(int) TextSyndicationContentKind.Plaintext], stext.Type, "#A1");
		}
 internal static TextSyndicationContent ReadTextSyndicationContent(XmlReader reader)
 {
     TextSyndicationContentKind kind = TextSyndicationContentKind.Plaintext;
     switch (reader.GetAttribute ("type")) {
     case "html":
         kind = TextSyndicationContentKind.Html;
         break;
     case "xhtml":
         kind = TextSyndicationContentKind.XHtml;
         break;
     }
     string text = reader.ReadElementContentAsString ();
     TextSyndicationContent t = new TextSyndicationContent (text, kind);
     return t;
 }
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable<CategoriesDocument> categories, IEnumerable<string> accepts)
 {
 }
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable<CategoriesDocument> categories, bool allowsNewEntries) : this(title, link, categories, allowsNewEntries ? null : CreateSingleEmptyAccept())
 {
 }
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link) : this(title, link, null, (IEnumerable<string>) null)
 {
 }
        protected internal virtual bool TryParseElement(XmlReader reader, string version)
        {
            if (reader == null)
                throw new ArgumentNullException ("reader");
            reader.MoveToContent ();

            if (reader.LocalName != "collection" || reader.NamespaceURI != version)
                return false;

            for (int i = 0; i < reader.AttributeCount; i++) {
                reader.MoveToAttribute (i);
                if (!TryParseAttribute (reader.LocalName, reader.NamespaceURI, reader.Value, version))
                    AttributeExtensions.Add (new XmlQualifiedName (reader.LocalName, reader.NamespaceURI), reader.Value);
            }
            reader.MoveToElement ();

            if (!reader.IsEmptyElement) {
                reader.Read ();
                for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
                    if (reader.LocalName == "title" && reader.NamespaceURI == Namespaces.Atom10)
                        Title = Atom10FeedFormatter.ReadTextSyndicationContent (reader);
                    else
                        ElementExtensions.Add (new SyndicationElementExtension (reader));
                }
            }
            reader.Read ();
            return true;
        }
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link)
     : this()
 {
     Title = title;
     Link = link;
 }
Exemplo n.º 57
0
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable <CategoriesDocument> categories, bool allowsNewEntries)
     : this(title, link, categories, (allowsNewEntries) ? null : CreateSingleEmptyAccept())
 {
 }
 private void WriteItemContents(XmlWriter writer, SyndicationItem item, Uri feedBaseUri)
 {
     Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(feedBaseUri, item.BaseUri);
     if (baseUriToWrite != null)
     {
         writer.WriteAttributeString("xml", "base", "http://www.w3.org/XML/1998/namespace", FeedUtils.GetUriString(baseUriToWrite));
     }
     SyndicationFeedFormatter.WriteAttributeExtensions(writer, item, this.Version);
     string str = item.Id ?? string.Empty;
     bool flag = false;
     SyndicationLink link = null;
     for (int i = 0; i < item.Links.Count; i++)
     {
         if (item.Links[i].RelationshipType == "alternate")
         {
             if (link == null)
             {
                 link = item.Links[i];
             }
             if (str == FeedUtils.GetUriString(item.Links[i].Uri))
             {
                 flag = true;
                 break;
             }
         }
     }
     if (!string.IsNullOrEmpty(str))
     {
         writer.WriteStartElement("guid");
         if (flag)
         {
             writer.WriteAttributeString("isPermaLink", "true");
         }
         else
         {
             writer.WriteAttributeString("isPermaLink", "false");
         }
         writer.WriteString(str);
         writer.WriteEndElement();
     }
     if (link != null)
     {
         this.WriteAlternateLink(writer, link, (item.BaseUri != null) ? item.BaseUri : feedBaseUri);
     }
     if ((item.Authors.Count == 1) && !string.IsNullOrEmpty(item.Authors[0].Email))
     {
         this.WritePerson(writer, "author", item.Authors[0]);
     }
     else if (this.serializeExtensionsAsAtom)
     {
         this.atomSerializer.WriteItemAuthorsTo(writer, item.Authors);
     }
     else
     {
         TraceExtensionsIgnoredOnWrite("ItemAuthorsIgnoredOnWrite");
     }
     for (int j = 0; j < item.Categories.Count; j++)
     {
         this.WriteCategory(writer, item.Categories[j]);
     }
     bool flag2 = false;
     if (item.Title != null)
     {
         writer.WriteElementString("title", item.Title.Text);
         flag2 = true;
     }
     bool flag3 = false;
     TextSyndicationContent summary = item.Summary;
     if (summary == null)
     {
         summary = item.Content as TextSyndicationContent;
         flag3 = summary != null;
     }
     if (!flag2 && (summary == null))
     {
         summary = new TextSyndicationContent(string.Empty);
     }
     if (summary != null)
     {
         writer.WriteElementString("description", "", summary.Text);
     }
     if (item.SourceFeed != null)
     {
         writer.WriteStartElement("source", "");
         SyndicationFeedFormatter.WriteAttributeExtensions(writer, item.SourceFeed, this.Version);
         SyndicationLink link2 = null;
         for (int m = 0; m < item.SourceFeed.Links.Count; m++)
         {
             if (item.SourceFeed.Links[m].RelationshipType == "self")
             {
                 link2 = item.SourceFeed.Links[m];
                 break;
             }
         }
         if ((link2 != null) && !item.SourceFeed.AttributeExtensions.ContainsKey(Rss20Url))
         {
             writer.WriteAttributeString("url", "", FeedUtils.GetUriString(link2.Uri));
         }
         string text = (item.SourceFeed.Title != null) ? item.SourceFeed.Title.Text : string.Empty;
         writer.WriteString(text);
         writer.WriteEndElement();
     }
     if (item.PublishDate > DateTimeOffset.MinValue)
     {
         writer.WriteElementString("pubDate", "", this.AsString(item.PublishDate));
     }
     SyndicationLink link3 = null;
     bool flag4 = false;
     bool flag5 = false;
     for (int k = 0; k < item.Links.Count; k++)
     {
         if (item.Links[k].RelationshipType == "enclosure")
         {
             if (link3 != null)
             {
                 goto Label_03D8;
             }
             link3 = item.Links[k];
             this.WriteMediaEnclosure(writer, item.Links[k], item.BaseUri);
             continue;
         }
         if ((item.Links[k].RelationshipType == "alternate") && !flag4)
         {
             flag4 = true;
             continue;
         }
     Label_03D8:
         if (this.serializeExtensionsAsAtom)
         {
             this.atomSerializer.WriteLink(writer, item.Links[k], item.BaseUri);
         }
         else
         {
             flag5 = true;
         }
     }
     if (flag5)
     {
         TraceExtensionsIgnoredOnWrite("ItemLinksIgnoredOnWrite");
     }
     if (item.LastUpdatedTime > DateTimeOffset.MinValue)
     {
         if (this.serializeExtensionsAsAtom)
         {
             this.atomSerializer.WriteItemLastUpdatedTimeTo(writer, item.LastUpdatedTime);
         }
         else
         {
             TraceExtensionsIgnoredOnWrite("ItemLastUpdatedTimeIgnoredOnWrite");
         }
     }
     if (this.serializeExtensionsAsAtom)
     {
         this.atomSerializer.WriteContentTo(writer, "rights", item.Copyright);
     }
     else
     {
         TraceExtensionsIgnoredOnWrite("ItemCopyrightIgnoredOnWrite");
     }
     if (!flag3)
     {
         if (this.serializeExtensionsAsAtom)
         {
             this.atomSerializer.WriteContentTo(writer, "content", item.Content);
         }
         else
         {
             TraceExtensionsIgnoredOnWrite("ItemContentIgnoredOnWrite");
         }
     }
     if (item.Contributors.Count > 0)
     {
         if (this.serializeExtensionsAsAtom)
         {
             this.atomSerializer.WriteItemContributorsTo(writer, item.Contributors);
         }
         else
         {
             TraceExtensionsIgnoredOnWrite("ItemContributorsIgnoredOnWrite");
         }
     }
     SyndicationFeedFormatter.WriteElementExtensions(writer, item, this.Version);
 }
Exemplo n.º 59
0
        void WriteItemContents(XmlWriter writer, SyndicationItem item, Uri feedBaseUri)
        {
            Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(feedBaseUri, item.BaseUri);
            if (baseUriToWrite != null)
            {
                writer.WriteAttributeString("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite));
            }
            WriteAttributeExtensions(writer, item, this.Version);
            string guid = item.Id ?? string.Empty;
            bool isPermalink = false;
            SyndicationLink firstAlternateLink = null;
            for (int i = 0; i < item.Links.Count; ++i)
            {
                if (item.Links[i].RelationshipType == Atom10Constants.AlternateTag)
                {
                    if (firstAlternateLink == null)
                    {
                        firstAlternateLink = item.Links[i];
                    }
                    if (guid == FeedUtils.GetUriString(item.Links[i].Uri))
                    {
                        isPermalink = true;
                        break;
                    }
                }
            }
            if (!string.IsNullOrEmpty(guid))
            {
                writer.WriteStartElement(Rss20Constants.GuidTag);
                if (isPermalink)
                {
                    writer.WriteAttributeString(Rss20Constants.IsPermaLinkTag, "true");
                }
                else
                {
                    writer.WriteAttributeString(Rss20Constants.IsPermaLinkTag, "false");
                }
                writer.WriteString(guid);
                writer.WriteEndElement();
            }
            if (firstAlternateLink != null)
            {
                WriteAlternateLink(writer, firstAlternateLink, (item.BaseUri != null ? item.BaseUri : feedBaseUri));
            }

#pragma warning disable 56506 // Microsoft, item.Authors is never null
            if (item.Authors.Count == 1 && !string.IsNullOrEmpty(item.Authors[0].Email))
#pragma warning restore 56506
            {
                WritePerson(writer, Rss20Constants.AuthorTag, item.Authors[0]);
            }
            else
            {
                if (serializeExtensionsAsAtom)
                {
                    this.atomSerializer.WriteItemAuthorsTo(writer, item.Authors);
                }
                else
                {
                    TraceExtensionsIgnoredOnWrite(SR.ItemAuthorsIgnoredOnWrite);
                }
            }

#pragma warning disable 56506 // Microsoft, item.Categories is never null
            for (int i = 0; i < item.Categories.Count; ++i)
#pragma warning restore 56506
            {
                WriteCategory(writer, item.Categories[i]);
            }

            bool serializedTitle = false;
            if (item.Title != null)
            {
                writer.WriteElementString(Rss20Constants.TitleTag, item.Title.Text);
                serializedTitle = true;
            }

            bool serializedContentAsDescription = false;
            TextSyndicationContent summary = item.Summary;
            if (summary == null)
            {
                summary = (item.Content as TextSyndicationContent);
                serializedContentAsDescription = (summary != null);
            }
            // the spec requires the wire to have a title or a description
            if (!serializedTitle && summary == null)
            {
                summary = new TextSyndicationContent(string.Empty);
            }
            if (summary != null)
            {
                writer.WriteElementString(Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace, summary.Text);
            }

            if (item.SourceFeed != null)
            {
                writer.WriteStartElement(Rss20Constants.SourceTag, Rss20Constants.Rss20Namespace);
                WriteAttributeExtensions(writer, item.SourceFeed, this.Version);
                SyndicationLink selfLink = null;
                for (int i = 0; i < item.SourceFeed.Links.Count; ++i)
                {
                    if (item.SourceFeed.Links[i].RelationshipType == Atom10Constants.SelfTag)
                    {
                        selfLink = item.SourceFeed.Links[i];
                        break;
                    }
                }
                if (selfLink != null && !item.SourceFeed.AttributeExtensions.ContainsKey(Rss20Url))
                {
                    writer.WriteAttributeString(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace, FeedUtils.GetUriString(selfLink.Uri));
                }
                string title = (item.SourceFeed.Title != null) ? item.SourceFeed.Title.Text : string.Empty;
                writer.WriteString(title);
                writer.WriteEndElement();
            }

            if (item.PublishDate > DateTimeOffset.MinValue)
            {
                writer.WriteElementString(Rss20Constants.PubDateTag, Rss20Constants.Rss20Namespace, AsString(item.PublishDate));
            }

            // serialize the enclosures
            SyndicationLink firstEnclosureLink = null;
            bool passedFirstAlternateLink = false;
            bool isLinkIgnored = false;
            for (int i = 0; i < item.Links.Count; ++i)
            {
                if (item.Links[i].RelationshipType == Rss20Constants.EnclosureTag)
                {
                    if (firstEnclosureLink == null)
                    {
                        firstEnclosureLink = item.Links[i];
                        WriteMediaEnclosure(writer, item.Links[i], item.BaseUri);
                        continue;
                    }
                }
                else if (item.Links[i].RelationshipType == Atom10Constants.AlternateTag)
                {
                    if (!passedFirstAlternateLink)
                    {
                        passedFirstAlternateLink = true;
                        continue;
                    }
                }
                if (this.serializeExtensionsAsAtom)
                {
                    this.atomSerializer.WriteLink(writer, item.Links[i], item.BaseUri);
                }
                else
                {
                    isLinkIgnored = true;
                }
            }
            if (isLinkIgnored)
            {
                TraceExtensionsIgnoredOnWrite(SR.ItemLinksIgnoredOnWrite);
            }

            if (item.LastUpdatedTime > DateTimeOffset.MinValue)
            {
                if (this.serializeExtensionsAsAtom)
                {
                    this.atomSerializer.WriteItemLastUpdatedTimeTo(writer, item.LastUpdatedTime);
                }
                else
                {
                    TraceExtensionsIgnoredOnWrite(SR.ItemLastUpdatedTimeIgnoredOnWrite);
                }
            }

            if (serializeExtensionsAsAtom)
            {
                this.atomSerializer.WriteContentTo(writer, Atom10Constants.RightsTag, item.Copyright);
            }
            else
            {
                TraceExtensionsIgnoredOnWrite(SR.ItemCopyrightIgnoredOnWrite);
            }

            if (!serializedContentAsDescription)
            {
                if (serializeExtensionsAsAtom)
                {
                    this.atomSerializer.WriteContentTo(writer, Atom10Constants.ContentTag, item.Content);
                }
                else
                {
                    TraceExtensionsIgnoredOnWrite(SR.ItemContentIgnoredOnWrite);
                }
            }

#pragma warning disable 56506 // Microsoft, item.COntributors is never null
            if (item.Contributors.Count > 0)
#pragma warning restore 56506
            {
                if (serializeExtensionsAsAtom)
                {
                    this.atomSerializer.WriteItemContributorsTo(writer, item.Contributors);
                }
                else
                {
                    TraceExtensionsIgnoredOnWrite(SR.ItemContributorsIgnoredOnWrite);
                }
            }

            WriteElementExtensions(writer, item, this.Version);
        }
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable<CategoriesDocument> categories, bool allowsNewEntries)
 {
 }