Ejemplo n.º 1
0
 public SmartFolderNodeBase(LocalFeedsFeed itemStore, string text, int imageIndex, int selectedImageIndex,
                            ContextMenu menu) :
     base(text, FeedNodeType.SmartFolder, false, imageIndex, selectedImageIndex)
 {
     p_popup   = menu;
     itemsFeed = itemStore;
 }
Ejemplo n.º 2
0
 public FinderNode(string text, int imageIndex, int selectedImageIndex, ContextMenuStrip menu) :
     base(text, FeedNodeType.Finder, true, imageIndex, selectedImageIndex)
 {
     itemsFeed = new LocalFeedsFeed(null,
                                    "http://localhost/rssbandit/searchfolder?id=" + Guid.NewGuid(),
                                    text, String.Empty, false);
     _popup = menu;
 }
Ejemplo n.º 3
0
 public UnreadItemsNodePerSource(FeedSourceEntry entry, LocalFeedsFeed itemStore, int imageIndex, int selectedImageIndex, ContextMenuStrip menu) :
     base(itemStore, entry.Name, imageIndex, selectedImageIndex, menu)
 {
     base.ColumnLayout = entry.UnreadItemsColumnLayoutId;
     Text     = entry.Name;
     _entryId = entry.ID;
     DataKey  = itemStore.link + "#" + _entryId;
 }
Ejemplo n.º 4
0
        public UnreadItemsNode(LocalFeedsFeed itemStore, int imageIndex, int selectedImageIndex, ContextMenuStrip menu) :
            base(itemStore, imageIndex, selectedImageIndex, menu)
        {
            // TODO: we should extend the interface ICoreApplication
            app = (RssBanditApplication)IoC.Resolve <ICoreApplication>();

            app.FeedSourceAdded   += app_FeedSourceAdded;
            app.FeedSourceChanged += app_FeedSourceChanged;
            app.FeedSourceDeleted += app_FeedSourceDeleted;

            if (app.FeedSources.Count > 1)
            {
                foreach (FeedSourceEntry e in app.FeedSources.Sources)
                {
                    UnreadItemsNodePerSource child = new UnreadItemsNodePerSource(
                        e, itemStore, imageIndex, selectedImageIndex, menu);
                    this.Nodes.Add(child);
                    childrenBySourceID.Add(e.ID, child);
                }
            }
        }
        /// <summary>
        /// Synchronizes the current state of RSS Bandit from the data in the stream.
        /// </summary>
        /// <param name="stream">The data to synchronize RSS Bandit from</param>
        /// <param name="syncFormat">The synchronization format used</param>
        public void Synchronize(Stream stream, SynchronizationFormat syncFormat)
        {
            /* we support both old version's subscriptions.xml and feedlist.xml */

            string feedsources          = Path.GetFileName(RssBanditApplication.GetFeedSourcesFileName());
            string subscriptionsOld     = Path.GetFileName(RssBanditApplication.OldVersionSupport.GetSubscriptionsFileName());
            string feedlistOld          = Path.GetFileName(RssBanditApplication.OldVersionSupport.GetFeedListFileName());
            string flaggeditems         = Path.GetFileName(RssBanditApplication.GetFlagItemsFileName());
            string searchfolders        = Path.GetFileName(RssBanditApplication.GetSearchFolderFileName());
            string sentitems            = Path.GetFileName(RssBanditApplication.GetSentItemsFileName());
            string watcheditems         = Path.GetFileName(RssBanditApplication.GetWatchedItemsFileName());
            bool   subscriptionsXmlSeen = false;


            if (syncFormat == SynchronizationFormat.Zip)
            {
                ZipInputStream zis = new ZipInputStream(stream);

                ZipEntry theEntry;
                while ((theEntry = zis.GetNextEntry()) != null)
                {
                    if (theEntry.Name == feedsources)
                    {
                        rssBanditApp.FeedSources.LoadFeedSources(zis);
                    }
                    else if (!subscriptionsXmlSeen && (theEntry.Name == subscriptionsOld))
                    {
                        subscriptionsXmlSeen = true;
                        rssBanditApp.BanditFeedSource.ReplaceFeedlist(zis);
                    }
                    else if (!subscriptionsXmlSeen && (theEntry.Name == feedlistOld))
                    {
                        rssBanditApp.BanditFeedSource.ReplaceFeedlist(zis);
                    }
                    else if (theEntry.Name == flaggeditems)
                    {
                        LocalFeedsFeed flaggedItemsFeed = rssBanditApp.FlaggedItemsFeed;
                        LocalFeedsFeed lff = new FlaggedItemsFeed(rssBanditApp.BanditFeedSourceEntry, new XmlTextReader(zis));
                        rssBanditApp.ClearFlaggedItems();

                        foreach (NewsItem item in lff.Items)
                        {
                            flaggedItemsFeed.Add(item);
                            rssBanditApp.ReFlagNewsItem(item);
                        }
                    }
                    else if (theEntry.Name == sentitems)
                    {
                        LocalFeedsFeed sentItemsFeed = rssBanditApp.SentItemsFeed;
                        LocalFeedsFeed lff2          = new SentItemsFeed(rssBanditApp.BanditFeedSourceEntry, new XmlTextReader(zis));

                        sentItemsFeed.Add(lff2);
                    }
                    else if (theEntry.Name == watcheditems)
                    {
                        LocalFeedsFeed watchedItemsFeed = rssBanditApp.WatchedItemsFeed;
                        LocalFeedsFeed lff2             = new WatchedItemsFeed(rssBanditApp.BanditFeedSourceEntry, new XmlTextReader(zis));

                        watchedItemsFeed.Add(lff2);
                    }
                    else if (theEntry.Name == searchfolders)
                    {
                        XmlSerializer ser = XmlHelper.SerializerCache.GetSerializer(typeof(FinderSearchNodes));
                        rssBanditApp.FindersSearchRoot = (FinderSearchNodes)ser.Deserialize(zis);
                    }
                    else
                    {
                        // set files managed by Bandit data storage:
                        IUserRoamingDataService dataService = IoC.Resolve <IUserRoamingDataService>();
                        if (dataService != null)
                        {
                            if (DataEntityName.None != dataService.SetContentForDataFile(theEntry.Name, zis))
                            {
                                continue;                                 // was handled here
                            }
                        }

                        // remaining: set files managed by NewComponents feed source data storage:
                        bool handled = false;
                        rssBanditApp.FeedSources.ForEach(
                            f =>
                        {
                            if (!handled && f.SetContentForDataServiceFile(theEntry.Name, zis))
                            {
                                handled = true;
                            }
                        });

                        if (handled)
                        {
                            continue;
                        }

                        rssBanditApp.FeedSources.ForEach(
                            f =>
                        {
                            if (!handled && f.SubscriptionLocation.Location.EndsWith(theEntry.Name, StringComparison.OrdinalIgnoreCase))
                            {
                                if (f.Type == FeedSourceType.DirectAccess)
                                {
                                    subscriptionsXmlSeen = true;                                                // do not import/replace from older subscription version files
                                }
                                f.ReplaceFeedlist(zis);
                                handled = true;
                            }
                        });
                    }
                } //while

                zis.Close();
            } //if(syncFormat == SynchronizationFormat.Zip
        }
Ejemplo n.º 6
0
 public SmartFolderNodeBase(LocalFeedsFeed itemStore, int imageIndex, int selectedImageIndex, ContextMenu menu) :
     this(itemStore, itemStore.title, imageIndex, selectedImageIndex, menu)
 {
 }
Ejemplo n.º 7
0
 protected UnreadItemsNode(LocalFeedsFeed itemStore, string text, int imageIndex, int selectedImageIndex, ContextMenuStrip menu) :
     base(itemStore, text, imageIndex, selectedImageIndex, menu)
 {
 }
Ejemplo n.º 8
0
 public FlaggedItemsNode(Flagged flag, LocalFeedsFeed itemStore, string text, int imageIndex,
                         int selectedImageIndex, ContextMenuStrip menu) :
     base(itemStore, text, imageIndex, selectedImageIndex, menu)
 {
     flagsFiltered = flag;
 }
Ejemplo n.º 9
0
 public WatchedItemsNode(LocalFeedsFeed itemStore, int imageIndex, int selectedImageIndex, ContextMenuStrip menu) :
     base(itemStore, imageIndex, selectedImageIndex, menu)
 {
 }
 public SentItemsNode(LocalFeedsFeed itemStore, int imageIndex, int selectedImageIndex, ContextMenu menu) :
     base(itemStore, imageIndex, selectedImageIndex, menu)
 {
 }
 public WasteBasketNode(LocalFeedsFeed itemStore, int imageIndex, int selectedImageIndex, ContextMenu menu) :
     base(itemStore, imageIndex, selectedImageIndex, menu)
 {
 }