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);
 }
        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);
        }
Beispiel #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);
 }
Beispiel #4
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;
            }
        }
        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;
            }
        }