Begining major rework of Asset/Inventory code. Doing a lot of refectoing. What's in here so far?

+ Inventory, Asset and Image managers are now directly apart of the SecondLife class
+ Root Inventory folder has been added to MainAvatar and is set upon login
+ Inventory is no longer downloaded all at once, you have to request the download of individual folders
+ Folder downloading is available Asynchronously, and returns a object that has a ManualResetEvent that you can use to optionally block with
+ The code for AssetManager has been reworked some in prep for allowing Wearables to be Saved/Loaded to/from disk, and for creating new wearables.


git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@742 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
Michael Cortez
2006-12-19 23:13:04 +00:00
parent df1ac0424f
commit b686cebf3d
17 changed files with 835 additions and 439 deletions

View File

@@ -9,6 +9,8 @@ namespace libsecondlife.InventorySystem
/// </summary>
public class InventoryFolder : InventoryBase
{
public enum FolderUpdateFlag { None, NoRecurse, Recurse };
public string Name
{
get { return _Name; }
@@ -33,10 +35,10 @@ namespace libsecondlife.InventorySystem
set
{
InventoryFolder ifParent = iManager.getFolder(this.ParentID);
ifParent.alContents.Remove(this);
ifParent._Contents.Remove(this);
ifParent = iManager.getFolder(value);
ifParent.alContents.Add(this);
ifParent._Contents.Add(this);
this._ParentID = value;
@@ -50,7 +52,8 @@ namespace libsecondlife.InventorySystem
get { return _Type; }
}
public List<InventoryBase> alContents = new List<InventoryBase>();
internal List<InventoryBase> _Contents = new List<InventoryBase>();
internal InventoryFolder(InventoryManager manager)
: base(manager)
@@ -88,6 +91,29 @@ namespace libsecondlife.InventorySystem
this._Type = sbyte.Parse(htData["type_default"].ToString());
}
/// <summary>
/// Get the contents of this folder
/// </summary>
/// <returns>Contents of this folder</returns>
public List<InventoryBase> GetContents()
{
return _Contents;
}
/// <summary>
/// Request a download of this folder's content information.
/// </summary>
/// <param name="Recurse">Indicate if we should recursively download content information.</param>
/// <returns>The Request object for this download</returns>
public DownloadRequest_Folder BeginDownloadContents(bool recurse)
{
_Contents.Clear();
DownloadRequest_Folder dr = new DownloadRequest_Folder(FolderID, recurse);
iManager.RequestFolder(dr);
return dr;
}
public InventoryFolder CreateFolder(string name)
{
@@ -96,7 +122,7 @@ namespace libsecondlife.InventorySystem
public void Delete()
{
iManager.getFolder(this.ParentID).alContents.Remove(this);
iManager.getFolder(this.ParentID)._Contents.Remove(this);
iManager.FolderRemove(this);
}
@@ -123,7 +149,7 @@ namespace libsecondlife.InventorySystem
public List<InventoryBase> GetItemByName(string name)
{
List<InventoryBase> items = new List<InventoryBase>();
foreach (InventoryBase ib in alContents)
foreach (InventoryBase ib in _Contents)
{
if (ib is InventoryFolder)
{
@@ -155,7 +181,7 @@ namespace libsecondlife.InventorySystem
output += "Type = '" + Type + "' ";
output += ">\n";
foreach (Object oContent in alContents)
foreach (Object oContent in _Contents)
{
output += ((InventoryBase)oContent).toXML(outputAssets);
}