コード例 #1
0
        /// <summary>
        /// Loads the <c>FeedEntries</c> collection from the data retreived in the feed.
        /// </summary>
        private void loadFeedEntries()
        {
            XmlNamespaceManager nsm = new XmlNamespaceManager(_feedXml.NameTable);

            nsm.AddNamespace("atom", "http://purl.org/atom/ns#");

            _title    = _feedXml.SelectSingleNode("/atom:feed/atom:title", nsm).InnerText;
            _message  = _feedXml.SelectSingleNode("/atom:feed/atom:tagline", nsm).InnerText;
            _modified = DateTime.Parse(_feedXml.SelectSingleNode("/atom:feed/atom:modified", nsm).InnerText);

            int    nodeCount = _feedXml.SelectNodes("//atom:entry", nsm).Count;
            string baseXPath = string.Empty;

            _entryCol.Clear();

            for (int i = 1; i <= nodeCount; i++)
            {
                baseXPath = "/atom:feed/atom:entry[position()=" + i.ToString() + "]/atom:";

                AtomFeedEntry atomEntry = new AtomFeedEntry(
                    _feedXml.SelectSingleNode(baseXPath + "title", nsm).InnerText,
                    _feedXml.SelectSingleNode(baseXPath + "summary", nsm).InnerText,
                    _feedXml.SelectSingleNode(baseXPath + "author/atom:name", nsm).InnerText,
                    _feedXml.SelectSingleNode(baseXPath + "author/atom:email", nsm).InnerText,
                    _feedXml.SelectSingleNode(baseXPath + "id", nsm).InnerText,
                    DateTime.Parse(_feedXml.SelectSingleNode(baseXPath + "issued", nsm).InnerText));

                _entryCol.Add(atomEntry);
            }
        }
コード例 #2
0
ファイル: GmailAtomFeed.cs プロジェクト: cupid0426/MyProject
        /// <summary>
        /// Loads the <c>FeedEntries</c> collection to the data retreived in the feed.
        /// </summary>
        private void loadFeedEntries()
        {
            XmlNamespaceManager nsm = new XmlNamespaceManager(_feedXml.NameTable);

            nsm.AddNamespace("atom", "http://purl.org/atom/ns#");

            _title    = _feedXml.SelectSingleNode("/atom:feed/atom:title", nsm).InnerText;
            _message  = _feedXml.SelectSingleNode("/atom:feed/atom:tagline", nsm).InnerText;
            _modified = DateTime.Parse(_feedXml.SelectSingleNode("/atom:feed/atom:modified", nsm).InnerText.Replace("T24:", "T00:"));



            int    nodeCount = _feedXml.SelectNodes("//atom:entry", nsm).Count;
            string baseXPath = string.Empty;

            _entryCol.Clear();

            for (int i = 1; i <= nodeCount; i++)
            {
                baseXPath = "/atom:feed/atom:entry[position()=" + i.ToString() + "]/atom:";
                string subject   = _feedXml.SelectSingleNode(baseXPath + "title", nsm).InnerText;
                string summary   = _feedXml.SelectSingleNode(baseXPath + "summary", nsm).InnerText;
                string fromName  = string.Empty;
                string fromEmail = string.Empty;
                try
                {
                    fromName  = _feedXml.SelectSingleNode(baseXPath + "author/atom:name", nsm).InnerText;
                    fromEmail = _feedXml.SelectSingleNode(baseXPath + "author/atom:email", nsm).InnerText;
                }
                catch
                {
                }
                string   id       = _feedXml.SelectSingleNode(baseXPath + "id", nsm).InnerText.Split(':')[2];
                DateTime received = DateTime.Now;
                DateTime.TryParse(_feedXml.SelectSingleNode(baseXPath + "issued", nsm).InnerText.Replace("T24:", "T00:"), out received);
                AtomFeedEntry atomEntry = new AtomFeedEntry(subject, summary, fromName, fromEmail, id, received);
                _entryCol.Add(atomEntry);
            }
        }
コード例 #3
0
ファイル: GmailAtomFeed.cs プロジェクト: cupid0426/MyProject
 /// <summary>
 /// Removes an <c>AtomFeedEntry</c> to the collection
 /// </summary>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to be removed</param>
 public void Remove(AtomFeedEntry feedEntry)
 {
     this.List.Remove(feedEntry);
 }
コード例 #4
0
ファイル: GmailAtomFeed.cs プロジェクト: cupid0426/MyProject
 /// <summary>
 /// Inserts an <c>AtomFeedEntry</c> at the specified position
 /// </summary>
 /// <param name="index">Position to insert at</param>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to insert</param>
 public void Insert(int index, AtomFeedEntry feedEntry)
 {
     this.List.Insert(index, feedEntry);
 }
コード例 #5
0
ファイル: GmailAtomFeed.cs プロジェクト: cupid0426/MyProject
 /// <summary>
 /// Returns the position of the first of the <c>AtomFeedEntry</c> object. If it is not found then <c>-1</c> is returned.
 /// </summary>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to find</param>
 /// <returns></returns>
 public int IndexOf(AtomFeedEntry feedEntry)
 {
     return(this.List.IndexOf(feedEntry));
 }
コード例 #6
0
ファイル: GmailAtomFeed.cs プロジェクト: cupid0426/MyProject
 /// <summary>
 /// Returns true if the collection contains the specified object
 /// </summary>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to find</param>
 /// <returns></returns>
 public bool Contains(AtomFeedEntry feedEntry)
 {
     return(this.List.Contains(feedEntry));
 }
コード例 #7
0
ファイル: GmailAtomFeed.cs プロジェクト: cupid0426/MyProject
 /// <summary>
 /// Adds an <c>AtomFeedEntry</c> object to the collection
 /// </summary>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to add</param>
 public void Add(AtomFeedEntry feedEntry)
 {
     this.List.Add(feedEntry);
 }
コード例 #8
0
 /// <summary>
 /// Removes an <c>AtomFeedEntry</c> from the collection
 /// </summary>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to be removed</param>
 public void Remove(AtomFeedEntry feedEntry)
 {
     this.List.Remove(feedEntry);
 }
コード例 #9
0
 /// <summary>
 /// Inserts an <c>AtomFeedEntry</c> at the specified position
 /// </summary>
 /// <param name="index">Position to insert at</param>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to insert</param>
 public void Insert(int index, AtomFeedEntry feedEntry)
 {
     this.List.Insert(index, feedEntry);
 }
コード例 #10
0
 /// <summary>
 /// Returns the position of the first of the <c>AtomFeedEntry</c> object. If it is not found then <c>-1</c> is returned.
 /// </summary>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to find</param>
 /// <returns></returns>
 public int IndexOf(AtomFeedEntry feedEntry)
 {
     return this.List.IndexOf(feedEntry);
 }
コード例 #11
0
 /// <summary>
 /// Returns true if the collection contains the specified object
 /// </summary>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to find</param>
 /// <returns></returns>
 public bool Contains(AtomFeedEntry feedEntry)
 {
     return this.List.Contains(feedEntry);
 }
コード例 #12
0
 /// <summary>
 /// Adds an <c>AtomFeedEntry</c> object to the collection
 /// </summary>
 /// <param name="feedEntry"><c>AtomFeedEntry</c> to add</param>
 public void Add(AtomFeedEntry feedEntry)
 {
     this.List.Add(feedEntry);
 }
コード例 #13
0
        /// <summary>
        /// Loads the <c>FeedEntries</c> collection from the data retreived in the feed.
        /// </summary>
        private void loadFeedEntries()
        {
            XmlNamespaceManager nsm = new XmlNamespaceManager(_feedXml.NameTable);
            nsm.AddNamespace("atom", "http://purl.org/atom/ns#");

            _title = _feedXml.SelectSingleNode("/atom:feed/atom:title", nsm).InnerText;
            _message = _feedXml.SelectSingleNode("/atom:feed/atom:tagline", nsm).InnerText;
            _modified = DateTime.Parse(_feedXml.SelectSingleNode("/atom:feed/atom:modified", nsm).InnerText);

            int nodeCount = _feedXml.SelectNodes("//atom:entry", nsm).Count;
            string baseXPath = string.Empty;
            _entryCol.Clear();

            for(int i = 1; i <= nodeCount; i++)
            {
                baseXPath = "/atom:feed/atom:entry[position()=" + i.ToString() + "]/atom:";

                AtomFeedEntry atomEntry = new AtomFeedEntry(
                    _feedXml.SelectSingleNode(baseXPath + "title", nsm).InnerText,
                    _feedXml.SelectSingleNode(baseXPath + "summary", nsm).InnerText,
                    _feedXml.SelectSingleNode(baseXPath + "author/atom:name", nsm).InnerText,
                    _feedXml.SelectSingleNode(baseXPath + "author/atom:email", nsm).InnerText,
                    _feedXml.SelectSingleNode(baseXPath + "id", nsm).InnerText,
                    _feedXml.SelectSingleNode(baseXPath + "link", nsm).Attributes.GetNamedItem("href").Value,
                    DateTime.Parse(_feedXml.SelectSingleNode(baseXPath + "issued", nsm).InnerText));

                _entryCol.Add(atomEntry);

            }
        }