public bool DearchiveInventory(
            string firstName, string lastName, string invPath, string loadPath,
            Dictionary <string, object> options)
        {
            UserAccount userInfo = m_registry.RequestModuleInterface <IUserAccountService>()
                                   .GetUserAccount(null, firstName, lastName);

            if (userInfo != null)
            {
                InventoryArchiveReadRequest request;
                bool merge = (options.ContainsKey("merge") && (bool)options["merge"]);

                try
                {
                    request = new InventoryArchiveReadRequest(m_registry, userInfo, invPath, loadPath, merge, UUID.Zero);
                }
                catch (EntryPointNotFoundException e)
                {
                    MainConsole.Instance.ErrorFormat(
                        "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream.\n"
                        + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                    MainConsole.Instance.Error(e);

                    return(false);
                }

                var loadArchive = request.Execute(false);
                if (loadArchive == null)
                {
                    return(false);
                }

                return(true);
            }

            return(false);
        }
        public bool DearchiveInventory(
            string firstName, string lastName, string invPath, string loadPath,
            Dictionary<string, object> options)
        {
            UserAccount userInfo = m_registry.RequestModuleInterface<IUserAccountService>()
                                             .GetUserAccount(null, firstName, lastName);

            if (userInfo != null)
            {
                InventoryArchiveReadRequest request;
                bool merge = (options.ContainsKey("merge") && (bool) options["merge"]);

                try
                {
                    request = new InventoryArchiveReadRequest(m_registry, userInfo, invPath, loadPath, merge, UUID.Zero);
                }
                catch (EntryPointNotFoundException e)
                {
                    MainConsole.Instance.ErrorFormat(
                        "[Archiver]: Mismatch between Mono and zlib1g library version when trying to create compression stream.\n"
                        + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                    MainConsole.Instance.Error(e);

                    return false;
                }

                var loadArchive = request.Execute(false);
                if (loadArchive == null)                         // nothing loaded ??
                    return false;

                return true;
            }

            return false;
        }
        /// <summary>
        ///     Use the asset set information at path to load assets
        /// </summary>
        /// <param name="iarFileName"></param>
        protected void LoadLibraries(string iarFileName)
        {
            RegionInfo regInfo = new RegionInfo();
            IScene m_MockScene = null;
            //Make the scene for the IAR loader
            if (m_registry is IScene)
                m_MockScene = (IScene) m_registry;
            else
            {
                m_MockScene = new Scene();
                m_MockScene.Initialize(regInfo);
                m_MockScene.AddModuleInterfaces(m_registry.GetInterfaces());
            }

            UserAccount uinfo = m_MockScene.UserAccountService.GetUserAccount(null, m_service.LibraryOwner);
            //Make the user account for the default IAR
            if (uinfo == null)
            {
                MainConsole.Instance.Warn("Creating user " + m_service.LibraryOwnerName);
                m_MockScene.UserAccountService.CreateUser(m_service.LibraryOwner, UUID.Zero, m_service.LibraryOwnerName,
                                                          "", "");
                uinfo = m_MockScene.UserAccountService.GetUserAccount(null, m_service.LibraryOwner);
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false);
            }
            if (m_MockScene.InventoryService.GetRootFolder(m_service.LibraryOwner) == null)
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false);

            List<InventoryFolderBase> rootFolders = m_MockScene.InventoryService.GetFolderFolders(uinfo.PrincipalID,
                                                                                                  UUID.Zero);
            bool alreadyExists = rootFolders.Any(folder => folder.Name == iarFileName);

            if (alreadyExists)
            {
                MainConsole.Instance.InfoFormat("[LIBRARY INVENTORY]: Found previously loaded iar file {0}, ignoring.",
                                                iarFileName);
                return;
            }

            MainConsole.Instance.InfoFormat("[LIBRARY INVENTORY]: Loading iar file {0}", iarFileName);
            InventoryFolderBase rootFolder = m_MockScene.InventoryService.GetRootFolder(uinfo.PrincipalID);

            if (null == rootFolder)
            {
                //We need to create the root folder, otherwise the IAR freaks
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false);
            }

            InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName,
                                                                                   false, m_service.LibraryOwner);

            try
            {
                archread.ReplaceAssets = true; //Replace any old assets
                List<InventoryNodeBase> nodes = new List<InventoryNodeBase>(archread.Execute(true));
                if (nodes.Count == 0)
                    return;
                InventoryFolderBase f = (InventoryFolderBase) nodes[0];
                UUID IARRootID = f.ID;

                TraverseFolders(IARRootID, m_MockScene);
                FixParent(IARRootID, m_MockScene, m_service.LibraryRootFolderID);
                f.Name = iarFileName;
                f.ParentID = UUID.Zero;
                f.ID = m_service.LibraryRootFolderID;
                f.Type = (int) AssetType.RootFolder;
                f.Version = 1;
                m_MockScene.InventoryService.UpdateFolder(f);
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}",
                                                 iarFileName,
                                                 e.StackTrace);
            }
            finally
            {
                archread.Close();
            }
        }