* Converted all timers to System.Threading timers to fix problems running in services and the CF * UDPBase now uses our own ReaderWriterLock that is more efficient, and CF compatible * Login uses a hand-created LoginProxy object instead of dynamically building the class with reflection .Emit() * Replaced ParameterizedThreadStart calls with class-wide variables for CF compat. * Removed transfer timeout code (irrelevant now that uploads go through CAPS) * Added several new Helpers methods to wrap desktop and CF conditional code * Replaced Monitor calls with AutoResetEvent in BlockingQueue * InventoryNodeDictionary uses generics now * Removed final lingering piece of XML serialization * Added CookComputing.XmlRpc.CF.dll for the CF git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1479 52acb1d6-8a22-11de-b505-999d5b087335
58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|