aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/AssetBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/AssetBase.cs')
-rw-r--r--OpenSim/Framework/AssetBase.cs50
1 files changed, 44 insertions, 6 deletions
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 9679ff2..212f41d 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -27,6 +27,8 @@
27 27
28using System; 28using System;
29using System.Xml.Serialization; 29using System.Xml.Serialization;
30using System.Reflection;
31using log4net;
30using OpenMetaverse; 32using OpenMetaverse;
31 33
32namespace OpenSim.Framework 34namespace OpenSim.Framework
@@ -37,6 +39,8 @@ namespace OpenSim.Framework
37 [Serializable] 39 [Serializable]
38 public class AssetBase 40 public class AssetBase
39 { 41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
40 /// <summary> 44 /// <summary>
41 /// Data of the Asset 45 /// Data of the Asset
42 /// </summary> 46 /// </summary>
@@ -47,16 +51,44 @@ namespace OpenSim.Framework
47 /// </summary> 51 /// </summary>
48 private AssetMetadata m_metadata; 52 private AssetMetadata m_metadata;
49 53
54 // This is needed for .NET serialization!!!
55 // Do NOT "Optimize" away!
50 public AssetBase() 56 public AssetBase()
51 { 57 {
52 m_metadata = new AssetMetadata(); 58 m_metadata = new AssetMetadata();
59 m_metadata.FullID = UUID.Zero;
60 m_metadata.ID = UUID.Zero.ToString();
61 m_metadata.Type = (sbyte)AssetType.Unknown;
53 } 62 }
54 63
55 public AssetBase(UUID assetId, string name) 64 public AssetBase(UUID assetID, string name, sbyte assetType)
56 { 65 {
66 if (assetType == (sbyte)AssetType.Unknown)
67 {
68 System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(true);
69 m_log.ErrorFormat("[ASSETBASE]: Creating asset '{0}' ({1}) with an unknown asset type\n{2}",
70 name, assetID, trace.ToString());
71 }
72
57 m_metadata = new AssetMetadata(); 73 m_metadata = new AssetMetadata();
58 m_metadata.FullID = assetId; 74 m_metadata.FullID = assetID;
59 m_metadata.Name = name; 75 m_metadata.Name = name;
76 m_metadata.Type = assetType;
77 }
78
79 public AssetBase(string assetID, string name, sbyte assetType)
80 {
81 if (assetType == (sbyte)AssetType.Unknown)
82 {
83 System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(true);
84 m_log.ErrorFormat("[ASSETBASE]: Creating asset '{0}' ({1}) with an unknown asset type\n{2}",
85 name, assetID, trace.ToString());
86 }
87
88 m_metadata = new AssetMetadata();
89 m_metadata.ID = assetID;
90 m_metadata.Name = name;
91 m_metadata.Type = assetType;
60 } 92 }
61 93
62 public bool ContainsReferences 94 public bool ContainsReferences
@@ -193,11 +225,11 @@ namespace OpenSim.Framework
193 private string m_name = String.Empty; 225 private string m_name = String.Empty;
194 private string m_description = String.Empty; 226 private string m_description = String.Empty;
195 private DateTime m_creation_date; 227 private DateTime m_creation_date;
196 private sbyte m_type; 228 private sbyte m_type = (sbyte)AssetType.Unknown;
197 private string m_content_type; 229 private string m_content_type;
198 private byte[] m_sha1; 230 private byte[] m_sha1;
199 private bool m_local = false; 231 private bool m_local;
200 private bool m_temporary = false; 232 private bool m_temporary;
201 //private Dictionary<string, Uri> m_methods = new Dictionary<string, Uri>(); 233 //private Dictionary<string, Uri> m_methods = new Dictionary<string, Uri>();
202 //private OSDMap m_extra_data; 234 //private OSDMap m_extra_data;
203 235
@@ -211,7 +243,13 @@ namespace OpenSim.Framework
211 { 243 {
212 //get { return m_fullid.ToString(); } 244 //get { return m_fullid.ToString(); }
213 //set { m_fullid = new UUID(value); } 245 //set { m_fullid = new UUID(value); }
214 get { return m_id; } 246 get
247 {
248 if (String.IsNullOrEmpty(m_id))
249 m_id = m_fullid.ToString();
250
251 return m_id;
252 }
215 set 253 set
216 { 254 {
217 UUID uuid = UUID.Zero; 255 UUID uuid = UUID.Zero;