29 using System.Xml.Serialization;
30 using System.Reflection;
34 namespace OpenSim.Framework
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 public static readonly
int MAX_ASSET_NAME = 64;
54 public static readonly
int MAX_ASSET_DESC = 64;
59 private byte[] m_data;
66 private int m_uploadAttempts;
73 m_metadata.FullID = UUID.Zero;
74 m_metadata.ID = UUID.Zero.ToString();
75 m_metadata.Type = (sbyte)AssetType.Unknown;
76 m_metadata.CreatorID = String.Empty;
79 public AssetBase(UUID assetID,
string name, sbyte assetType,
string creatorID)
81 if (assetType == (sbyte)AssetType.Unknown)
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());
89 m_metadata.FullID = assetID;
90 m_metadata.Name = name;
91 m_metadata.Type = assetType;
92 m_metadata.CreatorID = creatorID;
95 public AssetBase(
string assetID,
string name, sbyte assetType,
string creatorID)
97 if (assetType == (sbyte)AssetType.Unknown)
99 System.Diagnostics.StackTrace trace =
new System.Diagnostics.StackTrace(
true);
100 m_log.ErrorFormat(
"[ASSETBASE]: Creating asset '{0}' ({1}) with an unknown asset type\n{2}",
101 name, assetID, trace.ToString());
105 m_metadata.ID = assetID;
106 m_metadata.Name = name;
107 m_metadata.Type = assetType;
108 m_metadata.CreatorID = creatorID;
111 public bool ContainsReferences
117 Type != (sbyte)AssetType.Notecard
118 &&
Type != (sbyte)AssetType.CallingCard
119 &&
Type != (sbyte)AssetType.LSLText
120 &&
Type != (sbyte)AssetType.Landmark);
124 public bool IsTextualAsset
128 return !IsBinaryAsset;
136 public bool IsBinaryAsset
141 (
Type == (sbyte)AssetType.Animation ||
142 Type == (sbyte)AssetType.Gesture ||
143 Type == (sbyte)AssetType.Simstate ||
144 Type == (sbyte)AssetType.Unknown ||
145 Type == (sbyte)AssetType.Object ||
146 Type == (sbyte)AssetType.Sound ||
147 Type == (sbyte)AssetType.SoundWAV ||
148 Type == (sbyte)AssetType.Texture ||
149 Type == (sbyte)AssetType.TextureTGA ||
150 Type == (sbyte)AssetType.Folder ||
151 Type == (sbyte)AssetType.ImageJPEG ||
152 Type == (sbyte)AssetType.ImageTGA ||
153 Type == (sbyte)AssetType.Mesh ||
154 Type == (sbyte) AssetType.LSLBytecode);
158 public virtual byte[] Data
160 get {
return m_data; }
161 set { m_data = value; }
169 get {
return m_metadata.FullID; }
170 set { m_metadata.FullID = value; }
178 get {
return m_metadata.ID; }
179 set { m_metadata.ID = value; }
184 get {
return m_metadata.Name; }
185 set { m_metadata.Name = value; }
188 public string Description
190 get {
return m_metadata.Description; }
191 set { m_metadata.Description = value; }
199 get {
return m_metadata.Type; }
200 set { m_metadata.Type = value; }
203 public int UploadAttempts
205 get {
return m_uploadAttempts; }
206 set { m_uploadAttempts = value; }
214 get {
return m_metadata.Local; }
215 set { m_metadata.Local = value; }
221 public bool Temporary
223 get {
return m_metadata.Temporary; }
224 set { m_metadata.Temporary = value; }
227 public string CreatorID
229 get {
return m_metadata.CreatorID; }
230 set { m_metadata.CreatorID = value; }
235 get {
return m_metadata.Flags; }
236 set { m_metadata.Flags = value; }
242 get {
return m_metadata; }
243 set { m_metadata = value; }
248 return FullID.ToString();
255 private UUID m_fullid;
257 private string m_name = String.Empty;
258 private string m_description = String.Empty;
259 private DateTime m_creation_date;
260 private sbyte m_type = (sbyte)AssetType.Unknown;
261 private string m_content_type;
262 private byte[] m_sha1;
263 private bool m_local;
264 private bool m_temporary;
265 private string m_creatorid;
270 get {
return m_fullid; }
271 set { m_fullid = value; m_id = m_fullid.ToString(); }
280 if (String.IsNullOrEmpty(m_id))
281 m_id = m_fullid.ToString();
288 UUID uuid = UUID.Zero;
289 if (UUID.TryParse(value, out uuid))
292 m_id = m_fullid.ToString();
301 get {
return m_name; }
302 set { m_name = value; }
305 public string Description
307 get {
return m_description; }
308 set { m_description = value; }
311 public DateTime CreationDate
313 get {
return m_creation_date; }
314 set { m_creation_date = value; }
319 get {
return m_type; }
320 set { m_type = value; }
323 public string ContentType
327 if (!String.IsNullOrEmpty(m_content_type))
328 return m_content_type;
330 return SLUtil.SLAssetTypeToContentType(m_type);
334 m_content_type = value;
336 sbyte type = (sbyte)SLUtil.ContentTypeToSLAssetType(value);
344 get {
return m_sha1; }
345 set { m_sha1 = value; }
350 get {
return m_local; }
351 set { m_local = value; }
354 public bool Temporary
356 get {
return m_temporary; }
357 set { m_temporary = value; }
360 public string CreatorID
362 get {
return m_creatorid; }
363 set { m_creatorid = value; }
368 get {
return m_flags; }
369 set { m_flags = value; }
AssetBase(UUID assetID, string name, sbyte assetType, string creatorID)
AssetBase(string assetID, string name, sbyte assetType, string creatorID)
Asset class. All Assets are reference by this class or a class derived from this class ...
override string ToString()