diff options
Diffstat (limited to 'OpenSim/Framework/TaskInventoryItem.cs')
-rw-r--r-- | OpenSim/Framework/TaskInventoryItem.cs | 115 |
1 files changed, 96 insertions, 19 deletions
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 107993b..6e163a9 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs | |||
@@ -26,11 +26,78 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System.Collections.Generic; | ||
30 | using System.Xml; | ||
31 | using System.Xml.Schema; | ||
32 | using System.Xml.Serialization; | ||
33 | |||
29 | using libsecondlife; | 34 | using libsecondlife; |
30 | using System; | 35 | using System; |
31 | 36 | ||
32 | namespace OpenSim.Framework | 37 | namespace OpenSim.Framework |
33 | { | 38 | { |
39 | public class TaskInventoryDictionary : Dictionary<LLUUID, TaskInventoryItem>, IXmlSerializable | ||
40 | { | ||
41 | private static XmlSerializer tiiSerializer = new XmlSerializer(typeof(TaskInventoryItem)); | ||
42 | |||
43 | // The alternative of simply serializing the list doesn't appear to work on mono, since | ||
44 | // we get a | ||
45 | // | ||
46 | // System.TypeInitializationException: An exception was thrown by the type initializer for OpenSim.Framework.TaskInventoryDictionary ---> System.ArgumentOutOfRangeException: < 0 | ||
47 | // Parameter name: length | ||
48 | // at System.String.Substring (Int32 startIndex, Int32 length) [0x00088] in /build/buildd/mono-1.2.4/mcs/class/corlib/System/String.cs:381 | ||
49 | // 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 | ||
50 | // ... | ||
51 | // private static XmlSerializer tiiSerializer | ||
52 | // = new XmlSerializer(typeof(Dictionary<LLUUID, TaskInventoryItem>.ValueCollection)); | ||
53 | |||
54 | // see IXmlSerializable | ||
55 | public XmlSchema GetSchema() | ||
56 | { | ||
57 | return null; | ||
58 | } | ||
59 | |||
60 | // see IXmlSerializable | ||
61 | public void ReadXml(XmlReader reader) | ||
62 | { | ||
63 | reader.Read(); | ||
64 | while (tiiSerializer.CanDeserialize(reader)) | ||
65 | { | ||
66 | TaskInventoryItem item = (TaskInventoryItem)tiiSerializer.Deserialize(reader); | ||
67 | Add(item.ItemID, item); | ||
68 | } | ||
69 | |||
70 | // reader.Read(); | ||
71 | // while (reader.Name.Equals("TaskInventoryItem")) | ||
72 | // { | ||
73 | // TaskInventoryItem item = (TaskInventoryItem)tiiSerializer.Deserialize(reader); | ||
74 | // Add(item.ItemID, item); | ||
75 | // } | ||
76 | |||
77 | // ICollection<TaskInventoryItem> items | ||
78 | // = (ICollection<TaskInventoryItem>)tiiSerializer.Deserialize(reader); | ||
79 | // | ||
80 | // foreach (TaskInventoryItem item in items) | ||
81 | // { | ||
82 | // Add(item.ItemID, item); | ||
83 | // } | ||
84 | } | ||
85 | |||
86 | // see IXmlSerializable | ||
87 | public void WriteXml(XmlWriter writer) | ||
88 | { | ||
89 | foreach (TaskInventoryItem item in Values) | ||
90 | { | ||
91 | tiiSerializer.Serialize(writer, item); | ||
92 | } | ||
93 | |||
94 | //tiiSerializer.Serialize(writer, Values); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Represents an item in a task inventory | ||
100 | /// </summary> | ||
34 | public class TaskInventoryItem | 101 | public class TaskInventoryItem |
35 | { | 102 | { |
36 | /// <summary> | 103 | /// <summary> |
@@ -75,27 +142,37 @@ namespace OpenSim.Framework | |||
75 | "lsltext", | 142 | "lsltext", |
76 | String.Empty | 143 | String.Empty |
77 | }; | 144 | }; |
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 | } | ||
78 | 155 | ||
79 | public LLUUID item_id = LLUUID.Zero; | 156 | public LLUUID ItemID = LLUUID.Zero; |
80 | public LLUUID parent_id = LLUUID.Zero; //parent folder id | 157 | public LLUUID ParentID = LLUUID.Zero; //parent folder id |
81 | 158 | ||
82 | public uint base_mask = FULL_MASK_PERMISSIONS_GENERAL; | 159 | public uint BaseMask = FULL_MASK_PERMISSIONS_GENERAL; |
83 | public uint owner_mask = FULL_MASK_PERMISSIONS_GENERAL; | 160 | public uint OwnerMask = FULL_MASK_PERMISSIONS_GENERAL; |
84 | public uint group_mask = FULL_MASK_PERMISSIONS_GENERAL; | 161 | public uint GroupMask = FULL_MASK_PERMISSIONS_GENERAL; |
85 | public uint everyone_mask = FULL_MASK_PERMISSIONS_GENERAL; | 162 | public uint EveryoneMask = FULL_MASK_PERMISSIONS_GENERAL; |
86 | public uint next_owner_mask = FULL_MASK_PERMISSIONS_GENERAL; | 163 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS_GENERAL; |
87 | public LLUUID creator_id = LLUUID.Zero; | 164 | public LLUUID CreatorID = LLUUID.Zero; |
88 | public LLUUID owner_id = LLUUID.Zero; | 165 | public LLUUID OwnerID = LLUUID.Zero; |
89 | public LLUUID last_owner_id = LLUUID.Zero; | 166 | public LLUUID LastOwnerID = LLUUID.Zero; |
90 | public LLUUID group_id = LLUUID.Zero; | 167 | public LLUUID GroupID = LLUUID.Zero; |
91 | 168 | ||
92 | public LLUUID asset_id = LLUUID.Zero; | 169 | public LLUUID AssetID = LLUUID.Zero; |
93 | public int type = 0; | 170 | public int Type = 0; |
94 | public int inv_type = 0; | 171 | public int InvType = 0; |
95 | public uint flags = 0; | 172 | public uint Flags = 0; |
96 | public string name = String.Empty; | 173 | public string Name = String.Empty; |
97 | public string desc = String.Empty; | 174 | public string Description = String.Empty; |
98 | public uint creation_date = 0; | 175 | public uint CreationDate = 0; |
99 | 176 | ||
100 | public LLUUID ParentPartID = LLUUID.Zero; | 177 | public LLUUID ParentPartID = LLUUID.Zero; |
101 | } | 178 | } |