Пример #1
0
        public RssItem(IFeedItem source)
        {
            // ** IFeedMetadata

            // ID
            _guid = new RssGuid
            {
                Value = source.ID.ToString()
            };

            // Title
            string title = source.Title;

            if (!string.IsNullOrWhiteSpace(title))
            {
                Title = title;
            }

            // Description
            string description = source.Description;

            if (!string.IsNullOrEmpty(description))
            {
                Description = description;
            }

            // Author
            string author = source.Author;

            if (!string.IsNullOrEmpty(author))
            {
                Author = new RssPerson
                {
                    Name = author
                };
            }

            // Published
            DateTime?published = source.Published;

            if (published.HasValue)
            {
                PubDate = new RssDate(published.Value);
            }

            // Updated
            DateTime?updated = source.Updated;

            if (updated.HasValue)
            {
                PubDate = new RssDate(updated.Value);
            }

            // Link
            Uri link = source.Link;

            if (link != null)
            {
                Link = link.ToString();
            }

            // ImageLink
            Uri imageLink = source.ImageLink;

            if (imageLink != null)
            {
                _enclosure = new RssEnclosure
                {
                    Url  = imageLink.ToString(),
                    Type = "image"
                };
            }

            // ** IFeedItem

            // Content
            string content = source.Content;

            if (!string.IsNullOrEmpty(content))
            {
                ContentEncoded = content;
            }

            // ThreadLink
            Uri threadLink = source.ThreadLink;

            if (threadLink != null)
            {
                _wfwCommentRss = threadLink;
            }

            // ThreadCount
            int?threadCount = source.ThreadCount;

            if (threadCount.HasValue)
            {
                SlashComments = threadCount.Value;
            }

            // ThreadUpdated
            // Not in RDF
        }
Пример #2
0
	    public RssItem(IFeedItem source)
	    {

            // ** IFeedMetadata

            // ID
            _guid = new RssGuid
            {
                Value = source.ID.ToString()
            };

            // Title
            string title = source.Title;
            if (!string.IsNullOrWhiteSpace(title))
            {
                Title = title;
            }

            // Description
            string description = source.Description;
            if (!string.IsNullOrEmpty(description))
            {
                Description = description;
            }

            // Author
            string author = source.Author;
            if (!string.IsNullOrEmpty(author))
            {
                Author = new RssPerson
                {
                    Name = author
                };
            }

            // Published
            DateTime? published = source.Published;
            if (published.HasValue)
            {
                PubDate = new RssDate(published.Value);
            }

            // Updated
            DateTime? updated = source.Updated;
            if (updated.HasValue)
            {
                PubDate = new RssDate(updated.Value);
            }

            // Link
            Uri link = source.Link;
            if (link != null)
            {
                Link = link.ToString();
            }

            // ImageLink
	        Uri imageLink = source.ImageLink;
	        if (imageLink != null)
	        {
	            _enclosure = new RssEnclosure
	            {
	                Url = imageLink.ToString(),
	                Type = "image"
	            };
	        }

            // ** IFeedItem

            // Content
            string content = source.Content;
            if (!string.IsNullOrEmpty(content))
            {
                ContentEncoded = content;
            }

            // ThreadLink
            Uri threadLink = source.ThreadLink;
            if (threadLink != null)
            {
                _wfwCommentRss = threadLink;
            }

            // ThreadCount
            int? threadCount = source.ThreadCount;
            if (threadCount.HasValue)
            {
                SlashComments = threadCount.Value;
            }

            // ThreadUpdated
            // Not in RDF
        }