From 0c03a48fb2060eda4d288e2d2ca4e650ce000b4b Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Wed, 4 Feb 2009 00:01:36 +0000 Subject: - add OpenSim.Framework.AssetMetadata class. AssetBase is now composed of it - trim trailing whitespace --- .../AssetTransaction/AgentAssetsTransactions.cs | 26 ++++++------ .../Agent/AssetTransaction/AssetXferUploader.cs | 36 ++++++++--------- .../Modules/Agent/TextureSender/TextureSender.cs | 16 ++++---- .../Archiver/InventoryArchiveReadRequest.cs | 36 ++++++++--------- .../DynamicTexture/DynamicTextureModule.cs | 20 +++++----- .../Modules/World/Archiver/ArchiveReadRequest.cs | 46 +++++++++++----------- .../Modules/World/Archiver/AssetsArchiver.cs | 16 ++++---- .../Modules/World/Archiver/AssetsDearchiver.cs | 4 +- .../World/Estate/EstateTerrainXferHandler.cs | 28 ++++++------- 9 files changed, 114 insertions(+), 114 deletions(-) (limited to 'OpenSim/Region/Environment/Modules') diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs index 689b4d5..7f4bb0b 100644 --- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs +++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetsTransactions.cs @@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction } public void HandleXfer(ulong xferID, uint packetID, byte[] data) - { + { lock (XferUploaders) { foreach (AssetXferUploader uploader in XferUploaders.Values) @@ -97,8 +97,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction wearableType, nextOwnerMask); } } - - + + /// /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed. @@ -171,10 +171,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction "[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}", item.Name, part.Name, transactionID); - asset.Name = item.Name; - asset.Description = item.Description; - asset.Type = (sbyte)item.Type; - item.AssetID = asset.FullID; + asset.Metadata.Name = item.Name; + asset.Metadata.Description = item.Description; + asset.Metadata.Type = (sbyte)item.Type; + item.AssetID = asset.Metadata.FullID; Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); @@ -206,14 +206,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction asset = GetTransactionAsset(transactionID); } - if (asset != null && asset.FullID == assetID) + if (asset != null && asset.Metadata.FullID == assetID) { // Assets never get updated, new ones get created - asset.FullID = UUID.Random(); - asset.Name = item.Name; - asset.Description = item.Description; - asset.Type = (sbyte)item.AssetType; - item.AssetID = asset.FullID; + asset.Metadata.FullID = UUID.Random(); + asset.Metadata.Name = item.Name; + asset.Metadata.Description = item.Description; + asset.Metadata.Type = (sbyte)item.AssetType; + item.AssetID = asset.Metadata.FullID; Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); } diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs index 6dcbe83..5387165 100644 --- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs @@ -113,17 +113,17 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction { ourClient = remoteClient; m_asset = new AssetBase(); - m_asset.FullID = assetID; - m_asset.Type = type; + m_asset.Metadata.FullID = assetID; + m_asset.Metadata.Type = type; m_asset.Data = data; - m_asset.Name = "blank"; - m_asset.Description = "empty"; - m_asset.Local = storeLocal; - m_asset.Temporary = tempFile; + m_asset.Metadata.Name = "blank"; + m_asset.Metadata.Description = "empty"; + m_asset.Metadata.Local = storeLocal; + m_asset.Metadata.Temporary = tempFile; TransactionID = transaction; m_storeLocal = storeLocal; - + if (m_asset.Data.Length > 2) { SendCompleteMessage(); @@ -140,12 +140,12 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction protected void RequestStartXfer() { XferID = Util.GetNextXferID(); - ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); + ourClient.SendXferRequest(XferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]); } protected void SendCompleteMessage() { - ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID); + ourClient.SendAssetUploadCompleteMessage(m_asset.Metadata.Type, true, m_asset.Metadata.FullID); m_finished = true; if (m_createItem) @@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction DateTime now = DateTime.Now; string filename = String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day, - now.Hour, now.Minute, now.Second, m_asset.Name, m_asset.Type); + now.Hour, now.Minute, now.Second, m_asset.Metadata.Name, m_asset.Metadata.Type); SaveAssetToFile(filename, m_asset.Data); } } @@ -196,9 +196,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction this.invType = invType; this.wearableType = wearableType; nextPerm = nextOwnerMask; - m_asset.Name = name; - m_asset.Description = description; - m_asset.Type = type; + m_asset.Metadata.Name = name; + m_asset.Metadata.Description = description; + m_asset.Metadata.Type = type; if (m_finished) { @@ -211,7 +211,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction } } - + private void DoCreateItem() { m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset); @@ -225,7 +225,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction item.Owner = ourClient.AgentId; item.Creator = ourClient.AgentId; item.ID = UUID.Random(); - item.AssetID = m_asset.FullID; + item.AssetID = m_asset.Metadata.FullID; item.Description = m_description; item.Name = m_name; item.AssetType = type; @@ -245,9 +245,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction else { m_log.ErrorFormat( - "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", + "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", ourClient.AgentId); - } + } } /// @@ -260,7 +260,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction { return m_asset; } - + return null; } } diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs index a6901b6..f9a10bf 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender /// private AssetBase m_asset; - //public UUID assetID { get { return m_asset.FullID; } } + //public UUID assetID { get { return m_asset.Metadata.FullID; } } // private bool m_cancel = false; @@ -93,7 +93,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender get { return false; } set { - // m_cancel = value; + // m_cancel = value; } } @@ -102,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender get { return false; } set { - // m_sending = value; + // m_sending = value; } } @@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender // See ITextureSender public bool SendTexturePacket() { - //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.FullID); + //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.Metadata.FullID); SendPacket(); counter++; @@ -154,7 +154,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender { if (NumPackets == 0) { - RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); + RequestUser.SendImageFirstPart(1, m_asset.Metadata.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); PacketCounter++; } else @@ -163,7 +163,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender Array.Copy(m_asset.Data, 0, ImageData1, 0, 600); RequestUser.SendImageFirstPart( - (ushort)(NumPackets), m_asset.FullID, (uint)m_asset.Data.Length, ImageData1, 2); + (ushort)(NumPackets), m_asset.Metadata.FullID, (uint)m_asset.Data.Length, ImageData1, 2); PacketCounter++; } } @@ -179,11 +179,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender catch (ArgumentOutOfRangeException) { m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" + - m_asset.FullID.ToString()); + m_asset.Metadata.ID); return; } - RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.FullID, imageData); + RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.Metadata.FullID, imageData); PacketCounter++; } } diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 862caa9..dcfcba3 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver public class InventoryArchiveReadRequest { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + protected Scene scene; protected TarArchiveReader archive; private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); @@ -65,7 +65,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver InventoryItemBase item = new InventoryItemBase(); StringReader sr = new StringReader(contents); XmlTextReader reader = new XmlTextReader(sr); - + if (contents.Equals("")) return null; reader.ReadStartElement("InventoryObject"); @@ -79,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver item.InvType = System.Convert.ToInt32(reader.ReadString()); reader.ReadEndElement(); reader.ReadStartElement("CreatorUUID"); - item.Creator = UUID.Parse(reader.ReadString()); + item.Creator = UUID.Parse(reader.ReadString()); reader.ReadEndElement(); reader.ReadStartElement("CreationDate"); item.CreationDate = System.Convert.ToInt32(reader.ReadString()); @@ -94,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver } else { - reader.ReadStartElement("Description"); + reader.ReadStartElement("Description"); item.Description = reader.ReadString(); reader.ReadEndElement(); } @@ -145,7 +145,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver int successfulAssetRestores = 0; int failedAssetRestores = 0; int successfulItemRestores = 0; - + UserProfileData userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); if (null == userProfile) { @@ -157,28 +157,28 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver if (null == userInfo) { m_log.ErrorFormat( - "[CONSOLE]: Failed to find user info for {0} {1} {2}", + "[CONSOLE]: Failed to find user info for {0} {1} {2}", firstName, lastName, userProfile.ID); - + return; } - + if (!userInfo.HasReceivedInventory) { m_log.ErrorFormat( - "[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", + "[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", firstName, lastName, userProfile.ID); - + return; - } - + } + InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath); if (null == inventoryFolder) { // TODO: Later on, automatically create this folder if it does not exist m_log.ErrorFormat("[ARCHIVER]: Inventory path {0} does not exist", invPath); - + return; } @@ -202,17 +202,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver else { InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data)); - - if (item != null) + + if (item != null) { item.Creator = userProfile.ID; item.Owner = userProfile.ID; - + // Reset folder ID to the one in which we want to load it // TODO: Properly restore entire folder structure. At the moment all items are dumped in this // single folder no matter where in the saved folder structure they are. item.Folder = inventoryFolder.ID; - + userInfo.AddItem(item); successfulItemRestores++; } @@ -258,7 +258,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); - asset.Type = assetType; + asset.Metadata.Type = assetType; asset.Data = data; scene.AssetCache.AddAsset(asset); diff --git a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs index 0974f02..bddf10d 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -231,21 +231,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture // Create a new asset for user AssetBase asset = new AssetBase(); - asset.FullID = UUID.Random(); + asset.Metadata.FullID = UUID.Random(); asset.Data = assetData; - asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); - asset.Type = 0; - asset.Description = "dynamic image"; - asset.Local = false; - asset.Temporary = true; + asset.Metadata.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); + asset.Metadata.Type = 0; + asset.Metadata.Description = "dynamic image"; + asset.Metadata.Local = false; + asset.Metadata.Temporary = true; scene.AssetCache.AddAsset(asset); - LastAssetID = asset.FullID; + LastAssetID = asset.Metadata.FullID; IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface(); if (cacheLayerDecode != null) { - cacheLayerDecode.syncdecode(asset.FullID, asset.Data); + cacheLayerDecode.syncdecode(asset.Metadata.FullID, asset.Data); } cacheLayerDecode = null; @@ -256,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture UUID oldID = tmptex.DefaultTexture.TextureID; scene.AssetCache.ExpireAsset(oldID); - tmptex.DefaultTexture.TextureID = asset.FullID; + tmptex.DefaultTexture.TextureID = asset.Metadata.FullID; // I'm pretty sure we always want to force this to true tmptex.DefaultTexture.Fullbright = true; @@ -287,7 +287,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture try { result = OpenJPEG.EncodeFromImage(joint, true); - } + } catch (Exception) { Console.WriteLine( diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 4e9fcef..c860d01 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs @@ -66,12 +66,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); m_errorMessage = String.Empty; } - + public ArchiveReadRequest(Scene scene, Stream loadStream) { m_scene = scene; m_loadStream = loadStream; - } + } /// /// Dearchive the region embodied in this request. @@ -81,7 +81,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver // The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions DearchiveRegion0DotStar(); } - + private void DearchiveRegion0DotStar() { int successfulAssetRestores = 0; @@ -98,12 +98,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver byte[] data; TarArchiveReader.TarEntryType entryType; - + while ((data = archive.ReadEntry(out filePath, out entryType)) != null) { //m_log.DebugFormat( // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); - if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) + if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) { m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", filePath); @@ -133,7 +133,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver LoadRegionSettings(filePath, data); } } - + //m_log.Debug("[ARCHIVER]: Reached end of archive"); archive.Close(); @@ -154,10 +154,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); } - + m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); m_scene.DeleteAllSceneObjects(); - + // Reload serialized prims m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); @@ -176,10 +176,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver // Try to retain the original creator/owner/lastowner if their uuid is present on this grid // otherwise, use the master avatar uuid instead UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; - + if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner; - + foreach (SceneObjectPart part in sceneObject.Children.Values) { if (!resolveUserUuid(part.CreatorID)) @@ -233,7 +233,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver { sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); } - + m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); } @@ -290,12 +290,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); - asset.Type = assetType; + asset.Metadata.Type = assetType; asset.Data = data; m_scene.AssetCache.AddAsset(asset); - - /** + + /** * Create layers on decode for image assets. This is likely to significantly increase the time to load archives so * it might be best done when dearchive takes place on a separate thread if (asset.Type=AssetType.Texture) @@ -317,7 +317,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver return false; } } - + /// /// Load region settings data /// @@ -329,7 +329,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver private bool LoadRegionSettings(string settingsPath, byte[] data) { RegionSettings loadedRegionSettings; - + try { loadedRegionSettings = RegionSettingsSerializer.Deserialize(data); @@ -337,13 +337,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver catch (Exception e) { m_log.ErrorFormat( - "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", + "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", settingsPath, e); return false; } - + RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; - + currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit; currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage; currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide; @@ -373,10 +373,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; - + IEstateModule estateModule = m_scene.RequestModuleInterface(); estateModule.sendRegionHandshakeToAll(); - + return true; } @@ -411,11 +411,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver if (File.Exists(path)) { return new FileStream(path, FileMode.Open); - } + } else { Uri uri = new Uri(path); // throw exception if not valid URI - if (uri.Scheme == "file") + if (uri.Scheme == "file") { return new FileStream(uri.AbsolutePath, FileMode.Open); } diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs index 75ae474..36a60f3 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs @@ -86,16 +86,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver string extension = string.Empty; - if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) { - extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; + extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; } xtw.WriteElementString("filename", uuid.ToString() + extension); - xtw.WriteElementString("name", asset.Name); - xtw.WriteElementString("description", asset.Description); - xtw.WriteElementString("asset-type", asset.Type.ToString()); + xtw.WriteElementString("name", asset.Metadata.Name); + xtw.WriteElementString("description", asset.Metadata.Description); + xtw.WriteElementString("asset-type", asset.Metadata.Type.ToString()); xtw.WriteEndElement(); } @@ -123,15 +123,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver string extension = string.Empty; - if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) { - extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; + extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; } else { m_log.ErrorFormat( "[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded", - asset.Type, asset.ID); + asset.Metadata.Type, asset.Metadata.ID); } archive.AddFile( diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs index b26fe4c..0ef1e1d 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs @@ -157,8 +157,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); - asset.Description = metadata.Description; - asset.Type = metadata.AssetType; + asset.Metadata.Description = metadata.Description; + asset.Metadata.Type = metadata.AssetType; asset.Data = data; m_cache.AddAsset(asset); diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs index 6d69443..2ba4e34 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs @@ -37,13 +37,13 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Modules.World.Estate { - + public class EstateTerrainXferHandler { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private AssetBase m_asset; - + public delegate void TerrainUploadComplete(string name, byte[] filedata, IClientAPI remoteClient); public event TerrainUploadComplete TerrainUploadDone; @@ -52,21 +52,21 @@ namespace OpenSim.Region.Environment.Modules.World.Estate //private string m_name = String.Empty; //private UUID TransactionID = UUID.Zero; private sbyte type = 0; - + public ulong mXferID; private TerrainUploadComplete handlerTerrainUploadDone; public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) { - + m_asset = new AssetBase(); - m_asset.FullID = UUID.Zero; - m_asset.Type = type; + m_asset.Metadata.FullID = UUID.Zero; + m_asset.Metadata.Type = type; m_asset.Data = new byte[0]; - m_asset.Name = pClientFilename; - m_asset.Description = "empty"; - m_asset.Local = true; - m_asset.Temporary = true; + m_asset.Metadata.Name = pClientFilename; + m_asset.Metadata.Description = "empty"; + m_asset.Metadata.Local = true; + m_asset.Metadata.Temporary = true; } @@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate public void RequestStartXfer(IClientAPI pRemoteClient) { mXferID = Util.GetNextXferID(); - pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); + pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name)); } /// @@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate /// /// /// - /// + /// public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) { if (mXferID == xferID) @@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate if ((packetID & 0x80000000) != 0) { SendCompleteMessage(remoteClient); - + } } } @@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate handlerTerrainUploadDone = TerrainUploadDone; if (handlerTerrainUploadDone != null) { - handlerTerrainUploadDone(m_asset.Name,m_asset.Data, remoteClient); + handlerTerrainUploadDone(m_asset.Metadata.Name, m_asset.Data, remoteClient); } } } -- cgit v1.1