2006-10-21 02:52:28 +00:00
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using libsecondlife;
|
|
|
|
|
using libsecondlife.AssetSystem;
|
|
|
|
|
|
|
|
|
|
namespace libsecondlife.InventorySystem
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Base class for Inventory items
|
|
|
|
|
/// </summary>
|
|
|
|
|
abstract public class InventoryBase
|
|
|
|
|
{
|
|
|
|
|
protected InventoryManager iManager;
|
|
|
|
|
|
|
|
|
|
internal string _Name;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="manager"></param>
|
|
|
|
|
internal InventoryBase(InventoryManager manager)
|
|
|
|
|
{
|
|
|
|
|
if( manager == null )
|
|
|
|
|
{
|
|
|
|
|
throw new Exception( "Inventory Manager cannot be null" );
|
|
|
|
|
}
|
|
|
|
|
iManager = manager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Output this item as XML
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="outputAssets">Include an asset data as well, TRUE/FALSE</param>
|
|
|
|
|
abstract public string toXML(bool outputAssets);
|
|
|
|
|
|
2006-12-20 22:19:52 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Get a short string describing this item's type
|
|
|
|
|
/// </summary>
|
|
|
|
|
abstract public string GetDisplayType();
|
|
|
|
|
|
2006-10-21 02:52:28 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Utility function to simply making text XML safe
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="str"></param>
|
|
|
|
|
protected string xmlSafe(string str)
|
|
|
|
|
{
|
|
|
|
|
if( str != null )
|
|
|
|
|
{
|
|
|
|
|
string clean = str.Replace("&","&");
|
|
|
|
|
clean = clean.Replace("<","<");
|
|
|
|
|
clean = clean.Replace(">",">");
|
|
|
|
|
clean = clean.Replace("'","'");
|
|
|
|
|
clean = clean.Replace("\"",""");
|
|
|
|
|
return clean;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|