now the first section of Libraries.xml should only contain entry RootVersion to define the Opensim library version. THis should eb incremented when there are changes on ny library entry

This commit is contained in:
UbitUmarov
2022-04-23 04:04:43 +01:00
parent 8b6f9bfa0a
commit 7acc3096f4
4 changed files with 28 additions and 55 deletions

View File

@@ -50,6 +50,10 @@ namespace OpenSim.Services.InventoryService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly UUID libOwner = Constants.m_MrOpenSimID;
private const string m_LibraryRootFolderIDstr = "00000112-000f-0000-0000-000100bba000";
private static readonly UUID m_LibraryRootFolderID = new UUID(m_LibraryRootFolderIDstr);
static private InventoryFolderImpl m_LibraryRootFolder;
public InventoryFolderImpl LibraryRootFolder
@@ -57,7 +61,6 @@ namespace OpenSim.Services.InventoryService
get { return m_LibraryRootFolder; }
}
static private UUID libOwner = new UUID("11111111-1111-0000-0000-000100bba000");
/// <summary>
/// Holds the root library folder and all its descendents. This is really only used during inventory
@@ -98,12 +101,11 @@ namespace OpenSim.Services.InventoryService
m_LibraryRootFolder = new InventoryFolderImpl();
m_LibraryRootFolder.Owner = libOwner;
m_LibraryRootFolder.ID = new UUID("00000112-000f-0000-0000-000100bba000");
m_LibraryRootFolder.ID = m_LibraryRootFolderID;
m_LibraryRootFolder.Name = pLibName;
m_LibraryRootFolder.ParentID = UUID.Zero;
m_LibraryRootFolder.Type = 8;
m_LibraryRootFolder.Version = 1;
libraryFolders.Add(m_LibraryRootFolder.ID, m_LibraryRootFolder);
LoadLibraries(pLibrariesLocation);
@@ -148,17 +150,16 @@ namespace OpenSim.Services.InventoryService
protected void ReadLibraryFromConfig(IConfig config, string path)
{
string basePath = Path.GetDirectoryName(path);
m_LibraryRootFolder.Version = (ushort)config.GetInt("RootVersion", m_LibraryRootFolder.Version);
string foldersPath
= Path.Combine(
basePath, config.GetString("foldersFile", String.Empty));
if (config.Contains("RootVersion"))
{
m_LibraryRootFolder.Version = (ushort)config.GetInt("RootVersion", m_LibraryRootFolder.Version);
return;
}
string foldersPath = Path.Combine(basePath, config.GetString("foldersFile", String.Empty));
LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig);
string itemsPath
= Path.Combine(
basePath, config.GetString("itemsFile", String.Empty));
string itemsPath = Path.Combine( basePath, config.GetString("itemsFile", String.Empty));
LoadFromFile(itemsPath, "Library items", ReadItemFromConfig);
}
@@ -170,21 +171,18 @@ namespace OpenSim.Services.InventoryService
{
InventoryFolderImpl folderInfo = new InventoryFolderImpl();
folderInfo.ID = new UUID(config.GetString("folderID", m_LibraryRootFolder.ID.ToString()));
folderInfo.ID = new UUID(config.GetString("folderID", m_LibraryRootFolderIDstr));
folderInfo.Name = config.GetString("name", "unknown");
folderInfo.ParentID = new UUID(config.GetString("parentFolderID", m_LibraryRootFolder.ID.ToString()));
folderInfo.ParentID = new UUID(config.GetString("parentFolderID", m_LibraryRootFolderIDstr));
folderInfo.Type = (short)config.GetInt("type", 8);
folderInfo.Version = (ushort)config.GetInt("version", 1);
folderInfo.Owner = libOwner;
if (libraryFolders.ContainsKey(folderInfo.ParentID))
if (libraryFolders.TryGetValue(folderInfo.ParentID, out InventoryFolderImpl parentFolder))
{
InventoryFolderImpl parentFolder = libraryFolders[folderInfo.ParentID];
libraryFolders.Add(folderInfo.ID, folderInfo);
parentFolder.AddChildFolder(folderInfo);
// m_log.InfoFormat("[LIBRARY INVENTORY]: Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID);
//m_log.InfoFormat("[LIBRARY INVENTORY]: Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID);
}
else
{
@@ -203,10 +201,10 @@ namespace OpenSim.Services.InventoryService
InventoryItemBase item = new InventoryItemBase();
item.Owner = libOwner;
item.CreatorId = libOwner.ToString();
UUID itID = new UUID(config.GetString("inventoryID", m_LibraryRootFolder.ID.ToString()));
UUID itID = new UUID(config.GetString("inventoryID", m_LibraryRootFolderIDstr));
item.ID = itID;
item.AssetID = new UUID(config.GetString("assetID", item.ID.ToString()));
item.Folder = new UUID(config.GetString("folderID", m_LibraryRootFolder.ID.ToString()));
item.Folder = new UUID(config.GetString("folderID", m_LibraryRootFolderIDstr));
item.Name = config.GetString("name", String.Empty);
item.Description = config.GetString("description", item.Name);
item.InvType = config.GetInt("inventoryType", 0);
@@ -218,9 +216,8 @@ namespace OpenSim.Services.InventoryService
item.GroupPermissions = (uint)config.GetLong("basePermissions", m_GroupPermissions);;
item.Flags = (uint)config.GetInt("flags", 0);
if (libraryFolders.ContainsKey(item.Folder))
if (libraryFolders.TryGetValue(item.Folder, out InventoryFolderImpl parentFolder))
{
InventoryFolderImpl parentFolder = libraryFolders[item.Folder];
if(!parentFolder.Items.ContainsKey(itID))
{
parentFolder.Items.Add(itID, item);
@@ -279,7 +276,7 @@ namespace OpenSim.Services.InventoryService
public Dictionary<UUID, InventoryFolderImpl> GetAllFolders()
{
Dictionary<UUID, InventoryFolderImpl> fs = new Dictionary<UUID, InventoryFolderImpl>();
fs.Add(m_LibraryRootFolder.ID, m_LibraryRootFolder);
fs.Add(m_LibraryRootFolderID, m_LibraryRootFolder);
List<InventoryFolderImpl> fis = TraverseFolder(m_LibraryRootFolder);
foreach (InventoryFolderImpl f in fis)
{
@@ -302,8 +299,8 @@ namespace OpenSim.Services.InventoryService
public InventoryItemBase GetItem(UUID itemID)
{
if(m_items.ContainsKey(itemID))
return m_items[itemID];
if(m_items.TryGetValue(itemID, out InventoryItemBase it))
return it;
return null;
}
@@ -312,8 +309,8 @@ namespace OpenSim.Services.InventoryService
List<InventoryItemBase> items = new List<InventoryItemBase>();
foreach (UUID id in ids)
{
if(m_items.ContainsKey(id))
items.Add(m_items[id]);
if (m_items.TryGetValue(id, out InventoryItemBase it))
items.Add(it);
}
if(items.Count == 0)

View File

@@ -14,69 +14,46 @@
</Section>
-->
<!-- comment the following to stop from loading the subfolders on login -->
<!---->
<Section Name="Animations Library">
<Key Name="foldersFile" Value="AnimationsLibrary/AnimationsLibraryFolders.xml"/>
<Key Name="itemsFile" Value="AnimationsLibrary/AnimationsLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="BodyParts Library">
<Key Name="foldersFile" Value="BodyPartsLibrary/BodyPartsLibraryFolders.xml"/>
<Key Name="itemsFile" Value="BodyPartsLibrary/BodyPartsLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="Clothing Library">
<Key Name="foldersFile" Value="ClothingLibrary/ClothingLibraryFolders.xml"/>
<Key Name="itemsFile" Value="ClothingLibrary/ClothingLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="Gestures Library">
<Key Name="foldersFile" Value="GesturesLibrary/GesturesLibraryFolders.xml"/>
<Key Name="itemsFile" Value="GesturesLibrary/GesturesLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="Landmarks Library">
<Key Name="foldersFile" Value="LandmarksLibrary/LandmarksLibraryFolders.xml"/>
<Key Name="itemsFile" Value="LandmarksLibrary/LandmarksLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="Notecards Library">
<Key Name="foldersFile" Value="NotecardsLibrary/NotecardsLibraryFolders.xml"/>
<Key Name="itemsFile" Value="NotecardsLibrary/NotecardsLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="Objects Library">
<Key Name="foldersFile" Value="ObjectsLibrary/ObjectsLibraryFolders.xml"/>
<Key Name="itemsFile" Value="ObjectsLibrary/ObjectsLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="Photos Library">
<Key Name="foldersFile" Value="PhotosLibrary/PhotosLibraryFolders.xml"/>
<Key Name="itemsFile" Value="PhotosLibrary/PhotosLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="Scripts Library">
<Key Name="foldersFile" Value="ScriptsLibrary/ScriptsLibraryFolders.xml"/>
<Key Name="itemsFile" Value="ScriptsLibrary/ScriptsLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="Sounds Library">
<Key Name="foldersFile" Value="SoundsLibrary/SoundsLibraryFolders.xml"/>
<Key Name="itemsFile" Value="SoundsLibrary/SoundsLibraryItems.xml"/>
</Section>
<!---->
<!---->
<Section Name="Textures Library">
<Key Name="foldersFile" Value="TexturesLibrary/TexturesLibraryFolders.xml"/>
<Key Name="itemsFile" Value="TexturesLibrary/TexturesLibraryItems.xml"/>
@@ -85,5 +62,4 @@
<Key Name="foldersFile" Value="SettingsLibrary/Folders.xml"/>
<Key Name="itemsFile" Value="SettingsLibrary/Items.xml"/>
</Section>
<!---->
</Nini>

View File

@@ -21,12 +21,12 @@
<Key Name="folderID" Value="30000112-001f-0000-0000-000100bba000"/>
<Key Name="parentFolderID" Value="30000112-000f-0000-0000-000100bba002"/>
<Key Name="name" Value="Examples"/>
<Key Name="type" Value="10"/>
<Key Name="type" Value="-1"/>
</Section>
<Section Name="OpenSim Specific">
<Key Name="folderID" Value="30000112-001f-0000-0000-000100bba001"/>
<Key Name="parentFolderID" Value="30000112-001f-0000-0000-000100bba000"/>
<Key Name="name" Value="OpenSim Specific"/>
<Key Name="type" Value="10"/>
<Key Name="type" Value="-1"/>
</Section>
</Nini>

View File

@@ -3,8 +3,8 @@
<Key Name="folderID" Value="00000112-000f-0000-0000-000100bba025"/>
<Key Name="parentFolderID" Value="00000112-000f-0000-0000-000100bba000"/>
<Key Name="name" Value="Settings Library"/>
<Key Name="type" Value="-1"/>
<Key Name="version" Value="2"/>
<Key Name="type" Value="56"/>
<Key Name="version" Value="3"/>
</Section>
<Section Name="Water">
<Key Name="folderID" Value="25000112-000f-0000-0000-000100bba025"/>