protected XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name) { XInventoryFolder newFolder = new XInventoryFolder(); newFolder.folderName = name; newFolder.type = type; newFolder.version = 1; newFolder.folderID = UUID.Random(); newFolder.agentID = principalID; newFolder.parentFolderID = parentID; m_Database.StoreFolder(newFolder); return(newFolder); }
public virtual bool AddFolder(InventoryFolderBase folder) { // m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID); InventoryFolderBase check = GetFolder(folder); if (check != null) { return(false); } if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown) { InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); if (rootFolder == null) { m_log.WarnFormat( "[XINVENTORY]: Found no root folder for {0} in AddFolder() when looking for {1}", folder.Owner, folder.Type); return(false); } // Check we're not trying to add this as a system folder. if (folder.ParentID == rootFolder.ID) { InventoryFolderBase existingSystemFolder = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); if (existingSystemFolder != null) { m_log.WarnFormat( "[XINVENTORY]: System folder of type {0} already exists when tried to add {1} to {2} for {3}", folder.Type, folder.Name, folder.ParentID, folder.Owner); return(false); } } } XInventoryFolder xFolder = ConvertFromOpenSim(folder); return(m_Database.StoreFolder(xFolder)); }