コード例 #1
0
ファイル: SyndicationItem.cs プロジェクト: code4clouds/corefx
 protected SyndicationItem(SyndicationItem source)
 {
     if (source == null)
     {
         throw new ArgumentNullException(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);
 }
コード例 #2
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);
         }
     }
 }
コード例 #3
0
ファイル: FeedUtils.cs プロジェクト: code4clouds/corefx
 static internal TextSyndicationContent CloneTextContent(TextSyndicationContent content)
 {
     if (content == null)
     {
         return(null);
     }
     return((TextSyndicationContent)(content.Clone()));
 }
コード例 #4
0
 protected TextSyndicationContent(TextSyndicationContent source)
     : base(source)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     _text     = source._text;
     _textKind = source._textKind;
 }
コード例 #5
0
ファイル: Workspace.cs プロジェクト: code4clouds/corefx
 public Workspace(TextSyndicationContent title, IEnumerable <ResourceCollectionInfo> collections)
 {
     _title = title;
     if (collections != null)
     {
         _collections = new NullNotAllowedCollection <ResourceCollectionInfo>();
         foreach (ResourceCollectionInfo collection in collections)
         {
             _collections.Add(collection);
         }
     }
 }
コード例 #6
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;
 }
コード例 #7
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;
            }
        }
コード例 #8
0
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable <CategoriesDocument> categories, bool allowsNewEntries)
     : this(title, link, categories, (allowsNewEntries) ? null : CreateSingleEmptyAccept())
 {
 }
コード例 #9
0
 public ResourceCollectionInfo(TextSyndicationContent title, Uri link)
     : this(title, link, null, null)
 {
 }