From 76b21860e9f727391849c9b38c620b9bc16e4312 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 8 Sep 2009 16:12:15 +0100
Subject: refactor iar name generation slightly change the format of item
archive names
---
.../Archiver/InventoryArchiveWriteRequest.cs | 67 +++++++++++++++++++---
1 file changed, 60 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs')
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index dee4a5d..b178772 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void SaveInvItem(InventoryItemBase inventoryItem, string path)
{
- string filename = string.Format("{0}{1}_{2}.xml", path, inventoryItem.Name, inventoryItem.ID);
+ string filename = path + CreateArchiveItemName(inventoryItem);
// Record the creator of this item for user record purposes (which might go away soon)
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
@@ -162,12 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (saveThisFolderItself)
{
- path +=
- string.Format(
- "{0}{1}{2}/",
- inventoryFolder.Name,
- ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
- inventoryFolder.ID);
+ path += CreateArchiveFolderName(inventoryFolder);
// We need to make sure that we record empty folders
m_archiveWriter.WriteDir(path);
@@ -356,5 +351,63 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
}
}
+
+ ///
+ /// Create the archive name for a particular folder.
+ ///
+ ///
+ /// These names are prepended with an inventory folder's UUID so that more than one folder can have the
+ /// same name
+ ///
+ ///
+ ///
+ public static string CreateArchiveFolderName(InventoryFolderBase folder)
+ {
+ return CreateArchiveFolderName(folder.Name, folder.ID);
+ }
+
+ ///
+ /// Create the archive name for a particular item.
+ ///
+ ///
+ /// These names are prepended with an inventory item's UUID so that more than one item can have the
+ /// same name
+ ///
+ ///
+ ///
+ public static string CreateArchiveItemName(InventoryItemBase item)
+ {
+ return CreateArchiveItemName(item.Name, item.ID);
+ }
+
+ ///
+ /// Create an archive folder name given its constituent components
+ ///
+ ///
+ ///
+ ///
+ public static string CreateArchiveFolderName(string name, UUID id)
+ {
+ return string.Format(
+ "{0}{1}{2}/",
+ name,
+ ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
+ id);
+ }
+
+ ///
+ /// Create an archive item name given its constituent components
+ ///
+ ///
+ ///
+ ///
+ public static string CreateArchiveItemName(string name, UUID id)
+ {
+ return string.Format(
+ "{0}{1}{2}.xml",
+ name,
+ ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
+ id);
+ }
}
}
--
cgit v1.1