diff options
Diffstat (limited to 'OpenSim/Framework/TaskInventoryItem.cs')
-rw-r--r-- | OpenSim/Framework/TaskInventoryItem.cs | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 60b22db..45b806e 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs | |||
@@ -37,106 +37,6 @@ using log4net; | |||
37 | namespace OpenSim.Framework | 37 | namespace OpenSim.Framework |
38 | { | 38 | { |
39 | /// <summary> | 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<UUID, TaskInventoryItem>, | ||
45 | ICloneable, IXmlSerializable | ||
46 | { | ||
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); | ||
50 | |||
51 | #region ICloneable Members | ||
52 | |||
53 | public Object Clone() | ||
54 | { | ||
55 | TaskInventoryDictionary clone = new TaskInventoryDictionary(); | ||
56 | |||
57 | lock (this) | ||
58 | { | ||
59 | foreach (UUID uuid in Keys) | ||
60 | { | ||
61 | clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone()); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | return clone; | ||
66 | } | ||
67 | |||
68 | #endregion | ||
69 | |||
70 | // The alternative of simply serializing the list doesn't appear to work on mono, since | ||
71 | // we get a | ||
72 | // | ||
73 | // System.TypeInitializationException: An exception was thrown by the type initializer for OpenSim.Framework.TaskInventoryDictionary ---> System.ArgumentOutOfRangeException: < 0 | ||
74 | // Parameter name: length | ||
75 | // at System.String.Substring (Int32 startIndex, Int32 length) [0x00088] in /build/buildd/mono-1.2.4/mcs/class/corlib/System/String.cs:381 | ||
76 | // at System.Xml.Serialization.TypeTranslator.GetTypeData (System.Type runtimeType, System.String xmlDataType) [0x001f6] in /build/buildd/mono-1.2.4/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs:217 | ||
77 | // ... | ||
78 | // private static XmlSerializer tiiSerializer | ||
79 | // = new XmlSerializer(typeof(Dictionary<UUID, TaskInventoryItem>.ValueCollection)); | ||
80 | |||
81 | // see IXmlSerializable | ||
82 | |||
83 | #region IXmlSerializable Members | ||
84 | |||
85 | public XmlSchema GetSchema() | ||
86 | { | ||
87 | return null; | ||
88 | } | ||
89 | |||
90 | // see IXmlSerializable | ||
91 | public void ReadXml(XmlReader reader) | ||
92 | { | ||
93 | // m_log.DebugFormat("[TASK INVENTORY]: ReadXml current node before actions, {0}", reader.Name); | ||
94 | |||
95 | if (!reader.IsEmptyElement) | ||
96 | { | ||
97 | reader.Read(); | ||
98 | while (tiiSerializer.CanDeserialize(reader)) | ||
99 | { | ||
100 | TaskInventoryItem item = (TaskInventoryItem) tiiSerializer.Deserialize(reader); | ||
101 | Add(item.ItemID, item); | ||
102 | |||
103 | //m_log.DebugFormat("[TASK INVENTORY]: Instanted prim item {0}, {1} from xml", item.Name, item.ItemID); | ||
104 | } | ||
105 | |||
106 | // m_log.DebugFormat("[TASK INVENTORY]: Instantiated {0} prim items in total from xml", Count); | ||
107 | } | ||
108 | // else | ||
109 | // { | ||
110 | // m_log.DebugFormat("[TASK INVENTORY]: Skipping empty element {0}", reader.Name); | ||
111 | // } | ||
112 | |||
113 | // For some .net implementations, this last read is necessary so that we advance beyond the end tag | ||
114 | // of the element wrapping this object so that the rest of the serialization can complete normally. | ||
115 | reader.Read(); | ||
116 | |||
117 | // m_log.DebugFormat("[TASK INVENTORY]: ReadXml current node after actions, {0}", reader.Name); | ||
118 | } | ||
119 | |||
120 | // see IXmlSerializable | ||
121 | public void WriteXml(XmlWriter writer) | ||
122 | { | ||
123 | lock (this) | ||
124 | { | ||
125 | foreach (TaskInventoryItem item in Values) | ||
126 | { | ||
127 | tiiSerializer.Serialize(writer, item); | ||
128 | } | ||
129 | } | ||
130 | |||
131 | //tiiSerializer.Serialize(writer, Values); | ||
132 | } | ||
133 | |||
134 | #endregion | ||
135 | |||
136 | // see ICloneable | ||
137 | } | ||
138 | |||
139 | /// <summary> | ||
140 | /// Represents an item in a task inventory | 40 | /// Represents an item in a task inventory |
141 | /// </summary> | 41 | /// </summary> |
142 | public class TaskInventoryItem : ICloneable | 42 | public class TaskInventoryItem : ICloneable |