protected void LoadLibrariesFromArchives() { InventoryFolderImpl lib = m_Library.LibraryRootFolder; if (lib == null) { m_log.Debug("[LIBRARY MODULE]: No library. Ignoring Library Module"); return; } RegionInfo regInfo = new RegionInfo(); Scene m_MockScene = new Scene(regInfo); LocalInventoryService invService = new LocalInventoryService(lib); m_MockScene.RegisterModuleInterface <IInventoryService>(invService); m_MockScene.RegisterModuleInterface <IAssetService>(m_Scene.AssetService); UserAccount uinfo = new UserAccount(lib.Owner); uinfo.FirstName = "OpenSim"; uinfo.LastName = "Library"; uinfo.ServiceURLs = new Dictionary <string, object>(); if (Directory.Exists(LIBRARY_PATH)) { foreach (string iarFileName in Directory.GetFiles(LIBRARY_PATH, "*.iar")) { string simpleName = Path.GetFileNameWithoutExtension(iarFileName); m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName); simpleName = GetInventoryPathFromName(simpleName); InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, simpleName, iarFileName, false); try { HashSet <InventoryNodeBase> nodes = archread.Execute(); if (nodes != null && nodes.Count == 0) { // didn't find the subfolder with the given name; place it on the top m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName); archread.Close(); archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName, false); archread.Execute(); } foreach (InventoryNodeBase node in nodes) { FixPerms(node); } } catch (Exception e) { m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.StackTrace); } finally { archread.Close(); } } } }
protected void LoadLibrariesFromArchives() { InventoryFolderImpl lib = m_Library.LibraryRootFolder; if (lib == null) { m_log.Debug("[LIBRARY MODULE]: No library. Ignoring Library Module"); return; } RegionInfo regInfo = new RegionInfo(); Scene m_MockScene = new Scene(regInfo); LocalInventoryService invService = new LocalInventoryService(lib); m_MockScene.RegisterModuleInterface<IInventoryService>(invService); m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService); UserAccount uinfo = new UserAccount(lib.Owner); uinfo.FirstName = "OpenSim"; uinfo.LastName = "Library"; uinfo.ServiceURLs = new Dictionary<string, object>(); foreach (string iarFileName in Directory.GetFiles(pathToLibraries, "*.iar")) { string simpleName = Path.GetFileNameWithoutExtension(iarFileName); m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName); simpleName = GetInventoryPathFromName(simpleName); InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, simpleName, iarFileName, false); try { HashSet<InventoryNodeBase> nodes = archread.Execute(); if (nodes != null && nodes.Count == 0) { // didn't find the subfolder with the given name; place it on the top m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName); archread.Close(); archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, "/", iarFileName, false); archread.Execute(); } foreach (InventoryNodeBase node in nodes) FixPerms(node); } catch (Exception e) { m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.StackTrace); } finally { archread.Close(); } } }
protected void LoadLibrariesFromArchives() { InventoryFolderImpl lib = m_Scene.CommsManager.UserProfileCacheService.LibraryRoot; if (lib == null) { m_log.Debug("[LIBRARY MODULE]: No library. Ignoring Library Module"); return; } lib.Name = m_LibraryName; RegionInfo regInfo = new RegionInfo(); Scene m_MockScene = new Scene(regInfo); m_MockScene.CommsManager = m_Scene.CommsManager; LocalInventoryService invService = new LocalInventoryService((LibraryRootFolder)lib); m_MockScene.RegisterModuleInterface<IInventoryService>(invService); m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService); UserProfileData profile = new UserProfileData(); profile.FirstName = "OpenSim"; profile.ID = lib.Owner; profile.SurName = "Library"; CachedUserInfo uinfo = new CachedUserInfo(invService, profile); foreach (string iarFileName in Directory.GetFiles(pathToLibraries, "*.iar")) { string simpleName = Path.GetFileNameWithoutExtension(iarFileName); m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName); simpleName = GetInventoryPathFromName(simpleName); try { InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, simpleName, iarFileName); List<InventoryNodeBase> nodes = archread.Execute(); if (nodes.Count == 0) { // didn't find the subfolder with the given name; place it on the top m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName); archread.Close(); archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName); archread.Execute(); } archread.Close(); } catch (Exception e) { m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.Message); } } }