diff options
author | Justin Clarke Casey | 2009-04-24 15:44:22 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-04-24 15:44:22 +0000 |
commit | 170cea5088b393f33ac0e7447ff910b0d13c1bdb (patch) | |
tree | 47c97b828ec9e4df3b134dda5452b15e9d340d8e /OpenSim | |
parent | * Write basic, incomplete load iar test (diff) | |
download | opensim-SC_OLD-170cea5088b393f33ac0e7447ff910b0d13c1bdb.zip opensim-SC_OLD-170cea5088b393f33ac0e7447ff910b0d13c1bdb.tar.gz opensim-SC_OLD-170cea5088b393f33ac0e7447ff910b0d13c1bdb.tar.bz2 opensim-SC_OLD-170cea5088b393f33ac0e7447ff910b0d13c1bdb.tar.xz |
* minor: make inventory item deserialization code easier to read
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs | 78 |
1 files changed, 26 insertions, 52 deletions
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index 5fd5ab5..b9c6206 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs | |||
@@ -64,59 +64,33 @@ namespace OpenSim.Framework.Serialization.External | |||
64 | InventoryItemBase item = new InventoryItemBase(); | 64 | InventoryItemBase item = new InventoryItemBase(); |
65 | 65 | ||
66 | StringReader sr = new StringReader(serialization); | 66 | StringReader sr = new StringReader(serialization); |
67 | XmlTextReader reader = new XmlTextReader(sr); | 67 | XmlTextReader xtr = new XmlTextReader(sr); |
68 | 68 | ||
69 | reader.ReadStartElement("InventoryItem"); | 69 | xtr.ReadStartElement("InventoryItem"); |
70 | reader.ReadStartElement("Name"); | 70 | |
71 | item.Name = reader.ReadString(); | 71 | item.Name = xtr.ReadElementString("Name"); |
72 | reader.ReadEndElement(); | 72 | item.ID = UUID.Parse( xtr.ReadElementString("ID")); |
73 | reader.ReadStartElement("ID"); | 73 | item.InvType = Convert.ToInt32( xtr.ReadElementString("InvType")); |
74 | item.ID = UUID.Parse(reader.ReadString()); | 74 | item.CreatorId = xtr.ReadElementString("CreatorUUID"); |
75 | reader.ReadEndElement(); | 75 | item.CreationDate = Convert.ToInt32( xtr.ReadElementString("CreationDate")); |
76 | reader.ReadStartElement("InvType"); | 76 | item.Owner = UUID.Parse( xtr.ReadElementString("Owner")); |
77 | item.InvType = Convert.ToInt32(reader.ReadString()); | 77 | item.Description = xtr.ReadElementString("Description"); |
78 | reader.ReadEndElement(); | 78 | item.AssetType = Convert.ToInt32( xtr.ReadElementString("AssetType")); |
79 | item.CreatorId = reader.ReadElementString("CreatorUUID"); | 79 | item.AssetID = UUID.Parse( xtr.ReadElementString("AssetID")); |
80 | reader.ReadStartElement("CreationDate"); | 80 | item.SaleType = Convert.ToByte( xtr.ReadElementString("SaleType")); |
81 | item.CreationDate = Convert.ToInt32(reader.ReadString()); | 81 | item.SalePrice = Convert.ToInt32( xtr.ReadElementString("SalePrice")); |
82 | reader.ReadEndElement(); | 82 | item.BasePermissions = Convert.ToUInt32( xtr.ReadElementString("BasePermissions")); |
83 | reader.ReadStartElement("Owner"); | 83 | item.CurrentPermissions = Convert.ToUInt32( xtr.ReadElementString("CurrentPermissions")); |
84 | item.Owner = UUID.Parse(reader.ReadString()); | 84 | item.EveryOnePermissions = Convert.ToUInt32( xtr.ReadElementString("EveryOnePermssions")); |
85 | reader.ReadEndElement(); | 85 | item.NextPermissions = Convert.ToUInt32( xtr.ReadElementString("NextPermissions")); |
86 | reader.ReadElementString("Description"); | 86 | item.Flags = Convert.ToUInt32( xtr.ReadElementString("Flags")); |
87 | reader.ReadStartElement("AssetType"); | 87 | item.GroupID = UUID.Parse( xtr.ReadElementString("GroupID")); |
88 | item.AssetType = Convert.ToInt32(reader.ReadString()); | 88 | item.GroupOwned = Convert.ToBoolean(xtr.ReadElementString("GroupOwned")); |
89 | reader.ReadEndElement(); | 89 | |
90 | reader.ReadStartElement("AssetID"); | 90 | xtr.ReadEndElement(); |
91 | item.AssetID = UUID.Parse(reader.ReadString()); | 91 | |
92 | reader.ReadEndElement(); | 92 | xtr.Close(); |
93 | reader.ReadStartElement("SaleType"); | 93 | sr.Close(); |
94 | item.SaleType = Convert.ToByte(reader.ReadString()); | ||
95 | reader.ReadEndElement(); | ||
96 | reader.ReadStartElement("SalePrice"); | ||
97 | item.SalePrice = Convert.ToInt32(reader.ReadString()); | ||
98 | reader.ReadEndElement(); | ||
99 | reader.ReadStartElement("BasePermissions"); | ||
100 | item.BasePermissions = Convert.ToUInt32(reader.ReadString()); | ||
101 | reader.ReadEndElement(); | ||
102 | reader.ReadStartElement("CurrentPermissions"); | ||
103 | item.CurrentPermissions = Convert.ToUInt32(reader.ReadString()); | ||
104 | reader.ReadEndElement(); | ||
105 | reader.ReadStartElement("EveryOnePermssions"); | ||
106 | item.EveryOnePermissions = Convert.ToUInt32(reader.ReadString()); | ||
107 | reader.ReadEndElement(); | ||
108 | reader.ReadStartElement("NextPermissions"); | ||
109 | item.NextPermissions = Convert.ToUInt32(reader.ReadString()); | ||
110 | reader.ReadEndElement(); | ||
111 | reader.ReadStartElement("Flags"); | ||
112 | item.Flags = Convert.ToUInt32(reader.ReadString()); | ||
113 | reader.ReadEndElement(); | ||
114 | reader.ReadStartElement("GroupID"); | ||
115 | item.GroupID = UUID.Parse(reader.ReadString()); | ||
116 | reader.ReadEndElement(); | ||
117 | reader.ReadStartElement("GroupOwned"); | ||
118 | item.GroupOwned = Convert.ToBoolean(reader.ReadString()); | ||
119 | reader.ReadEndElement(); | ||
120 | 94 | ||
121 | return item; | 95 | return item; |
122 | } | 96 | } |