Example #1
0
 public void AddToDefaultInventory(InventoryFolderImpl folder)
 {
     foreach (InventoryFolderImpl f in folder.RequestListOfFolderImpls())
     {
         m_LibraryRootFolder.AddChildFolder(f);
     }
     foreach (InventoryItemBase i in folder.RequestListOfItems())
     {
         m_LibraryRootFolder.Items.Add(i.ID, i);
     }
 }
//        private void DumpLibrary()
//        {
//            InventoryFolderImpl lib = m_Library.LibraryRootFolder;
//
//            m_log.DebugFormat(" - folder {0}", lib.Name);
//            DumpFolder(lib);
//        }
//
//        private void DumpLibrary()
//        {
//            InventoryFolderImpl lib = m_Scene.CommsManager.UserProfileCacheService.LibraryRoot;
//
//            m_log.DebugFormat(" - folder {0}", lib.Name);
//            DumpFolder(lib);
//        }

        private void DumpFolder(InventoryFolderImpl folder)
        {
            foreach (InventoryItemBase item in folder.Items.Values)
            {
                m_log.DebugFormat("   --> item {0}", item.Name);
            }
            foreach (InventoryFolderImpl f in folder.RequestListOfFolderImpls())
            {
                m_log.DebugFormat(" - folder {0}", f.Name);
                DumpFolder(f);
            }
        }
        private List <InventoryFolderImpl> TraverseFolder(InventoryFolderImpl node)
        {
            List <InventoryFolderImpl> folders = node.RequestListOfFolderImpls();
            List <InventoryFolderImpl> subs    = new List <InventoryFolderImpl>();

            foreach (InventoryFolderImpl f in folders)
            {
                subs.AddRange(TraverseFolder(f));
            }

            folders.AddRange(subs);
            return(folders);
        }
Example #4
0
        /// <summary>
        /// Save an inventory folder
        /// </summary>
        /// <param name="inventoryFolder">The inventory folder to save</param>
        /// <param name="path">The path to which the folder should be saved</param>
        /// <param name="saveThisFolderItself">If true, save this folder itself.  If false, only saves contents</param>
        protected void SaveInvFolder(InventoryFolderImpl inventoryFolder, string path, bool saveThisFolderItself)
        {
            if (saveThisFolderItself)
            {
                path +=
                    string.Format(
                        "{0}{1}{2}/",
                        inventoryFolder.Name,
                        ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
                        inventoryFolder.ID);

                // We need to make sure that we record empty folders
                m_archiveWriter.WriteDir(path);
            }

            List <InventoryFolderImpl> childFolders = inventoryFolder.RequestListOfFolderImpls();
            List <InventoryItemBase>   items        = inventoryFolder.RequestListOfItems();

            /*
             * Dictionary identicalFolderNames = new Dictionary<string, int>();
             *
             * foreach (InventoryFolderImpl folder in inventories)
             * {
             *
             *  if (!identicalFolderNames.ContainsKey(folder.Name))
             *      identicalFolderNames[folder.Name] = 0;
             *  else
             *      identicalFolderNames[folder.Name] = identicalFolderNames[folder.Name]++;
             *
             *  int folderNameNumber = identicalFolderName[folder.Name];
             *
             *  SaveInvDir(
             *      folder,
             *      string.Format(
             *          "{0}{1}{2}/",
             *          path, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, folderNameNumber));
             * }
             */

            foreach (InventoryFolderImpl childFolder in childFolders)
            {
                SaveInvFolder(childFolder, path, true);
            }

            foreach (InventoryItemBase item in items)
            {
                SaveInvItem(item, path);
            }
        }
Example #5
0
        /// <summary>
        /// Add the folders to the user's inventory
        /// </summary>
        /// <param name="m_MockScene"></param>
        /// <param name="folder"></param>
        private void BuildInventoryFolder(Scene m_MockScene, InventoryFolderImpl folder)
        {
            InventoryFolderBase folderBase = new InventoryFolderBase();

            folderBase.ID       = folder.ID;
            folderBase.Name     = folder.Name;
            folderBase.Owner    = folder.Owner;
            folderBase.ParentID = folder.ParentID;
            folderBase.Type     = folder.Type;
            folderBase.Version  = folder.Version;

            m_MockScene.InventoryService.AddFolder(folderBase);
            foreach (InventoryFolderImpl childFolder in folder.RequestListOfFolderImpls())
            {
                BuildInventoryFolder(m_MockScene, childFolder);
            }

            foreach (InventoryItemBase item in folder.RequestListOfItems())
            {
                m_MockScene.InventoryService.AddItem(item);
            }
        }