Beispiel #1
0
        internal static Collection <SyndicationLink> CloneLinks(Collection <SyndicationLink> links)
        {
            if (links == null)
            {
                return(null);
            }
            Collection <SyndicationLink> result = new NullNotAllowedCollection <SyndicationLink>();

            for (int i = 0; i < links.Count; ++i)
            {
                result.Add(links[i].Clone());
            }
            return(result);
        }
Beispiel #2
0
        internal static Collection <SyndicationPerson> ClonePersons(Collection <SyndicationPerson> persons)
        {
            if (persons == null)
            {
                return(null);
            }
            Collection <SyndicationPerson> result = new NullNotAllowedCollection <SyndicationPerson>();

            for (int i = 0; i < persons.Count; ++i)
            {
                result.Add(persons[i].Clone());
            }
            return(result);
        }
        internal static Collection <SyndicationPerson> ClonePersons(Collection <SyndicationPerson> persons)
        {
            if (persons == null)
            {
                return(null);
            }
            Collection <SyndicationPerson> collection = new NullNotAllowedCollection <SyndicationPerson>();

            for (int i = 0; i < persons.Count; i++)
            {
                collection.Add(persons[i].Clone());
            }
            return(collection);
        }
Beispiel #4
0
        internal static Collection <SyndicationCategory> CloneCategories(Collection <SyndicationCategory> categories)
        {
            if (categories == null)
            {
                return(null);
            }
            Collection <SyndicationCategory> result = new NullNotAllowedCollection <SyndicationCategory>();

            for (int i = 0; i < categories.Count; ++i)
            {
                result.Add(categories[i].Clone());
            }
            return(result);
        }
        internal static Collection <SyndicationLink> CloneLinks(Collection <SyndicationLink> links)
        {
            if (links == null)
            {
                return(null);
            }
            Collection <SyndicationLink> collection = new NullNotAllowedCollection <SyndicationLink>();

            for (int i = 0; i < links.Count; i++)
            {
                collection.Add(links[i].Clone());
            }
            return(collection);
        }
        internal static Collection <SyndicationCategory> CloneCategories(Collection <SyndicationCategory> categories)
        {
            if (categories == null)
            {
                return(null);
            }
            Collection <SyndicationCategory> collection = new NullNotAllowedCollection <SyndicationCategory>();

            for (int i = 0; i < categories.Count; i++)
            {
                collection.Add(categories[i].Clone());
            }
            return(collection);
        }
Beispiel #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;
            }
        }
        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;
            }
        }