/// <summary>takes the updated entry returned and sets the properties to this object</summary>
        /// <param name="updatedEntry"> </param>
        protected void CopyEntry(AtomEntry updatedEntry)
        {
            Tracing.Assert(updatedEntry != null, "updatedEntry should not be null");
            if (updatedEntry == null)
            {
                throw new ArgumentNullException("updatedEntry");
            }

            this.title           = updatedEntry.Title;
            this.authors         = updatedEntry.Authors;
            this.id              = updatedEntry.Id;
            this.links           = updatedEntry.Links;
            this.lastUpdateDate  = updatedEntry.Updated;
            this.publicationDate = updatedEntry.Published;
            this.authors         = updatedEntry.Authors;
            this.rights          = updatedEntry.Rights;
            this.categories      = updatedEntry.Categories;
            this.summary         = updatedEntry.Summary;
            this.content         = updatedEntry.Content;
            this.source          = updatedEntry.Source;

            this.ExtensionElements.Clear();

            foreach (IExtensionElementFactory extension in updatedEntry.ExtensionElements)
            {
                this.ExtensionElements.Add(extension);
            }
        }
Exemple #2
0
        public void printContentFeed(AtomFeed feed)
        {
            if (feed.Entries.Count == 0)
            {
                Console.WriteLine("No matching content found.");
            }

            foreach (AtomEntry entry in feed.Entries)
            {
                String pageType = getCategoryLabel(entry.Categories);
                Console.WriteLine(String.Format("Page: {0} ({1})", entry.Title.Text, pageType));
                Console.WriteLine(String.Format("  link: {0}", entry.AlternateUri));
                AtomPersonCollection authors = entry.Authors;
                foreach (AtomPerson author in authors)
                {
                    Console.WriteLine(String.Format("\tauthor: {0} - {1}", author.Name, author.Email));
                }
                String pageContent = entry.Content.Content;
                Console.WriteLine(String.Format("  html: {0}...", pageContent));
            }
        }
        /////////////////////////////////////////////////////////////////////////////


        //////////////////////////////////////////////////////////////////////
        /// <summary>public static bool IsPersonCollectionIdentical(AtomPersonCollection theOne, AtomPersonCollection theOther)</summary>
        /// <param name="theOne">the One Collection </param>
        /// <param name="theOther">the Other Collection </param>
        /// <returns>true if identical </returns>
        //////////////////////////////////////////////////////////////////////
        public static bool IsPersonCollectionIdentical(AtomPersonCollection theOne, AtomPersonCollection theOther)
        {
            if (theOne == null && theOther == null)
            {
                return(true);
            }

            if (theOne.Count != theOther.Count)
            {
                return(false);
            }
            for (int i = 0; i < theOne.Count; i++)
            {
                if (!IsPersonIdentical(theOne[i], theOther[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #4
0
        /////////////////////////////////////////////////////////////////////////////

        //////////////////////////////////////////////////////////////////////
        /// <summary>public AtomSource(AtomFeed feed)</summary>
        //////////////////////////////////////////////////////////////////////
        public AtomSource(AtomFeed feed) : this()
        {
            Tracing.Assert(feed != null, "feed should not be null");
            if (feed == null)
            {
                throw new ArgumentNullException("feed");
            }

            // now copy them
            this.authors      = feed.Authors;
            this.contributors = feed.Contributors;
            this.categories   = feed.Categories;
            this.Generator    = feed.Generator;
            this.Icon         = feed.Icon;
            this.Logo         = feed.Logo;
            this.Id           = feed.Id;
            this.links        = feed.Links;
            this.Rights       = feed.Rights;
            this.Subtitle     = feed.Subtitle;
            this.Title        = feed.Title;
            this.Updated      = feed.Updated;
        }