Files
libremetaverse/libsecondlife/InventoryNodeDictionary.cs

58 lines
1.6 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Text;
namespace libsecondlife
{
public class InventoryNodeDictionary
{
protected Dictionary<LLUUID, InventoryNode> Dictionary = new Dictionary<LLUUID, InventoryNode>();
protected InventoryNode parent;
protected object syncRoot = new object();
public InventoryNode Parent
{
get { return parent; }
set { parent = value; }
}
public object SyncRoot { get { return syncRoot; } }
public int Count { get { return Dictionary.Count; } }
public InventoryNodeDictionary(InventoryNode parentNode)
{
parent = parentNode;
}
public InventoryNode this[LLUUID key]
{
get { return (InventoryNode)this.Dictionary[key]; }
set
{
value.Parent = parent;
lock (syncRoot) this.Dictionary[key] = value;
}
}
public ICollection<LLUUID> Keys { get { return this.Dictionary.Keys; } }
public ICollection<InventoryNode> Values { get { return this.Dictionary.Values; } }
public void Add(LLUUID key, InventoryNode value)
{
value.Parent = parent;
lock (syncRoot) this.Dictionary.Add(key, value);
}
public void Remove(LLUUID key)
{
lock (syncRoot) this.Dictionary.Remove(key);
}
public bool Contains(LLUUID key)
{
return this.Dictionary.ContainsKey(key);
}
}
}