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 +++++----- 3 files changed, 39 insertions(+), 39 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/Agent') 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); } } - - + + /// <summary> /// 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); - } + } } /// <summary> @@ -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 /// </summary> 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++; } } -- cgit v1.1