From 5752c1f5c2ee069e2ff5ffc0ff2f186d7454c5c4 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Wed, 28 May 2008 03:44:49 +0000 Subject: Formatting cleanup. --- .../Modules/World/Archiver/ArchiveRequest.cs | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs') diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs index 1579485..ea74941 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs @@ -37,37 +37,37 @@ using log4net; using Nini.Config; namespace OpenSim.Region.Environment -{ +{ /// /// Method called when all the necessary assets for an archive request have been received. /// public delegate void AssetsRequestCallback(IDictionary assets); - + /// /// Handles an individual archive request /// public class ArchiveRequest - { + { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private Scene m_scene; private string m_savePath; - + private string m_serializedEntities; - + public ArchiveRequest(Scene scene, string savePath) { m_scene = scene; m_savePath = savePath; - + ArchiveRegion(); } - + protected void ArchiveRegion() { m_log.Warn("[ARCHIVER]: Archive region not yet implemented"); - Dictionary textureUuids = new Dictionary(); + Dictionary textureUuids = new Dictionary(); List entities = m_scene.GetEntities(); @@ -76,14 +76,14 @@ namespace OpenSim.Region.Environment if (entity is SceneObjectGroup) { SceneObjectGroup sceneObject = (SceneObjectGroup)entity; - + foreach (SceneObjectPart part in sceneObject.GetParts()) { LLUUID texture = new LLUUID(part.Shape.TextureEntry, 0); textureUuids[texture] = 1; } - } - } + } + } m_serializedEntities = SerializeObjects(entities); @@ -91,30 +91,30 @@ namespace OpenSim.Region.Environment { m_log.DebugFormat("[ARCHIVER]: Successfully got serialization for {0} entities", entities.Count); m_log.DebugFormat("[ARCHIVER]: Requiring save of {0} textures", textureUuids.Count); - + // Asynchronously request all the assets required to perform this archive operation new AssetsRequest(ReceivedAllAssets, m_scene.AssetCache, textureUuids.Keys); } } - + protected internal void ReceivedAllAssets(IDictionary assets) { m_log.DebugFormat("[ARCHIVER]: Received all {0} textures required", assets.Count); - + // XXX: Shouldn't hijack the asset async callback thread like this - this is only temporary - + TarArchive archive = new TarArchive(); - + archive.AddFile("prims.xml", m_serializedEntities); - + foreach (LLUUID uuid in assets.Keys) { archive.AddFile(uuid.ToString() + ".jp2", assets[uuid].Data); } - + archive.WriteTar(m_savePath); } - + /// /// Get an xml representation of the given scene objects. /// @@ -152,38 +152,38 @@ namespace OpenSim.Region.Environment /// Callback used when all the assets requested have been received. /// protected AssetsRequestCallback m_assetsRequestCallback; - + /// /// Assets retrieved in this request /// protected Dictionary m_assets = new Dictionary(); - + /// /// Record the number of asset replies required so we know when we've finished /// private int m_repliesRequired; - + /// /// Asset cache used to request the assets /// - protected AssetCache m_assetCache; - - protected internal AssetsRequest(AssetsRequestCallback assetsRequestCallback, AssetCache assetCache, ICollection uuids) - { - m_assetsRequestCallback = assetsRequestCallback; + protected AssetCache m_assetCache; + + protected internal AssetsRequest(AssetsRequestCallback assetsRequestCallback, AssetCache assetCache, ICollection uuids) + { + m_assetsRequestCallback = assetsRequestCallback; m_assetCache = assetCache; m_repliesRequired = uuids.Count; - + // We can stop here if there are no assets to fetch if (m_repliesRequired == 0) - m_assetsRequestCallback(m_assets); - + m_assetsRequestCallback(m_assets); + foreach (LLUUID uuid in uuids) { - m_assetCache.GetAsset(uuid, AssetRequestCallback, true); + m_assetCache.GetAsset(uuid, AssetRequestCallback, true); } } - + /// /// Called back by the asset cache when it has the asset /// @@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment public void AssetRequestCallback(LLUUID assetID, AssetBase asset) { m_assets[assetID] = asset; - + if (m_assets.Count == m_repliesRequired) { m_assetsRequestCallback(m_assets); -- cgit v1.1