From 238f2274e33d2bbfb20cc0639bd15aa42a043307 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Sun, 6 Jul 2008 15:38:39 +0000
Subject: * refactor: archiver code clean up so that it's more readable for the
next functionality addition
---
.../Archiver/ArchiveWriteRequestPreparation.cs | 63 +++++++++++++++-------
1 file changed, 43 insertions(+), 20 deletions(-)
(limited to 'OpenSim/Region/Environment/Modules/World/Archiver')
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 2a1f695..11d0c65 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -112,6 +112,47 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
return m_requestedObjectAsset;
}
+
+ ///
+ /// Record the uuids referenced by the given wearable asset
+ ///
+ ///
+ /// Dictionary in which to record the references
+ protected void GetWearableAssetUuids(LLUUID wearableAssetUuid, IDictionary assetUuids)
+ {
+ AssetBase assetBase = GetAsset(wearableAssetUuid);
+ //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data));
+ AssetWearable wearableAsset = new AssetBodypart(assetBase.Data);
+ wearableAsset.Decode();
+
+ m_log.DebugFormat(
+ "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count);
+
+ foreach (LLUUID uuid in wearableAsset.Textures.Values)
+ {
+ //m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid);
+ assetUuids[uuid] = 1;
+ }
+ }
+
+ ///
+ /// Get all the asset uuids associated with a given object. This includes both those directly associated with
+ /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained
+ /// within this object).
+ ///
+ ///
+ ///
+ protected void GetSceneObjectAssetUuids(LLUUID sceneObjectUuid, IDictionary assetUuids)
+ {
+ AssetBase objectAsset = GetAsset(sceneObjectUuid);
+
+ if (null != objectAsset)
+ {
+ string xml = Helpers.FieldToUTF8String(objectAsset.Data);
+ SceneObjectGroup sog = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, xml);
+ GetSceneObjectAssetUuids(sog, assetUuids);
+ }
+ }
///
/// Get all the asset uuids associated with a given object. This includes both those directly associated with
@@ -157,29 +198,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
if ((int)AssetType.Bodypart == tii.Type || ((int)AssetType.Clothing == tii.Type))
{
- AssetBase assetBase = GetAsset(tii.AssetID);
- //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data));
- AssetWearable wearableAsset = new AssetBodypart(assetBase.Data);
- wearableAsset.Decode();
-
- m_log.DebugFormat("[ARCHIVER]: Wearable asset {0} references {1} assets", tii.AssetID, wearableAsset.Textures.Count);
-
- foreach (LLUUID uuid in wearableAsset.Textures.Values)
- {
- //m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid);
- assetUuids[uuid] = 1;
- }
+ GetWearableAssetUuids(tii.AssetID, assetUuids);
}
if ((int)AssetType.Object == tii.Type)
{
- AssetBase objectAsset = GetAsset(tii.AssetID);
-
- if (null != objectAsset)
- {
- string xml = Helpers.FieldToUTF8String(objectAsset.Data);
- SceneObjectGroup sog = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, xml);
- GetSceneObjectAssetUuids(sog, assetUuids);
- }
+ GetSceneObjectAssetUuids(tii.AssetID, assetUuids);
}
else
{
--
cgit v1.1