Esempio n. 1
0
        public void Exec(IResource res, IActionParameterStore actionStore)
        {
            Guard.NullArgument(res, "res");
            Guard.NullArgument(actionStore, "actionStore");
            if (res.Type != "RSSItem")
            {
                throw new ArgumentException("EnclosureDownloadRuleAction was registered for RSSItem only but there resource with type = '" + res.Type + "'");
            }
            Tracer._Trace("Execute rule: EnclosureDownloadRuleAction");

            if (res.HasProp(Props.EnclosureURL))
            {
                EnclosureDownloadManager.PlanToDownload(res);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Queue for download those enclosures of the feed's unread items which
        /// are not yet downloaded or queued.
        /// </summary>
        /// <param name="feed">A feed resource which items are to be analyzed.</param>
        private void ScheduleEnclosures(IResource feed)
        {
            IResourceList items = feed.GetLinksOfType(Props.RSSItemResource, Props.RSSItem);

            items = items.Intersect(Core.ResourceStore.FindResourcesWithProp(Props.RSSItemResource, Core.Props.IsUnread), true);
            items = items.Minus(Core.ResourceStore.FindResourcesWithProp(Props.RSSItemResource, Core.Props.IsDeleted));

            IResourceList itemsWithEncls = Core.ResourceStore.FindResources(null, Props.EnclosureDownloadingState, (int)EnclosureDownloadState.NotDownloaded);

            items = items.Intersect(itemsWithEncls, true);

            foreach (IResource item in items)
            {
                EnclosureDownloadManager.PlanToDownload(item);
            }
        }