aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs61
1 files changed, 46 insertions, 15 deletions
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 6e163a9..3009259 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -36,7 +36,13 @@ using System;
36 36
37namespace OpenSim.Framework 37namespace OpenSim.Framework
38{ 38{
39 public class TaskInventoryDictionary : Dictionary<LLUUID, TaskInventoryItem>, IXmlSerializable 39 /// <summary>
40 /// A dictionary for task inventory.
41 ///
42 /// This class is not thread safe. Callers must synchronize on Dictionary methods.
43 /// </summary>
44 public class TaskInventoryDictionary : Dictionary<LLUUID, TaskInventoryItem>,
45 ICloneable, IXmlSerializable
40 { 46 {
41 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof(TaskInventoryItem)); 47 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof(TaskInventoryItem));
42 48
@@ -86,19 +92,38 @@ namespace OpenSim.Framework
86 // see IXmlSerializable 92 // see IXmlSerializable
87 public void WriteXml(XmlWriter writer) 93 public void WriteXml(XmlWriter writer)
88 { 94 {
89 foreach (TaskInventoryItem item in Values) 95 lock (this)
90 { 96 {
91 tiiSerializer.Serialize(writer, item); 97 foreach (TaskInventoryItem item in Values)
98 {
99 tiiSerializer.Serialize(writer, item);
100 }
92 } 101 }
93 102
94 //tiiSerializer.Serialize(writer, Values); 103 //tiiSerializer.Serialize(writer, Values);
95 } 104 }
105
106 // see ICloneable
107 public Object Clone()
108 {
109 TaskInventoryDictionary clone = new TaskInventoryDictionary();
110
111 lock (this)
112 {
113 foreach (LLUUID uuid in Keys)
114 {
115 clone.Add(uuid, (TaskInventoryItem)this[uuid].Clone());
116 }
117 }
118
119 return clone;
120 }
96 } 121 }
97 122
98 /// <summary> 123 /// <summary>
99 /// Represents an item in a task inventory 124 /// Represents an item in a task inventory
100 /// </summary> 125 /// </summary>
101 public class TaskInventoryItem 126 public class TaskInventoryItem : ICloneable
102 { 127 {
103 /// <summary> 128 /// <summary>
104 /// XXX This should really be factored out into some constants class. 129 /// XXX This should really be factored out into some constants class.
@@ -141,17 +166,7 @@ namespace OpenSim.Framework
141 String.Empty, 166 String.Empty,
142 "lsltext", 167 "lsltext",
143 String.Empty 168 String.Empty
144 }; 169 };
145
146 /// <summary>
147 /// Reset the LLUUIDs for this item.
148 /// </summary>
149 /// <param name="partID">The new part ID to which this item belongs</param>
150 public void ResetIDs(LLUUID partID)
151 {
152 ItemID = LLUUID.Random();
153 ParentPartID = partID;
154 }
155 170
156 public LLUUID ItemID = LLUUID.Zero; 171 public LLUUID ItemID = LLUUID.Zero;
157 public LLUUID ParentID = LLUUID.Zero; //parent folder id 172 public LLUUID ParentID = LLUUID.Zero; //parent folder id
@@ -175,5 +190,21 @@ namespace OpenSim.Framework
175 public uint CreationDate = 0; 190 public uint CreationDate = 0;
176 191
177 public LLUUID ParentPartID = LLUUID.Zero; 192 public LLUUID ParentPartID = LLUUID.Zero;
193
194 /// <summary>
195 /// Reset the LLUUIDs for this item.
196 /// </summary>
197 /// <param name="partID">The new part ID to which this item belongs</param>
198 public void ResetIDs(LLUUID partID)
199 {
200 ItemID = LLUUID.Random();
201 ParentPartID = partID;
202 }
203
204 // See ICloneable
205 public Object Clone()
206 {
207 return MemberwiseClone();
208 }
178 } 209 }
179} 210}