예제 #1
0
        private static void OnReceiveComplete(IAsyncResult ar)
        {
            FeedAsyncResult  result  = ar as FeedAsyncResult;
            FeedInputChannel channel = result.Channel;

            Feed feed = channel.EndReceive(result);

            if (FeedEngine.FeedReceived != null)
            {
                FeedEngine.FeedReceived(feed);
            }

            if (receivers.Count > 0)
            {
                FeedReceiver receiver = receivers[channel.Destination] as FeedReceiver;
                if (receiver != null)
                {
                    receiver.Receive(feed);
                }
            }

            // Update the storage
            if (Storage != null)
            {
                Storage.Add(feed);
            }
        }
예제 #2
0
        /// <summary>
        /// Subscribes to the RSS feeds supplied in the OPML object.
        /// </summary>
        /// <param name="opml">The Opml object.</param>
        /// <returns>The Opml object.</returns>
        public static Opml SubscribeOpml(Opml opml)
        {
            if (opml == null)
            {
                throw new ArgumentNullException();
            }

            foreach (OpmlItem item in opml.Items)
            {
                FeedEngine.Subscribe(new Uri(item.XmlUrl));
            }

            return(opml);
        }
예제 #3
0
        /// <summary>
        /// Subscribes to the RSS feeds supplied in the OPML file.
        /// </summary>
        /// <param name="opmlPath">The full path to the OPML file.</param>
        /// <returns>The Opml object.</returns>
        public static Opml SubscribeOpml(string opmlPath)
        {
            if (opmlPath == null)
            {
                throw new ArgumentNullException();
            }
            if (opmlPath == string.Empty)
            {
                throw new ArgumentException();
            }

            OpmlParser parser = new OpmlParser();

            Opml opml = parser.Process(opmlPath);

            foreach (OpmlItem item in opml.Items)
            {
                FeedEngine.Subscribe(new Uri(item.XmlUrl));
            }

            return(opml);
        }
예제 #4
0
 public void Dispose()
 {
     FeedEngine.Stop();
     GC.SuppressFinalize(this);
 }
예제 #5
0
        private static void OnReceive(Uri destination)
        {
            FeedReceiver receiver = receivers[destination] as FeedReceiver;

            FeedEngine.Subscribe(destination, receiver);
        }