diff options
author | Justin Clark-Casey (justincc) | 2009-09-08 16:12:15 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-09-08 16:12:15 +0100 |
commit | 76b21860e9f727391849c9b38c620b9bc16e4312 (patch) | |
tree | 8191cb1f4ec2a7359d35b1d3b8eeeb52bcfb4907 /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |
parent | Only allow iar load/save if user is logged in to the region simulator (diff) | |
download | opensim-SC_OLD-76b21860e9f727391849c9b38c620b9bc16e4312.zip opensim-SC_OLD-76b21860e9f727391849c9b38c620b9bc16e4312.tar.gz opensim-SC_OLD-76b21860e9f727391849c9b38c620b9bc16e4312.tar.bz2 opensim-SC_OLD-76b21860e9f727391849c9b38c620b9bc16e4312.tar.xz |
refactor iar name generation
slightly change the format of item archive names
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 67 |
1 files changed, 60 insertions, 7 deletions
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 | |||
138 | 138 | ||
139 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path) | 139 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path) |
140 | { | 140 | { |
141 | string filename = string.Format("{0}{1}_{2}.xml", path, inventoryItem.Name, inventoryItem.ID); | 141 | string filename = path + CreateArchiveItemName(inventoryItem); |
142 | 142 | ||
143 | // Record the creator of this item for user record purposes (which might go away soon) | 143 | // Record the creator of this item for user record purposes (which might go away soon) |
144 | m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; | 144 | m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; |
@@ -162,12 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
162 | { | 162 | { |
163 | if (saveThisFolderItself) | 163 | if (saveThisFolderItself) |
164 | { | 164 | { |
165 | path += | 165 | path += CreateArchiveFolderName(inventoryFolder); |
166 | string.Format( | ||
167 | "{0}{1}{2}/", | ||
168 | inventoryFolder.Name, | ||
169 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, | ||
170 | inventoryFolder.ID); | ||
171 | 166 | ||
172 | // We need to make sure that we record empty folders | 167 | // We need to make sure that we record empty folders |
173 | m_archiveWriter.WriteDir(path); | 168 | m_archiveWriter.WriteDir(path); |
@@ -356,5 +351,63 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
356 | } | 351 | } |
357 | } | 352 | } |
358 | } | 353 | } |
354 | |||
355 | /// <summary> | ||
356 | /// Create the archive name for a particular folder. | ||
357 | /// </summary> | ||
358 | /// | ||
359 | /// These names are prepended with an inventory folder's UUID so that more than one folder can have the | ||
360 | /// same name | ||
361 | /// | ||
362 | /// <param name="folder"></param> | ||
363 | /// <returns></returns> | ||
364 | public static string CreateArchiveFolderName(InventoryFolderBase folder) | ||
365 | { | ||
366 | return CreateArchiveFolderName(folder.Name, folder.ID); | ||
367 | } | ||
368 | |||
369 | /// <summary> | ||
370 | /// Create the archive name for a particular item. | ||
371 | /// </summary> | ||
372 | /// | ||
373 | /// These names are prepended with an inventory item's UUID so that more than one item can have the | ||
374 | /// same name | ||
375 | /// | ||
376 | /// <param name="item"></param> | ||
377 | /// <returns></returns> | ||
378 | public static string CreateArchiveItemName(InventoryItemBase item) | ||
379 | { | ||
380 | return CreateArchiveItemName(item.Name, item.ID); | ||
381 | } | ||
382 | |||
383 | /// <summary> | ||
384 | /// Create an archive folder name given its constituent components | ||
385 | /// </summary> | ||
386 | /// <param name="name"></param> | ||
387 | /// <param name="id"></param> | ||
388 | /// <returns></returns> | ||
389 | public static string CreateArchiveFolderName(string name, UUID id) | ||
390 | { | ||
391 | return string.Format( | ||
392 | "{0}{1}{2}/", | ||
393 | name, | ||
394 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, | ||
395 | id); | ||
396 | } | ||
397 | |||
398 | /// <summary> | ||
399 | /// Create an archive item name given its constituent components | ||
400 | /// </summary> | ||
401 | /// <param name="name"></param> | ||
402 | /// <param name="id"></param> | ||
403 | /// <returns></returns> | ||
404 | public static string CreateArchiveItemName(string name, UUID id) | ||
405 | { | ||
406 | return string.Format( | ||
407 | "{0}{1}{2}.xml", | ||
408 | name, | ||
409 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, | ||
410 | id); | ||
411 | } | ||
359 | } | 412 | } |
360 | } | 413 | } |