Пример #1
0
 public void RemoveUserFeed(Feed oldFeed)
 {
     m_feeds.Remove(oldFeed);
 }
Пример #2
0
        public void LoadUser()
        {
            if (Username == null)
            {
                return;
            }

            string     filename = Username + ".xml";
            FileStream fs       = new FileStream(filename, FileMode.Open, FileAccess.Read);

            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(fs);
            }
            catch (XmlException)
            {
                return;
            }

            XmlElement  root  = doc.DocumentElement;
            XmlNodeList feeds = root.GetElementsByTagName("Feed");

            foreach (XmlNode feed in feeds)
            {
                XmlNodeList feedAttributes = feed.ChildNodes;
                string      url            = feedAttributes.Item(2).InnerText;
                //XmlNode url = feed.SelectSingleNode("//Link");

                if (url != null)
                {
                    Feed.Add(new Feed(url));
                }
            }

            XmlNodeList topics = root.GetElementsByTagName("Topic");

            foreach (XmlNode topic in topics)
            {
                XmlNodeList topicAttributes = topic.ChildNodes;

                //A topic might exist with no keywords or have keywords, so both situations need to load
                if (0 < topicAttributes.Count)
                {
                    //Had to use the namespace due to a property name conflict
                    MapRss.Topic topicAdd = new MapRss.Topic(topicAttributes.Item(0).InnerText);

                    if (1 < topicAttributes.Count)
                    {
                        for (int i = 1; i < topicAttributes.Count; i++)
                        {
                            topicAdd.Keyword.Add(topicAttributes.Item(i).InnerText);
                        }
                    }

                    Topic.Add(topicAdd);
                }
            }

            fs.Close();
        }
Пример #3
0
 //user functions
 public void AddUserFeed(Feed newFeed)
 {
     m_feeds.Add(newFeed);
 }