private ArrayList _roots; //DirectoryInfo

        #endregion Fields

        #region Constructors

        public Cataloger(setupUIforCatalog _setupUI, updateUIforCatalog _updateUI)
        {
            roots = new ArrayList();
            groups = new ArrayList();
            setupUI = _setupUI;
            updateUI = _updateUI;
            resourcesIndex = new InvertedIndex();
        }
Ejemplo n.º 2
0
        private void setupCataloger()
        {
            ArrayList rings = ringManager.rings;

            //setup callback routines for the cataloger progress bar
            setupUIforCatalog UIsetupHandler = new setupUIforCatalog(
                ClientUserInterface.UI.setupCatalogUIHandler);
            updateUIforCatalog UIupdateHandler = new updateUIforCatalog(
                ClientUserInterface.UI.updateCatalogUIHandler);

            foreach (Ring ring in rings)
            {
                RingInfo ringInfo = RingInfo.findRingInfoByID(User.getInstance().ringsInfo, ring.ringID);
                ringInfo.cataloger = new Cataloger(UIsetupHandler, UIupdateHandler);

                //REVISIT: need to read configuration file to apply correct resource groups to each ring
                ringInfo.cataloger.groups.AddRange(ring.group);

                ringInfo.cataloger.roots.Add(new DirectoryInfo(@"C:\Documents and Settings\beghbali\My Documents\General\Friends"));
                //ringInfo.cataloger.roots.Add(new DirectoryInfo(@"C:\Documents and Settings\beghbali\My Documents\My Music"));
                ringInfo.cataloger.roots.Add(new DirectoryInfo(@"C:\Documents and Settings\beghbali\Desktop\Downloads\Software Downloads"));

                //REVISIT: do catalog leaking, namely check to see if any of the roots of rings are subset of another, You
                //probably wnat one cataloger that walks the list of roots and each entry has a list of rings that need the
                //resources from that root (you need to calculate this as subsets) and will update the corresponding rings'
                //catalogers. This should be done via chain delegates (LIST registries).
                ringInfo.cataloger.catalog();

                //pick up the calculated IE
                ringInfo.IE = ringInfo.cataloger.calculatedIE;

                object[] callbackArgs = new Object[1];
                callbackArgs[0] = ringInfo;
                ClientUserInterface.clientUserInterfaceInstance.Invoke(
                    clientUserInterfaceCallbackTable.showCatalog, callbackArgs);
            }
        }