diff options
author | Mike Mazur | 2009-02-16 02:25:44 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-16 02:25:44 +0000 |
commit | 16fa7f516a484e9f21fac34262214b3d9d761823 (patch) | |
tree | 925c10831c04d053b707857ffa785482316d4dcb /OpenSim/Grid/AssetInventoryServer/Utils.cs | |
parent | Added OpenSim asset frontend plugin. (diff) | |
download | opensim-SC_OLD-16fa7f516a484e9f21fac34262214b3d9d761823.zip opensim-SC_OLD-16fa7f516a484e9f21fac34262214b3d9d761823.tar.gz opensim-SC_OLD-16fa7f516a484e9f21fac34262214b3d9d761823.tar.bz2 opensim-SC_OLD-16fa7f516a484e9f21fac34262214b3d9d761823.tar.xz |
Converted to Linux newlines.
Diffstat (limited to 'OpenSim/Grid/AssetInventoryServer/Utils.cs')
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/Utils.cs | 2068 |
1 files changed, 1034 insertions, 1034 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Utils.cs b/OpenSim/Grid/AssetInventoryServer/Utils.cs index a81a0ba..e1b62a4 100644 --- a/OpenSim/Grid/AssetInventoryServer/Utils.cs +++ b/OpenSim/Grid/AssetInventoryServer/Utils.cs | |||
@@ -1,1034 +1,1034 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2008 Intel Corporation | 2 | * Copyright (c) 2008 Intel Corporation |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * Redistribution and use in source and binary forms, with or without | 4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions | 5 | * modification, are permitted provided that the following conditions |
6 | * are met: | 6 | * are met: |
7 | * | 7 | * |
8 | * -- Redistributions of source code must retain the above copyright | 8 | * -- Redistributions of source code must retain the above copyright |
9 | * notice, this list of conditions and the following disclaimer. | 9 | * notice, this list of conditions and the following disclaimer. |
10 | * -- Redistributions in binary form must reproduce the above copyright | 10 | * -- Redistributions in binary form must reproduce the above copyright |
11 | * notice, this list of conditions and the following disclaimer in the | 11 | * notice, this list of conditions and the following disclaimer in the |
12 | * documentation and/or other materials provided with the distribution. | 12 | * documentation and/or other materials provided with the distribution. |
13 | * -- Neither the name of the Intel Corporation nor the names of its | 13 | * -- Neither the name of the Intel Corporation nor the names of its |
14 | * contributors may be used to endorse or promote products derived from | 14 | * contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
18 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 18 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
20 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS | 20 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS |
21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
25 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 25 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
26 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 26 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections.Specialized; | 31 | using System.Collections.Specialized; |
32 | using System.Globalization; | 32 | using System.Globalization; |
33 | using System.Net; | 33 | using System.Net; |
34 | using System.Xml; | 34 | using System.Xml; |
35 | using System.Xml.Serialization; | 35 | using System.Xml.Serialization; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenMetaverse.StructuredData; | 37 | using OpenMetaverse.StructuredData; |
38 | using HttpServer; | 38 | using HttpServer; |
39 | 39 | ||
40 | namespace OpenSim.Grid.AssetInventoryServer | 40 | namespace OpenSim.Grid.AssetInventoryServer |
41 | { | 41 | { |
42 | public static class Utils | 42 | public static class Utils |
43 | { | 43 | { |
44 | public static UUID GetAuthToken(IHttpRequest request) | 44 | public static UUID GetAuthToken(IHttpRequest request) |
45 | { | 45 | { |
46 | UUID authToken = UUID.Zero; | 46 | UUID authToken = UUID.Zero; |
47 | 47 | ||
48 | string[] authHeader = request.Headers.GetValues("Authorization"); | 48 | string[] authHeader = request.Headers.GetValues("Authorization"); |
49 | if (authHeader != null && authHeader.Length == 1) | 49 | if (authHeader != null && authHeader.Length == 1) |
50 | { | 50 | { |
51 | // Example header: | 51 | // Example header: |
52 | // Authorization: OpenGrid 65fda0b5-4446-42f5-b828-aaf644293646 | 52 | // Authorization: OpenGrid 65fda0b5-4446-42f5-b828-aaf644293646 |
53 | string[] authHeaderParts = authHeader[0].Split(' '); | 53 | string[] authHeaderParts = authHeader[0].Split(' '); |
54 | if (authHeaderParts.Length == 2 && authHeaderParts[0] == "OpenGrid") | 54 | if (authHeaderParts.Length == 2 && authHeaderParts[0] == "OpenGrid") |
55 | UUID.TryParse(authHeaderParts[1], out authToken); | 55 | UUID.TryParse(authHeaderParts[1], out authToken); |
56 | } | 56 | } |
57 | 57 | ||
58 | if (authToken == UUID.Zero && request.Cookies != null) | 58 | if (authToken == UUID.Zero && request.Cookies != null) |
59 | { | 59 | { |
60 | // Check for an authToken cookie to make logins browser-compatible | 60 | // Check for an authToken cookie to make logins browser-compatible |
61 | RequestCookie authCookie = request.Cookies["authToken"]; | 61 | RequestCookie authCookie = request.Cookies["authToken"]; |
62 | if (authCookie != null) | 62 | if (authCookie != null) |
63 | UUID.TryParse(authCookie.Value, out authToken); | 63 | UUID.TryParse(authCookie.Value, out authToken); |
64 | } | 64 | } |
65 | 65 | ||
66 | return authToken; | 66 | return authToken; |
67 | } | 67 | } |
68 | 68 | ||
69 | public static Uri GetOpenSimUri(UUID avatarID) | 69 | public static Uri GetOpenSimUri(UUID avatarID) |
70 | { | 70 | { |
71 | return new Uri("http://opensim/" + avatarID.ToString()); | 71 | return new Uri("http://opensim/" + avatarID.ToString()); |
72 | } | 72 | } |
73 | 73 | ||
74 | public static bool TryGetOpenSimUUID(Uri avatarUri, out UUID avatarID) | 74 | public static bool TryGetOpenSimUUID(Uri avatarUri, out UUID avatarID) |
75 | { | 75 | { |
76 | string[] parts = avatarUri.Segments; | 76 | string[] parts = avatarUri.Segments; |
77 | return UUID.TryParse(parts[parts.Length - 1], out avatarID); | 77 | return UUID.TryParse(parts[parts.Length - 1], out avatarID); |
78 | } | 78 | } |
79 | 79 | ||
80 | #region SL / file extension / content-type conversions | 80 | #region SL / file extension / content-type conversions |
81 | 81 | ||
82 | public static string SLAssetTypeToContentType(int assetType) | 82 | public static string SLAssetTypeToContentType(int assetType) |
83 | { | 83 | { |
84 | switch (assetType) | 84 | switch (assetType) |
85 | { | 85 | { |
86 | case 0: | 86 | case 0: |
87 | return "image/jp2"; | 87 | return "image/jp2"; |
88 | case 1: | 88 | case 1: |
89 | return "application/ogg"; | 89 | return "application/ogg"; |
90 | case 2: | 90 | case 2: |
91 | return "application/x-metaverse-callingcard"; | 91 | return "application/x-metaverse-callingcard"; |
92 | case 3: | 92 | case 3: |
93 | return "application/x-metaverse-landmark"; | 93 | return "application/x-metaverse-landmark"; |
94 | case 5: | 94 | case 5: |
95 | return "application/x-metaverse-clothing"; | 95 | return "application/x-metaverse-clothing"; |
96 | case 6: | 96 | case 6: |
97 | return "application/x-metaverse-primitive"; | 97 | return "application/x-metaverse-primitive"; |
98 | case 7: | 98 | case 7: |
99 | return "application/x-metaverse-notecard"; | 99 | return "application/x-metaverse-notecard"; |
100 | case 8: | 100 | case 8: |
101 | return "application/x-metaverse-folder"; | 101 | return "application/x-metaverse-folder"; |
102 | case 10: | 102 | case 10: |
103 | return "application/x-metaverse-lsl"; | 103 | return "application/x-metaverse-lsl"; |
104 | case 11: | 104 | case 11: |
105 | return "application/x-metaverse-lso"; | 105 | return "application/x-metaverse-lso"; |
106 | case 12: | 106 | case 12: |
107 | return "image/tga"; | 107 | return "image/tga"; |
108 | case 13: | 108 | case 13: |
109 | return "application/x-metaverse-bodypart"; | 109 | return "application/x-metaverse-bodypart"; |
110 | case 17: | 110 | case 17: |
111 | return "audio/x-wav"; | 111 | return "audio/x-wav"; |
112 | case 19: | 112 | case 19: |
113 | return "image/jpeg"; | 113 | return "image/jpeg"; |
114 | case 20: | 114 | case 20: |
115 | return "application/x-metaverse-animation"; | 115 | return "application/x-metaverse-animation"; |
116 | case 21: | 116 | case 21: |
117 | return "application/x-metaverse-gesture"; | 117 | return "application/x-metaverse-gesture"; |
118 | case 22: | 118 | case 22: |
119 | return "application/x-metaverse-simstate"; | 119 | return "application/x-metaverse-simstate"; |
120 | default: | 120 | default: |
121 | return "application/octet-stream"; | 121 | return "application/octet-stream"; |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | public static int ContentTypeToSLAssetType(string contentType) | 125 | public static int ContentTypeToSLAssetType(string contentType) |
126 | { | 126 | { |
127 | switch (contentType) | 127 | switch (contentType) |
128 | { | 128 | { |
129 | case "image/jp2": | 129 | case "image/jp2": |
130 | return 0; | 130 | return 0; |
131 | case "application/ogg": | 131 | case "application/ogg": |
132 | return 1; | 132 | return 1; |
133 | case "application/x-metaverse-callingcard": | 133 | case "application/x-metaverse-callingcard": |
134 | return 2; | 134 | return 2; |
135 | case "application/x-metaverse-landmark": | 135 | case "application/x-metaverse-landmark": |
136 | return 3; | 136 | return 3; |
137 | case "application/x-metaverse-clothing": | 137 | case "application/x-metaverse-clothing": |
138 | return 5; | 138 | return 5; |
139 | case "application/x-metaverse-primitive": | 139 | case "application/x-metaverse-primitive": |
140 | return 6; | 140 | return 6; |
141 | case "application/x-metaverse-notecard": | 141 | case "application/x-metaverse-notecard": |
142 | return 7; | 142 | return 7; |
143 | case "application/x-metaverse-lsl": | 143 | case "application/x-metaverse-lsl": |
144 | return 10; | 144 | return 10; |
145 | case "application/x-metaverse-lso": | 145 | case "application/x-metaverse-lso": |
146 | return 11; | 146 | return 11; |
147 | case "image/tga": | 147 | case "image/tga": |
148 | return 12; | 148 | return 12; |
149 | case "application/x-metaverse-bodypart": | 149 | case "application/x-metaverse-bodypart": |
150 | return 13; | 150 | return 13; |
151 | case "audio/x-wav": | 151 | case "audio/x-wav": |
152 | return 17; | 152 | return 17; |
153 | case "image/jpeg": | 153 | case "image/jpeg": |
154 | return 19; | 154 | return 19; |
155 | case "application/x-metaverse-animation": | 155 | case "application/x-metaverse-animation": |
156 | return 20; | 156 | return 20; |
157 | case "application/x-metaverse-gesture": | 157 | case "application/x-metaverse-gesture": |
158 | return 21; | 158 | return 21; |
159 | case "application/x-metaverse-simstate": | 159 | case "application/x-metaverse-simstate": |
160 | return 22; | 160 | return 22; |
161 | default: | 161 | default: |
162 | return -1; | 162 | return -1; |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | public static string ContentTypeToExtension(string contentType) | 166 | public static string ContentTypeToExtension(string contentType) |
167 | { | 167 | { |
168 | switch (contentType) | 168 | switch (contentType) |
169 | { | 169 | { |
170 | case "image/jp2": | 170 | case "image/jp2": |
171 | return "texture"; | 171 | return "texture"; |
172 | case "application/ogg": | 172 | case "application/ogg": |
173 | return "ogg"; | 173 | return "ogg"; |
174 | case "application/x-metaverse-callingcard": | 174 | case "application/x-metaverse-callingcard": |
175 | return "callingcard"; | 175 | return "callingcard"; |
176 | case "application/x-metaverse-landmark": | 176 | case "application/x-metaverse-landmark": |
177 | return "landmark"; | 177 | return "landmark"; |
178 | case "application/x-metaverse-clothing": | 178 | case "application/x-metaverse-clothing": |
179 | return "clothing"; | 179 | return "clothing"; |
180 | case "application/x-metaverse-primitive": | 180 | case "application/x-metaverse-primitive": |
181 | return "primitive"; | 181 | return "primitive"; |
182 | case "application/x-metaverse-notecard": | 182 | case "application/x-metaverse-notecard": |
183 | return "notecard"; | 183 | return "notecard"; |
184 | case "application/x-metaverse-lsl": | 184 | case "application/x-metaverse-lsl": |
185 | return "lsl"; | 185 | return "lsl"; |
186 | case "application/x-metaverse-lso": | 186 | case "application/x-metaverse-lso": |
187 | return "lso"; | 187 | return "lso"; |
188 | case "image/tga": | 188 | case "image/tga": |
189 | return "tga"; | 189 | return "tga"; |
190 | case "application/x-metaverse-bodypart": | 190 | case "application/x-metaverse-bodypart": |
191 | return "bodypart"; | 191 | return "bodypart"; |
192 | case "audio/x-wav": | 192 | case "audio/x-wav": |
193 | return "wav"; | 193 | return "wav"; |
194 | case "image/jpeg": | 194 | case "image/jpeg": |
195 | return "jpg"; | 195 | return "jpg"; |
196 | case "application/x-metaverse-animation": | 196 | case "application/x-metaverse-animation": |
197 | return "animation"; | 197 | return "animation"; |
198 | case "application/x-metaverse-gesture": | 198 | case "application/x-metaverse-gesture": |
199 | return "gesture"; | 199 | return "gesture"; |
200 | case "application/x-metaverse-simstate": | 200 | case "application/x-metaverse-simstate": |
201 | return "simstate"; | 201 | return "simstate"; |
202 | default: | 202 | default: |
203 | return "bin"; | 203 | return "bin"; |
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||
207 | public static string ExtensionToContentType(string extension) | 207 | public static string ExtensionToContentType(string extension) |
208 | { | 208 | { |
209 | switch (extension) | 209 | switch (extension) |
210 | { | 210 | { |
211 | case "texture": | 211 | case "texture": |
212 | case "jp2": | 212 | case "jp2": |
213 | case "j2c": | 213 | case "j2c": |
214 | return "image/jp2"; | 214 | return "image/jp2"; |
215 | case "sound": | 215 | case "sound": |
216 | case "ogg": | 216 | case "ogg": |
217 | return "application/ogg"; | 217 | return "application/ogg"; |
218 | case "callingcard": | 218 | case "callingcard": |
219 | return "application/x-metaverse-callingcard"; | 219 | return "application/x-metaverse-callingcard"; |
220 | case "landmark": | 220 | case "landmark": |
221 | return "application/x-metaverse-landmark"; | 221 | return "application/x-metaverse-landmark"; |
222 | case "clothing": | 222 | case "clothing": |
223 | return "application/x-metaverse-clothing"; | 223 | return "application/x-metaverse-clothing"; |
224 | case "primitive": | 224 | case "primitive": |
225 | return "application/x-metaverse-primitive"; | 225 | return "application/x-metaverse-primitive"; |
226 | case "notecard": | 226 | case "notecard": |
227 | return "application/x-metaverse-notecard"; | 227 | return "application/x-metaverse-notecard"; |
228 | case "lsl": | 228 | case "lsl": |
229 | return "application/x-metaverse-lsl"; | 229 | return "application/x-metaverse-lsl"; |
230 | case "lso": | 230 | case "lso": |
231 | return "application/x-metaverse-lso"; | 231 | return "application/x-metaverse-lso"; |
232 | case "tga": | 232 | case "tga": |
233 | return "image/tga"; | 233 | return "image/tga"; |
234 | case "bodypart": | 234 | case "bodypart": |
235 | return "application/x-metaverse-bodypart"; | 235 | return "application/x-metaverse-bodypart"; |
236 | case "wav": | 236 | case "wav": |
237 | return "audio/x-wav"; | 237 | return "audio/x-wav"; |
238 | case "jpg": | 238 | case "jpg": |
239 | case "jpeg": | 239 | case "jpeg": |
240 | return "image/jpeg"; | 240 | return "image/jpeg"; |
241 | case "animation": | 241 | case "animation": |
242 | return "application/x-metaverse-animation"; | 242 | return "application/x-metaverse-animation"; |
243 | case "gesture": | 243 | case "gesture": |
244 | return "application/x-metaverse-gesture"; | 244 | return "application/x-metaverse-gesture"; |
245 | case "simstate": | 245 | case "simstate": |
246 | return "application/x-metaverse-simstate"; | 246 | return "application/x-metaverse-simstate"; |
247 | case "txt": | 247 | case "txt": |
248 | return "text/plain"; | 248 | return "text/plain"; |
249 | case "xml": | 249 | case "xml": |
250 | return "application/xml"; | 250 | return "application/xml"; |
251 | default: | 251 | default: |
252 | return "application/octet-stream"; | 252 | return "application/octet-stream"; |
253 | } | 253 | } |
254 | } | 254 | } |
255 | 255 | ||
256 | #endregion SL / file extension / content-type conversions | 256 | #endregion SL / file extension / content-type conversions |
257 | 257 | ||
258 | #region XML Serialization | 258 | #region XML Serialization |
259 | 259 | ||
260 | public class GeneratedReader : XmlSerializationReader | 260 | public class GeneratedReader : XmlSerializationReader |
261 | { | 261 | { |
262 | public object ReadRoot_InventoryFolderBase() | 262 | public object ReadRoot_InventoryFolderBase() |
263 | { | 263 | { |
264 | Reader.MoveToContent(); | 264 | Reader.MoveToContent(); |
265 | if (Reader.LocalName != "InventoryFolderBase" || Reader.NamespaceURI != "") | 265 | if (Reader.LocalName != "InventoryFolderBase" || Reader.NamespaceURI != "") |
266 | throw CreateUnknownNodeException(); | 266 | throw CreateUnknownNodeException(); |
267 | return ReadObject_InventoryFolder(true, true); | 267 | return ReadObject_InventoryFolder(true, true); |
268 | } | 268 | } |
269 | 269 | ||
270 | public object ReadRoot_InventoryItemBase() | 270 | public object ReadRoot_InventoryItemBase() |
271 | { | 271 | { |
272 | Reader.MoveToContent(); | 272 | Reader.MoveToContent(); |
273 | if (Reader.LocalName != "InventoryItemBase" || Reader.NamespaceURI != "") | 273 | if (Reader.LocalName != "InventoryItemBase" || Reader.NamespaceURI != "") |
274 | throw CreateUnknownNodeException(); | 274 | throw CreateUnknownNodeException(); |
275 | return ReadObject_InventoryItem(true, true); | 275 | return ReadObject_InventoryItem(true, true); |
276 | } | 276 | } |
277 | 277 | ||
278 | public object ReadRoot_InventoryCollection() | 278 | public object ReadRoot_InventoryCollection() |
279 | { | 279 | { |
280 | Reader.MoveToContent(); | 280 | Reader.MoveToContent(); |
281 | if (Reader.LocalName != "InventoryCollection" || Reader.NamespaceURI != "") | 281 | if (Reader.LocalName != "InventoryCollection" || Reader.NamespaceURI != "") |
282 | throw CreateUnknownNodeException(); | 282 | throw CreateUnknownNodeException(); |
283 | return ReadObject_InventoryCollection(true, true); | 283 | return ReadObject_InventoryCollection(true, true); |
284 | } | 284 | } |
285 | 285 | ||
286 | public InventoryFolder ReadObject_InventoryFolder(bool isNullable, bool checkType) | 286 | public InventoryFolder ReadObject_InventoryFolder(bool isNullable, bool checkType) |
287 | { | 287 | { |
288 | InventoryFolder ob = null; | 288 | InventoryFolder ob = null; |
289 | if (isNullable && ReadNull()) return null; | 289 | if (isNullable && ReadNull()) return null; |
290 | 290 | ||
291 | if (checkType) | 291 | if (checkType) |
292 | { | 292 | { |
293 | System.Xml.XmlQualifiedName t = GetXsiType(); | 293 | System.Xml.XmlQualifiedName t = GetXsiType(); |
294 | if (t == null) | 294 | if (t == null) |
295 | { } | 295 | { } |
296 | else if (t.Name != "InventoryFolderBase" || t.Namespace != "") | 296 | else if (t.Name != "InventoryFolderBase" || t.Namespace != "") |
297 | throw CreateUnknownTypeException(t); | 297 | throw CreateUnknownTypeException(t); |
298 | } | 298 | } |
299 | 299 | ||
300 | ob = (InventoryFolder)Activator.CreateInstance(typeof(InventoryFolder), true); | 300 | ob = (InventoryFolder)Activator.CreateInstance(typeof(InventoryFolder), true); |
301 | 301 | ||
302 | Reader.MoveToElement(); | 302 | Reader.MoveToElement(); |
303 | 303 | ||
304 | while (Reader.MoveToNextAttribute()) | 304 | while (Reader.MoveToNextAttribute()) |
305 | { | 305 | { |
306 | if (IsXmlnsAttribute(Reader.Name)) | 306 | if (IsXmlnsAttribute(Reader.Name)) |
307 | { | 307 | { |
308 | } | 308 | } |
309 | else | 309 | else |
310 | { | 310 | { |
311 | UnknownNode(ob); | 311 | UnknownNode(ob); |
312 | } | 312 | } |
313 | } | 313 | } |
314 | 314 | ||
315 | Reader.MoveToElement(); | 315 | Reader.MoveToElement(); |
316 | Reader.MoveToElement(); | 316 | Reader.MoveToElement(); |
317 | if (Reader.IsEmptyElement) | 317 | if (Reader.IsEmptyElement) |
318 | { | 318 | { |
319 | Reader.Skip(); | 319 | Reader.Skip(); |
320 | return ob; | 320 | return ob; |
321 | } | 321 | } |
322 | 322 | ||
323 | Reader.ReadStartElement(); | 323 | Reader.ReadStartElement(); |
324 | Reader.MoveToContent(); | 324 | Reader.MoveToContent(); |
325 | 325 | ||
326 | bool b0 = false, b1 = false, b2 = false, b3 = false, b4 = false, b5 = false; | 326 | bool b0 = false, b1 = false, b2 = false, b3 = false, b4 = false, b5 = false; |
327 | 327 | ||
328 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) | 328 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) |
329 | { | 329 | { |
330 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) | 330 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) |
331 | { | 331 | { |
332 | if (Reader.LocalName == "Owner" && Reader.NamespaceURI == "" && !b1) | 332 | if (Reader.LocalName == "Owner" && Reader.NamespaceURI == "" && !b1) |
333 | { | 333 | { |
334 | b1 = true; | 334 | b1 = true; |
335 | ob.@Owner = ReadObject_UUID(false, true); | 335 | ob.@Owner = ReadObject_UUID(false, true); |
336 | } | 336 | } |
337 | else if (Reader.LocalName == "Version" && Reader.NamespaceURI == "" && !b5) | 337 | else if (Reader.LocalName == "Version" && Reader.NamespaceURI == "" && !b5) |
338 | { | 338 | { |
339 | b5 = true; | 339 | b5 = true; |
340 | string s6 = Reader.ReadElementString(); | 340 | string s6 = Reader.ReadElementString(); |
341 | ob.@Version = UInt16.Parse(s6, CultureInfo.InvariantCulture); | 341 | ob.@Version = UInt16.Parse(s6, CultureInfo.InvariantCulture); |
342 | } | 342 | } |
343 | else if (Reader.LocalName == "ID" && Reader.NamespaceURI == "" && !b3) | 343 | else if (Reader.LocalName == "ID" && Reader.NamespaceURI == "" && !b3) |
344 | { | 344 | { |
345 | b3 = true; | 345 | b3 = true; |
346 | ob.@ID = ReadObject_UUID(false, true); | 346 | ob.@ID = ReadObject_UUID(false, true); |
347 | } | 347 | } |
348 | else if (Reader.LocalName == "Type" && Reader.NamespaceURI == "" && !b4) | 348 | else if (Reader.LocalName == "Type" && Reader.NamespaceURI == "" && !b4) |
349 | { | 349 | { |
350 | b4 = true; | 350 | b4 = true; |
351 | string s7 = Reader.ReadElementString(); | 351 | string s7 = Reader.ReadElementString(); |
352 | ob.@Type = Int16.Parse(s7, CultureInfo.InvariantCulture); | 352 | ob.@Type = Int16.Parse(s7, CultureInfo.InvariantCulture); |
353 | } | 353 | } |
354 | else if (Reader.LocalName == "Name" && Reader.NamespaceURI == "" && !b0) | 354 | else if (Reader.LocalName == "Name" && Reader.NamespaceURI == "" && !b0) |
355 | { | 355 | { |
356 | b0 = true; | 356 | b0 = true; |
357 | string s8 = Reader.ReadElementString(); | 357 | string s8 = Reader.ReadElementString(); |
358 | ob.@Name = s8; | 358 | ob.@Name = s8; |
359 | } | 359 | } |
360 | else if (Reader.LocalName == "ParentID" && Reader.NamespaceURI == "" && !b2) | 360 | else if (Reader.LocalName == "ParentID" && Reader.NamespaceURI == "" && !b2) |
361 | { | 361 | { |
362 | b2 = true; | 362 | b2 = true; |
363 | ob.@ParentID = ReadObject_UUID(false, true); | 363 | ob.@ParentID = ReadObject_UUID(false, true); |
364 | } | 364 | } |
365 | else | 365 | else |
366 | { | 366 | { |
367 | UnknownNode(ob); | 367 | UnknownNode(ob); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | else | 370 | else |
371 | UnknownNode(ob); | 371 | UnknownNode(ob); |
372 | 372 | ||
373 | Reader.MoveToContent(); | 373 | Reader.MoveToContent(); |
374 | } | 374 | } |
375 | 375 | ||
376 | ReadEndElement(); | 376 | ReadEndElement(); |
377 | 377 | ||
378 | return ob; | 378 | return ob; |
379 | } | 379 | } |
380 | 380 | ||
381 | public InventoryItem ReadObject_InventoryItem(bool isNullable, bool checkType) | 381 | public InventoryItem ReadObject_InventoryItem(bool isNullable, bool checkType) |
382 | { | 382 | { |
383 | InventoryItem ob = null; | 383 | InventoryItem ob = null; |
384 | if (isNullable && ReadNull()) return null; | 384 | if (isNullable && ReadNull()) return null; |
385 | 385 | ||
386 | if (checkType) | 386 | if (checkType) |
387 | { | 387 | { |
388 | System.Xml.XmlQualifiedName t = GetXsiType(); | 388 | System.Xml.XmlQualifiedName t = GetXsiType(); |
389 | if (t == null) | 389 | if (t == null) |
390 | { } | 390 | { } |
391 | else if (t.Name != "InventoryItemBase" || t.Namespace != "") | 391 | else if (t.Name != "InventoryItemBase" || t.Namespace != "") |
392 | throw CreateUnknownTypeException(t); | 392 | throw CreateUnknownTypeException(t); |
393 | } | 393 | } |
394 | 394 | ||
395 | ob = (InventoryItem)Activator.CreateInstance(typeof(InventoryItem), true); | 395 | ob = (InventoryItem)Activator.CreateInstance(typeof(InventoryItem), true); |
396 | 396 | ||
397 | Reader.MoveToElement(); | 397 | Reader.MoveToElement(); |
398 | 398 | ||
399 | while (Reader.MoveToNextAttribute()) | 399 | while (Reader.MoveToNextAttribute()) |
400 | { | 400 | { |
401 | if (IsXmlnsAttribute(Reader.Name)) | 401 | if (IsXmlnsAttribute(Reader.Name)) |
402 | { | 402 | { |
403 | } | 403 | } |
404 | else | 404 | else |
405 | { | 405 | { |
406 | UnknownNode(ob); | 406 | UnknownNode(ob); |
407 | } | 407 | } |
408 | } | 408 | } |
409 | 409 | ||
410 | Reader.MoveToElement(); | 410 | Reader.MoveToElement(); |
411 | Reader.MoveToElement(); | 411 | Reader.MoveToElement(); |
412 | if (Reader.IsEmptyElement) | 412 | if (Reader.IsEmptyElement) |
413 | { | 413 | { |
414 | Reader.Skip(); | 414 | Reader.Skip(); |
415 | return ob; | 415 | return ob; |
416 | } | 416 | } |
417 | 417 | ||
418 | Reader.ReadStartElement(); | 418 | Reader.ReadStartElement(); |
419 | Reader.MoveToContent(); | 419 | Reader.MoveToContent(); |
420 | 420 | ||
421 | bool b9 = false, b10 = false, b11 = false, b12 = false, b13 = false, b14 = false, b15 = false, b16 = false, b17 = false, b18 = false, b19 = false, b20 = false, b21 = false, b22 = false, b23 = false, b24 = false, b25 = false, b26 = false, b27 = false, b28 = false; | 421 | bool b9 = false, b10 = false, b11 = false, b12 = false, b13 = false, b14 = false, b15 = false, b16 = false, b17 = false, b18 = false, b19 = false, b20 = false, b21 = false, b22 = false, b23 = false, b24 = false, b25 = false, b26 = false, b27 = false, b28 = false; |
422 | 422 | ||
423 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) | 423 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) |
424 | { | 424 | { |
425 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) | 425 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) |
426 | { | 426 | { |
427 | if (Reader.LocalName == "GroupPermissions" && Reader.NamespaceURI == "" && !b20) | 427 | if (Reader.LocalName == "GroupPermissions" && Reader.NamespaceURI == "" && !b20) |
428 | { | 428 | { |
429 | b20 = true; | 429 | b20 = true; |
430 | string s29 = Reader.ReadElementString(); | 430 | string s29 = Reader.ReadElementString(); |
431 | ob.@GroupPermissions = UInt32.Parse(s29, CultureInfo.InvariantCulture); | 431 | ob.@GroupPermissions = UInt32.Parse(s29, CultureInfo.InvariantCulture); |
432 | } | 432 | } |
433 | else if (Reader.LocalName == "AssetType" && Reader.NamespaceURI == "" && !b21) | 433 | else if (Reader.LocalName == "AssetType" && Reader.NamespaceURI == "" && !b21) |
434 | { | 434 | { |
435 | b21 = true; | 435 | b21 = true; |
436 | string s30 = Reader.ReadElementString(); | 436 | string s30 = Reader.ReadElementString(); |
437 | ob.@AssetType = Int32.Parse(s30, CultureInfo.InvariantCulture); | 437 | ob.@AssetType = Int32.Parse(s30, CultureInfo.InvariantCulture); |
438 | } | 438 | } |
439 | else if (Reader.LocalName == "SalePrice" && Reader.NamespaceURI == "" && !b25) | 439 | else if (Reader.LocalName == "SalePrice" && Reader.NamespaceURI == "" && !b25) |
440 | { | 440 | { |
441 | b25 = true; | 441 | b25 = true; |
442 | string s31 = Reader.ReadElementString(); | 442 | string s31 = Reader.ReadElementString(); |
443 | ob.@SalePrice = Int32.Parse(s31, CultureInfo.InvariantCulture); | 443 | ob.@SalePrice = Int32.Parse(s31, CultureInfo.InvariantCulture); |
444 | } | 444 | } |
445 | else if (Reader.LocalName == "AssetID" && Reader.NamespaceURI == "" && !b22) | 445 | else if (Reader.LocalName == "AssetID" && Reader.NamespaceURI == "" && !b22) |
446 | { | 446 | { |
447 | b22 = true; | 447 | b22 = true; |
448 | ob.@AssetID = ReadObject_UUID(false, true); | 448 | ob.@AssetID = ReadObject_UUID(false, true); |
449 | } | 449 | } |
450 | else if (Reader.LocalName == "Folder" && Reader.NamespaceURI == "" && !b11) | 450 | else if (Reader.LocalName == "Folder" && Reader.NamespaceURI == "" && !b11) |
451 | { | 451 | { |
452 | b11 = true; | 452 | b11 = true; |
453 | ob.@Folder = ReadObject_UUID(false, true); | 453 | ob.@Folder = ReadObject_UUID(false, true); |
454 | } | 454 | } |
455 | else if (Reader.LocalName == "Name" && Reader.NamespaceURI == "" && !b14) | 455 | else if (Reader.LocalName == "Name" && Reader.NamespaceURI == "" && !b14) |
456 | { | 456 | { |
457 | b14 = true; | 457 | b14 = true; |
458 | string s32 = Reader.ReadElementString(); | 458 | string s32 = Reader.ReadElementString(); |
459 | ob.@Name = s32; | 459 | ob.@Name = s32; |
460 | } | 460 | } |
461 | else if (Reader.LocalName == "NextPermissions" && Reader.NamespaceURI == "" && !b16) | 461 | else if (Reader.LocalName == "NextPermissions" && Reader.NamespaceURI == "" && !b16) |
462 | { | 462 | { |
463 | b16 = true; | 463 | b16 = true; |
464 | string s33 = Reader.ReadElementString(); | 464 | string s33 = Reader.ReadElementString(); |
465 | ob.@NextPermissions = UInt32.Parse(s33, CultureInfo.InvariantCulture); | 465 | ob.@NextPermissions = UInt32.Parse(s33, CultureInfo.InvariantCulture); |
466 | } | 466 | } |
467 | else if (Reader.LocalName == "BasePermissions" && Reader.NamespaceURI == "" && !b18) | 467 | else if (Reader.LocalName == "BasePermissions" && Reader.NamespaceURI == "" && !b18) |
468 | { | 468 | { |
469 | b18 = true; | 469 | b18 = true; |
470 | string s34 = Reader.ReadElementString(); | 470 | string s34 = Reader.ReadElementString(); |
471 | ob.@BasePermissions = UInt32.Parse(s34, CultureInfo.InvariantCulture); | 471 | ob.@BasePermissions = UInt32.Parse(s34, CultureInfo.InvariantCulture); |
472 | } | 472 | } |
473 | else if (Reader.LocalName == "ID" && Reader.NamespaceURI == "" && !b9) | 473 | else if (Reader.LocalName == "ID" && Reader.NamespaceURI == "" && !b9) |
474 | { | 474 | { |
475 | b9 = true; | 475 | b9 = true; |
476 | ob.@ID = ReadObject_UUID(false, true); | 476 | ob.@ID = ReadObject_UUID(false, true); |
477 | } | 477 | } |
478 | else if (Reader.LocalName == "Flags" && Reader.NamespaceURI == "" && !b27) | 478 | else if (Reader.LocalName == "Flags" && Reader.NamespaceURI == "" && !b27) |
479 | { | 479 | { |
480 | b27 = true; | 480 | b27 = true; |
481 | string s35 = Reader.ReadElementString(); | 481 | string s35 = Reader.ReadElementString(); |
482 | ob.@Flags = UInt32.Parse(s35, CultureInfo.InvariantCulture); | 482 | ob.@Flags = UInt32.Parse(s35, CultureInfo.InvariantCulture); |
483 | } | 483 | } |
484 | else if (Reader.LocalName == "GroupOwned" && Reader.NamespaceURI == "" && !b24) | 484 | else if (Reader.LocalName == "GroupOwned" && Reader.NamespaceURI == "" && !b24) |
485 | { | 485 | { |
486 | b24 = true; | 486 | b24 = true; |
487 | string s36 = Reader.ReadElementString(); | 487 | string s36 = Reader.ReadElementString(); |
488 | ob.@GroupOwned = XmlConvert.ToBoolean(s36); | 488 | ob.@GroupOwned = XmlConvert.ToBoolean(s36); |
489 | } | 489 | } |
490 | else if (Reader.LocalName == "InvType" && Reader.NamespaceURI == "" && !b10) | 490 | else if (Reader.LocalName == "InvType" && Reader.NamespaceURI == "" && !b10) |
491 | { | 491 | { |
492 | b10 = true; | 492 | b10 = true; |
493 | string s37 = Reader.ReadElementString(); | 493 | string s37 = Reader.ReadElementString(); |
494 | ob.@InvType = Int32.Parse(s37, CultureInfo.InvariantCulture); | 494 | ob.@InvType = Int32.Parse(s37, CultureInfo.InvariantCulture); |
495 | } | 495 | } |
496 | else if (Reader.LocalName == "GroupID" && Reader.NamespaceURI == "" && !b23) | 496 | else if (Reader.LocalName == "GroupID" && Reader.NamespaceURI == "" && !b23) |
497 | { | 497 | { |
498 | b23 = true; | 498 | b23 = true; |
499 | ob.@GroupID = ReadObject_UUID(false, true); | 499 | ob.@GroupID = ReadObject_UUID(false, true); |
500 | } | 500 | } |
501 | else if (Reader.LocalName == "Description" && Reader.NamespaceURI == "" && !b15) | 501 | else if (Reader.LocalName == "Description" && Reader.NamespaceURI == "" && !b15) |
502 | { | 502 | { |
503 | b15 = true; | 503 | b15 = true; |
504 | string s38 = Reader.ReadElementString(); | 504 | string s38 = Reader.ReadElementString(); |
505 | ob.@Description = s38; | 505 | ob.@Description = s38; |
506 | } | 506 | } |
507 | else if (Reader.LocalName == "CreationDate" && Reader.NamespaceURI == "" && !b28) | 507 | else if (Reader.LocalName == "CreationDate" && Reader.NamespaceURI == "" && !b28) |
508 | { | 508 | { |
509 | b28 = true; | 509 | b28 = true; |
510 | string s39 = Reader.ReadElementString(); | 510 | string s39 = Reader.ReadElementString(); |
511 | ob.@CreationDate = Int32.Parse(s39, CultureInfo.InvariantCulture); | 511 | ob.@CreationDate = Int32.Parse(s39, CultureInfo.InvariantCulture); |
512 | } | 512 | } |
513 | else if (Reader.LocalName == "EveryOnePermissions" && Reader.NamespaceURI == "" && !b19) | 513 | else if (Reader.LocalName == "EveryOnePermissions" && Reader.NamespaceURI == "" && !b19) |
514 | { | 514 | { |
515 | b19 = true; | 515 | b19 = true; |
516 | string s40 = Reader.ReadElementString(); | 516 | string s40 = Reader.ReadElementString(); |
517 | ob.@EveryOnePermissions = UInt32.Parse(s40, CultureInfo.InvariantCulture); | 517 | ob.@EveryOnePermissions = UInt32.Parse(s40, CultureInfo.InvariantCulture); |
518 | } | 518 | } |
519 | else if (Reader.LocalName == "Creator" && Reader.NamespaceURI == "" && !b13) | 519 | else if (Reader.LocalName == "Creator" && Reader.NamespaceURI == "" && !b13) |
520 | { | 520 | { |
521 | b13 = true; | 521 | b13 = true; |
522 | ob.@Creator = ReadObject_UUID(false, true); | 522 | ob.@Creator = ReadObject_UUID(false, true); |
523 | } | 523 | } |
524 | else if (Reader.LocalName == "Owner" && Reader.NamespaceURI == "" && !b12) | 524 | else if (Reader.LocalName == "Owner" && Reader.NamespaceURI == "" && !b12) |
525 | { | 525 | { |
526 | b12 = true; | 526 | b12 = true; |
527 | ob.@Owner = ReadObject_UUID(false, true); | 527 | ob.@Owner = ReadObject_UUID(false, true); |
528 | } | 528 | } |
529 | else if (Reader.LocalName == "SaleType" && Reader.NamespaceURI == "" && !b26) | 529 | else if (Reader.LocalName == "SaleType" && Reader.NamespaceURI == "" && !b26) |
530 | { | 530 | { |
531 | b26 = true; | 531 | b26 = true; |
532 | string s41 = Reader.ReadElementString(); | 532 | string s41 = Reader.ReadElementString(); |
533 | ob.@SaleType = byte.Parse(s41, CultureInfo.InvariantCulture); | 533 | ob.@SaleType = byte.Parse(s41, CultureInfo.InvariantCulture); |
534 | } | 534 | } |
535 | else if (Reader.LocalName == "CurrentPermissions" && Reader.NamespaceURI == "" && !b17) | 535 | else if (Reader.LocalName == "CurrentPermissions" && Reader.NamespaceURI == "" && !b17) |
536 | { | 536 | { |
537 | b17 = true; | 537 | b17 = true; |
538 | string s42 = Reader.ReadElementString(); | 538 | string s42 = Reader.ReadElementString(); |
539 | ob.@CurrentPermissions = UInt32.Parse(s42, CultureInfo.InvariantCulture); | 539 | ob.@CurrentPermissions = UInt32.Parse(s42, CultureInfo.InvariantCulture); |
540 | } | 540 | } |
541 | else | 541 | else |
542 | { | 542 | { |
543 | UnknownNode(ob); | 543 | UnknownNode(ob); |
544 | } | 544 | } |
545 | } | 545 | } |
546 | else | 546 | else |
547 | UnknownNode(ob); | 547 | UnknownNode(ob); |
548 | 548 | ||
549 | Reader.MoveToContent(); | 549 | Reader.MoveToContent(); |
550 | } | 550 | } |
551 | 551 | ||
552 | ReadEndElement(); | 552 | ReadEndElement(); |
553 | 553 | ||
554 | return ob; | 554 | return ob; |
555 | } | 555 | } |
556 | 556 | ||
557 | public InventoryCollection ReadObject_InventoryCollection(bool isNullable, bool checkType) | 557 | public InventoryCollection ReadObject_InventoryCollection(bool isNullable, bool checkType) |
558 | { | 558 | { |
559 | InventoryCollection ob = null; | 559 | InventoryCollection ob = null; |
560 | if (isNullable && ReadNull()) return null; | 560 | if (isNullable && ReadNull()) return null; |
561 | 561 | ||
562 | if (checkType) | 562 | if (checkType) |
563 | { | 563 | { |
564 | System.Xml.XmlQualifiedName t = GetXsiType(); | 564 | System.Xml.XmlQualifiedName t = GetXsiType(); |
565 | if (t == null) | 565 | if (t == null) |
566 | { } | 566 | { } |
567 | else if (t.Name != "InventoryCollection" || t.Namespace != "") | 567 | else if (t.Name != "InventoryCollection" || t.Namespace != "") |
568 | throw CreateUnknownTypeException(t); | 568 | throw CreateUnknownTypeException(t); |
569 | } | 569 | } |
570 | 570 | ||
571 | ob = (InventoryCollection)Activator.CreateInstance(typeof(InventoryCollection), true); | 571 | ob = (InventoryCollection)Activator.CreateInstance(typeof(InventoryCollection), true); |
572 | 572 | ||
573 | Reader.MoveToElement(); | 573 | Reader.MoveToElement(); |
574 | 574 | ||
575 | while (Reader.MoveToNextAttribute()) | 575 | while (Reader.MoveToNextAttribute()) |
576 | { | 576 | { |
577 | if (IsXmlnsAttribute(Reader.Name)) | 577 | if (IsXmlnsAttribute(Reader.Name)) |
578 | { | 578 | { |
579 | } | 579 | } |
580 | else | 580 | else |
581 | { | 581 | { |
582 | UnknownNode(ob); | 582 | UnknownNode(ob); |
583 | } | 583 | } |
584 | } | 584 | } |
585 | 585 | ||
586 | Reader.MoveToElement(); | 586 | Reader.MoveToElement(); |
587 | Reader.MoveToElement(); | 587 | Reader.MoveToElement(); |
588 | if (Reader.IsEmptyElement) | 588 | if (Reader.IsEmptyElement) |
589 | { | 589 | { |
590 | Reader.Skip(); | 590 | Reader.Skip(); |
591 | if (ob.@Folders == null) | 591 | if (ob.@Folders == null) |
592 | { | 592 | { |
593 | ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); | 593 | ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); |
594 | } | 594 | } |
595 | if (ob.@Items == null) | 595 | if (ob.@Items == null) |
596 | { | 596 | { |
597 | ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); | 597 | ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); |
598 | } | 598 | } |
599 | return ob; | 599 | return ob; |
600 | } | 600 | } |
601 | 601 | ||
602 | Reader.ReadStartElement(); | 602 | Reader.ReadStartElement(); |
603 | Reader.MoveToContent(); | 603 | Reader.MoveToContent(); |
604 | 604 | ||
605 | bool b43 = false, b44 = false, b45 = false; | 605 | bool b43 = false, b44 = false, b45 = false; |
606 | 606 | ||
607 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) | 607 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) |
608 | { | 608 | { |
609 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) | 609 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) |
610 | { | 610 | { |
611 | if (Reader.LocalName == "UserID" && Reader.NamespaceURI == "" && !b45) | 611 | if (Reader.LocalName == "UserID" && Reader.NamespaceURI == "" && !b45) |
612 | { | 612 | { |
613 | b45 = true; | 613 | b45 = true; |
614 | ob.@UserID = ReadObject_UUID(false, true); | 614 | ob.@UserID = ReadObject_UUID(false, true); |
615 | } | 615 | } |
616 | else if (Reader.LocalName == "Items" && Reader.NamespaceURI == "" && !b44) | 616 | else if (Reader.LocalName == "Items" && Reader.NamespaceURI == "" && !b44) |
617 | { | 617 | { |
618 | System.Collections.Generic.Dictionary<UUID, InventoryItem> o46 = ob.@Items; | 618 | System.Collections.Generic.Dictionary<UUID, InventoryItem> o46 = ob.@Items; |
619 | if (((object)o46) == null) | 619 | if (((object)o46) == null) |
620 | { | 620 | { |
621 | o46 = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); | 621 | o46 = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); |
622 | ob.@Items = o46; | 622 | ob.@Items = o46; |
623 | } | 623 | } |
624 | if (Reader.IsEmptyElement) | 624 | if (Reader.IsEmptyElement) |
625 | { | 625 | { |
626 | Reader.Skip(); | 626 | Reader.Skip(); |
627 | } | 627 | } |
628 | else | 628 | else |
629 | { | 629 | { |
630 | int n47 = 0; | 630 | int n47 = 0; |
631 | Reader.ReadStartElement(); | 631 | Reader.ReadStartElement(); |
632 | Reader.MoveToContent(); | 632 | Reader.MoveToContent(); |
633 | 633 | ||
634 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) | 634 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) |
635 | { | 635 | { |
636 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) | 636 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) |
637 | { | 637 | { |
638 | if (Reader.LocalName == "InventoryItemBase" && Reader.NamespaceURI == "") | 638 | if (Reader.LocalName == "InventoryItemBase" && Reader.NamespaceURI == "") |
639 | { | 639 | { |
640 | if (((object)o46) == null) | 640 | if (((object)o46) == null) |
641 | throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryItemBase>"); | 641 | throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryItemBase>"); |
642 | InventoryItem item = ReadObject_InventoryItem(true, true); | 642 | InventoryItem item = ReadObject_InventoryItem(true, true); |
643 | o46.Add(item.ID, item); | 643 | o46.Add(item.ID, item); |
644 | n47++; | 644 | n47++; |
645 | } | 645 | } |
646 | else UnknownNode(null); | 646 | else UnknownNode(null); |
647 | } | 647 | } |
648 | else UnknownNode(null); | 648 | else UnknownNode(null); |
649 | 649 | ||
650 | Reader.MoveToContent(); | 650 | Reader.MoveToContent(); |
651 | } | 651 | } |
652 | ReadEndElement(); | 652 | ReadEndElement(); |
653 | } | 653 | } |
654 | b44 = true; | 654 | b44 = true; |
655 | } | 655 | } |
656 | else if (Reader.LocalName == "Folders" && Reader.NamespaceURI == "" && !b43) | 656 | else if (Reader.LocalName == "Folders" && Reader.NamespaceURI == "" && !b43) |
657 | { | 657 | { |
658 | System.Collections.Generic.Dictionary<UUID, InventoryFolder> o48 = ob.@Folders; | 658 | System.Collections.Generic.Dictionary<UUID, InventoryFolder> o48 = ob.@Folders; |
659 | if (((object)o48) == null) | 659 | if (((object)o48) == null) |
660 | { | 660 | { |
661 | o48 = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); | 661 | o48 = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); |
662 | ob.@Folders = o48; | 662 | ob.@Folders = o48; |
663 | } | 663 | } |
664 | if (Reader.IsEmptyElement) | 664 | if (Reader.IsEmptyElement) |
665 | { | 665 | { |
666 | Reader.Skip(); | 666 | Reader.Skip(); |
667 | } | 667 | } |
668 | else | 668 | else |
669 | { | 669 | { |
670 | int n49 = 0; | 670 | int n49 = 0; |
671 | Reader.ReadStartElement(); | 671 | Reader.ReadStartElement(); |
672 | Reader.MoveToContent(); | 672 | Reader.MoveToContent(); |
673 | 673 | ||
674 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) | 674 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) |
675 | { | 675 | { |
676 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) | 676 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) |
677 | { | 677 | { |
678 | if (Reader.LocalName == "InventoryFolderBase" && Reader.NamespaceURI == "") | 678 | if (Reader.LocalName == "InventoryFolderBase" && Reader.NamespaceURI == "") |
679 | { | 679 | { |
680 | if (((object)o48) == null) | 680 | if (((object)o48) == null) |
681 | throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryFolderBase>"); | 681 | throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryFolderBase>"); |
682 | InventoryFolder folder = ReadObject_InventoryFolder(true, true); | 682 | InventoryFolder folder = ReadObject_InventoryFolder(true, true); |
683 | o48.Add(folder.ID, folder); | 683 | o48.Add(folder.ID, folder); |
684 | n49++; | 684 | n49++; |
685 | } | 685 | } |
686 | else UnknownNode(null); | 686 | else UnknownNode(null); |
687 | } | 687 | } |
688 | else UnknownNode(null); | 688 | else UnknownNode(null); |
689 | 689 | ||
690 | Reader.MoveToContent(); | 690 | Reader.MoveToContent(); |
691 | } | 691 | } |
692 | ReadEndElement(); | 692 | ReadEndElement(); |
693 | } | 693 | } |
694 | b43 = true; | 694 | b43 = true; |
695 | } | 695 | } |
696 | else | 696 | else |
697 | { | 697 | { |
698 | UnknownNode(ob); | 698 | UnknownNode(ob); |
699 | } | 699 | } |
700 | } | 700 | } |
701 | else | 701 | else |
702 | UnknownNode(ob); | 702 | UnknownNode(ob); |
703 | 703 | ||
704 | Reader.MoveToContent(); | 704 | Reader.MoveToContent(); |
705 | } | 705 | } |
706 | if (ob.@Folders == null) | 706 | if (ob.@Folders == null) |
707 | { | 707 | { |
708 | ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); | 708 | ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); |
709 | } | 709 | } |
710 | if (ob.@Items == null) | 710 | if (ob.@Items == null) |
711 | { | 711 | { |
712 | ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); | 712 | ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); |
713 | } | 713 | } |
714 | 714 | ||
715 | ReadEndElement(); | 715 | ReadEndElement(); |
716 | 716 | ||
717 | return ob; | 717 | return ob; |
718 | } | 718 | } |
719 | 719 | ||
720 | public OpenMetaverse.UUID ReadObject_UUID(bool isNullable, bool checkType) | 720 | public OpenMetaverse.UUID ReadObject_UUID(bool isNullable, bool checkType) |
721 | { | 721 | { |
722 | OpenMetaverse.UUID ob = (OpenMetaverse.UUID)Activator.CreateInstance(typeof(OpenMetaverse.UUID), true); | 722 | OpenMetaverse.UUID ob = (OpenMetaverse.UUID)Activator.CreateInstance(typeof(OpenMetaverse.UUID), true); |
723 | System.Xml.XmlQualifiedName t = GetXsiType(); | 723 | System.Xml.XmlQualifiedName t = GetXsiType(); |
724 | if (t == null) | 724 | if (t == null) |
725 | { } | 725 | { } |
726 | else if (t.Name != "UUID" || t.Namespace != "") | 726 | else if (t.Name != "UUID" || t.Namespace != "") |
727 | throw CreateUnknownTypeException(t); | 727 | throw CreateUnknownTypeException(t); |
728 | 728 | ||
729 | Reader.MoveToElement(); | 729 | Reader.MoveToElement(); |
730 | 730 | ||
731 | while (Reader.MoveToNextAttribute()) | 731 | while (Reader.MoveToNextAttribute()) |
732 | { | 732 | { |
733 | if (IsXmlnsAttribute(Reader.Name)) | 733 | if (IsXmlnsAttribute(Reader.Name)) |
734 | { | 734 | { |
735 | } | 735 | } |
736 | else | 736 | else |
737 | { | 737 | { |
738 | UnknownNode(ob); | 738 | UnknownNode(ob); |
739 | } | 739 | } |
740 | } | 740 | } |
741 | 741 | ||
742 | Reader.MoveToElement(); | 742 | Reader.MoveToElement(); |
743 | Reader.MoveToElement(); | 743 | Reader.MoveToElement(); |
744 | if (Reader.IsEmptyElement) | 744 | if (Reader.IsEmptyElement) |
745 | { | 745 | { |
746 | Reader.Skip(); | 746 | Reader.Skip(); |
747 | return ob; | 747 | return ob; |
748 | } | 748 | } |
749 | 749 | ||
750 | Reader.ReadStartElement(); | 750 | Reader.ReadStartElement(); |
751 | Reader.MoveToContent(); | 751 | Reader.MoveToContent(); |
752 | 752 | ||
753 | bool b52 = false; | 753 | bool b52 = false; |
754 | 754 | ||
755 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) | 755 | while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) |
756 | { | 756 | { |
757 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) | 757 | if (Reader.NodeType == System.Xml.XmlNodeType.Element) |
758 | { | 758 | { |
759 | if (Reader.LocalName == "Guid" && Reader.NamespaceURI == "" && !b52) | 759 | if (Reader.LocalName == "Guid" && Reader.NamespaceURI == "" && !b52) |
760 | { | 760 | { |
761 | b52 = true; | 761 | b52 = true; |
762 | string s53 = Reader.ReadElementString(); | 762 | string s53 = Reader.ReadElementString(); |
763 | ob.@Guid = XmlConvert.ToGuid(s53); | 763 | ob.@Guid = XmlConvert.ToGuid(s53); |
764 | } | 764 | } |
765 | else | 765 | else |
766 | { | 766 | { |
767 | UnknownNode(ob); | 767 | UnknownNode(ob); |
768 | } | 768 | } |
769 | } | 769 | } |
770 | else | 770 | else |
771 | UnknownNode(ob); | 771 | UnknownNode(ob); |
772 | 772 | ||
773 | Reader.MoveToContent(); | 773 | Reader.MoveToContent(); |
774 | } | 774 | } |
775 | 775 | ||
776 | ReadEndElement(); | 776 | ReadEndElement(); |
777 | 777 | ||
778 | return ob; | 778 | return ob; |
779 | } | 779 | } |
780 | 780 | ||
781 | protected override void InitCallbacks() | 781 | protected override void InitCallbacks() |
782 | { | 782 | { |
783 | } | 783 | } |
784 | 784 | ||
785 | protected override void InitIDs() | 785 | protected override void InitIDs() |
786 | { | 786 | { |
787 | } | 787 | } |
788 | } | 788 | } |
789 | 789 | ||
790 | public class GeneratedWriter : XmlSerializationWriter | 790 | public class GeneratedWriter : XmlSerializationWriter |
791 | { | 791 | { |
792 | const string xmlNamespace = "http://www.w3.org/2000/xmlns/"; | 792 | const string xmlNamespace = "http://www.w3.org/2000/xmlns/"; |
793 | static readonly System.Reflection.MethodInfo toBinHexStringMethod = typeof(XmlConvert).GetMethod("ToBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type[] { typeof(byte[]) }, null); | 793 | static readonly System.Reflection.MethodInfo toBinHexStringMethod = typeof(XmlConvert).GetMethod("ToBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type[] { typeof(byte[]) }, null); |
794 | static string ToBinHexString(byte[] input) | 794 | static string ToBinHexString(byte[] input) |
795 | { | 795 | { |
796 | return input == null ? null : (string)toBinHexStringMethod.Invoke(null, new object[] { input }); | 796 | return input == null ? null : (string)toBinHexStringMethod.Invoke(null, new object[] { input }); |
797 | } | 797 | } |
798 | public void WriteRoot_InventoryFolder(object o) | 798 | public void WriteRoot_InventoryFolder(object o) |
799 | { | 799 | { |
800 | WriteStartDocument(); | 800 | WriteStartDocument(); |
801 | InventoryFolder ob = (InventoryFolder)o; | 801 | InventoryFolder ob = (InventoryFolder)o; |
802 | TopLevelElement(); | 802 | TopLevelElement(); |
803 | WriteObject_InventoryFolder(ob, "InventoryFolderBase", "", true, false, true); | 803 | WriteObject_InventoryFolder(ob, "InventoryFolderBase", "", true, false, true); |
804 | } | 804 | } |
805 | 805 | ||
806 | public void WriteRoot_InventoryItem(object o) | 806 | public void WriteRoot_InventoryItem(object o) |
807 | { | 807 | { |
808 | WriteStartDocument(); | 808 | WriteStartDocument(); |
809 | InventoryItem ob = (InventoryItem)o; | 809 | InventoryItem ob = (InventoryItem)o; |
810 | TopLevelElement(); | 810 | TopLevelElement(); |
811 | WriteObject_InventoryItem(ob, "InventoryItemBase", "", true, false, true); | 811 | WriteObject_InventoryItem(ob, "InventoryItemBase", "", true, false, true); |
812 | } | 812 | } |
813 | 813 | ||
814 | public void WriteRoot_InventoryCollection(object o) | 814 | public void WriteRoot_InventoryCollection(object o) |
815 | { | 815 | { |
816 | WriteStartDocument(); | 816 | WriteStartDocument(); |
817 | InventoryCollection ob = (InventoryCollection)o; | 817 | InventoryCollection ob = (InventoryCollection)o; |
818 | TopLevelElement(); | 818 | TopLevelElement(); |
819 | WriteObject_InventoryCollection(ob, "InventoryCollection", "", true, false, true); | 819 | WriteObject_InventoryCollection(ob, "InventoryCollection", "", true, false, true); |
820 | } | 820 | } |
821 | 821 | ||
822 | void WriteObject_InventoryFolder(InventoryFolder ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) | 822 | void WriteObject_InventoryFolder(InventoryFolder ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) |
823 | { | 823 | { |
824 | if (((object)ob) == null) | 824 | if (((object)ob) == null) |
825 | { | 825 | { |
826 | if (isNullable) | 826 | if (isNullable) |
827 | WriteNullTagLiteral(element, namesp); | 827 | WriteNullTagLiteral(element, namesp); |
828 | return; | 828 | return; |
829 | } | 829 | } |
830 | 830 | ||
831 | System.Type type = ob.GetType(); | 831 | System.Type type = ob.GetType(); |
832 | if (type == typeof(InventoryFolder)) | 832 | if (type == typeof(InventoryFolder)) |
833 | { } | 833 | { } |
834 | else | 834 | else |
835 | { | 835 | { |
836 | throw CreateUnknownTypeException(ob); | 836 | throw CreateUnknownTypeException(ob); |
837 | } | 837 | } |
838 | 838 | ||
839 | if (writeWrappingElem) | 839 | if (writeWrappingElem) |
840 | { | 840 | { |
841 | WriteStartElement(element, namesp, ob); | 841 | WriteStartElement(element, namesp, ob); |
842 | } | 842 | } |
843 | 843 | ||
844 | if (needType) WriteXsiType("InventoryFolderBase", ""); | 844 | if (needType) WriteXsiType("InventoryFolderBase", ""); |
845 | 845 | ||
846 | WriteElementString("Name", "", ob.@Name); | 846 | WriteElementString("Name", "", ob.@Name); |
847 | WriteObject_UUID(ob.@Owner, "Owner", "", false, false, true); | 847 | WriteObject_UUID(ob.@Owner, "Owner", "", false, false, true); |
848 | WriteObject_UUID(ob.@ParentID, "ParentID", "", false, false, true); | 848 | WriteObject_UUID(ob.@ParentID, "ParentID", "", false, false, true); |
849 | WriteObject_UUID(ob.@ID, "ID", "", false, false, true); | 849 | WriteObject_UUID(ob.@ID, "ID", "", false, false, true); |
850 | WriteElementString("Type", "", ob.@Type.ToString(CultureInfo.InvariantCulture)); | 850 | WriteElementString("Type", "", ob.@Type.ToString(CultureInfo.InvariantCulture)); |
851 | WriteElementString("Version", "", ob.@Version.ToString(CultureInfo.InvariantCulture)); | 851 | WriteElementString("Version", "", ob.@Version.ToString(CultureInfo.InvariantCulture)); |
852 | if (writeWrappingElem) WriteEndElement(ob); | 852 | if (writeWrappingElem) WriteEndElement(ob); |
853 | } | 853 | } |
854 | 854 | ||
855 | void WriteObject_InventoryItem(InventoryItem ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) | 855 | void WriteObject_InventoryItem(InventoryItem ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) |
856 | { | 856 | { |
857 | if (((object)ob) == null) | 857 | if (((object)ob) == null) |
858 | { | 858 | { |
859 | if (isNullable) | 859 | if (isNullable) |
860 | WriteNullTagLiteral(element, namesp); | 860 | WriteNullTagLiteral(element, namesp); |
861 | return; | 861 | return; |
862 | } | 862 | } |
863 | 863 | ||
864 | System.Type type = ob.GetType(); | 864 | System.Type type = ob.GetType(); |
865 | if (type == typeof(InventoryItem)) | 865 | if (type == typeof(InventoryItem)) |
866 | { } | 866 | { } |
867 | else | 867 | else |
868 | { | 868 | { |
869 | throw CreateUnknownTypeException(ob); | 869 | throw CreateUnknownTypeException(ob); |
870 | } | 870 | } |
871 | 871 | ||
872 | if (writeWrappingElem) | 872 | if (writeWrappingElem) |
873 | { | 873 | { |
874 | WriteStartElement(element, namesp, ob); | 874 | WriteStartElement(element, namesp, ob); |
875 | } | 875 | } |
876 | 876 | ||
877 | if (needType) WriteXsiType("InventoryItemBase", ""); | 877 | if (needType) WriteXsiType("InventoryItemBase", ""); |
878 | 878 | ||
879 | WriteObject_UUID(ob.@ID, "ID", "", false, false, true); | 879 | WriteObject_UUID(ob.@ID, "ID", "", false, false, true); |
880 | WriteElementString("InvType", "", ob.@InvType.ToString(CultureInfo.InvariantCulture)); | 880 | WriteElementString("InvType", "", ob.@InvType.ToString(CultureInfo.InvariantCulture)); |
881 | WriteObject_UUID(ob.@Folder, "Folder", "", false, false, true); | 881 | WriteObject_UUID(ob.@Folder, "Folder", "", false, false, true); |
882 | WriteObject_UUID(ob.@Owner, "Owner", "", false, false, true); | 882 | WriteObject_UUID(ob.@Owner, "Owner", "", false, false, true); |
883 | WriteObject_UUID(ob.@Creator, "Creator", "", false, false, true); | 883 | WriteObject_UUID(ob.@Creator, "Creator", "", false, false, true); |
884 | WriteElementString("Name", "", ob.@Name); | 884 | WriteElementString("Name", "", ob.@Name); |
885 | WriteElementString("Description", "", ob.@Description); | 885 | WriteElementString("Description", "", ob.@Description); |
886 | WriteElementString("NextPermissions", "", ob.@NextPermissions.ToString(CultureInfo.InvariantCulture)); | 886 | WriteElementString("NextPermissions", "", ob.@NextPermissions.ToString(CultureInfo.InvariantCulture)); |
887 | WriteElementString("CurrentPermissions", "", ob.@CurrentPermissions.ToString(CultureInfo.InvariantCulture)); | 887 | WriteElementString("CurrentPermissions", "", ob.@CurrentPermissions.ToString(CultureInfo.InvariantCulture)); |
888 | WriteElementString("BasePermissions", "", ob.@BasePermissions.ToString(CultureInfo.InvariantCulture)); | 888 | WriteElementString("BasePermissions", "", ob.@BasePermissions.ToString(CultureInfo.InvariantCulture)); |
889 | WriteElementString("EveryOnePermissions", "", ob.@EveryOnePermissions.ToString(CultureInfo.InvariantCulture)); | 889 | WriteElementString("EveryOnePermissions", "", ob.@EveryOnePermissions.ToString(CultureInfo.InvariantCulture)); |
890 | WriteElementString("GroupPermissions", "", ob.@GroupPermissions.ToString(CultureInfo.InvariantCulture)); | 890 | WriteElementString("GroupPermissions", "", ob.@GroupPermissions.ToString(CultureInfo.InvariantCulture)); |
891 | WriteElementString("AssetType", "", ob.@AssetType.ToString(CultureInfo.InvariantCulture)); | 891 | WriteElementString("AssetType", "", ob.@AssetType.ToString(CultureInfo.InvariantCulture)); |
892 | WriteObject_UUID(ob.@AssetID, "AssetID", "", false, false, true); | 892 | WriteObject_UUID(ob.@AssetID, "AssetID", "", false, false, true); |
893 | WriteObject_UUID(ob.@GroupID, "GroupID", "", false, false, true); | 893 | WriteObject_UUID(ob.@GroupID, "GroupID", "", false, false, true); |
894 | WriteElementString("GroupOwned", "", (ob.@GroupOwned ? "true" : "false")); | 894 | WriteElementString("GroupOwned", "", (ob.@GroupOwned ? "true" : "false")); |
895 | WriteElementString("SalePrice", "", ob.@SalePrice.ToString(CultureInfo.InvariantCulture)); | 895 | WriteElementString("SalePrice", "", ob.@SalePrice.ToString(CultureInfo.InvariantCulture)); |
896 | WriteElementString("SaleType", "", ob.@SaleType.ToString(CultureInfo.InvariantCulture)); | 896 | WriteElementString("SaleType", "", ob.@SaleType.ToString(CultureInfo.InvariantCulture)); |
897 | WriteElementString("Flags", "", ob.@Flags.ToString(CultureInfo.InvariantCulture)); | 897 | WriteElementString("Flags", "", ob.@Flags.ToString(CultureInfo.InvariantCulture)); |
898 | WriteElementString("CreationDate", "", ob.@CreationDate.ToString(CultureInfo.InvariantCulture)); | 898 | WriteElementString("CreationDate", "", ob.@CreationDate.ToString(CultureInfo.InvariantCulture)); |
899 | if (writeWrappingElem) WriteEndElement(ob); | 899 | if (writeWrappingElem) WriteEndElement(ob); |
900 | } | 900 | } |
901 | 901 | ||
902 | void WriteObject_InventoryCollection(InventoryCollection ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) | 902 | void WriteObject_InventoryCollection(InventoryCollection ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) |
903 | { | 903 | { |
904 | if (((object)ob) == null) | 904 | if (((object)ob) == null) |
905 | { | 905 | { |
906 | if (isNullable) | 906 | if (isNullable) |
907 | WriteNullTagLiteral(element, namesp); | 907 | WriteNullTagLiteral(element, namesp); |
908 | return; | 908 | return; |
909 | } | 909 | } |
910 | 910 | ||
911 | System.Type type = ob.GetType(); | 911 | System.Type type = ob.GetType(); |
912 | if (type == typeof(InventoryCollection)) | 912 | if (type == typeof(InventoryCollection)) |
913 | { } | 913 | { } |
914 | else | 914 | else |
915 | { | 915 | { |
916 | throw CreateUnknownTypeException(ob); | 916 | throw CreateUnknownTypeException(ob); |
917 | } | 917 | } |
918 | 918 | ||
919 | if (writeWrappingElem) | 919 | if (writeWrappingElem) |
920 | { | 920 | { |
921 | WriteStartElement(element, namesp, ob); | 921 | WriteStartElement(element, namesp, ob); |
922 | } | 922 | } |
923 | 923 | ||
924 | if (needType) WriteXsiType("InventoryCollection", ""); | 924 | if (needType) WriteXsiType("InventoryCollection", ""); |
925 | 925 | ||
926 | if (ob.@Folders != null) | 926 | if (ob.@Folders != null) |
927 | { | 927 | { |
928 | WriteStartElement("Folders", "", ob.@Folders); | 928 | WriteStartElement("Folders", "", ob.@Folders); |
929 | foreach (InventoryFolder folder in ob.Folders.Values) | 929 | foreach (InventoryFolder folder in ob.Folders.Values) |
930 | { | 930 | { |
931 | WriteObject_InventoryFolder(folder, "InventoryFolderBase", "", true, false, true); | 931 | WriteObject_InventoryFolder(folder, "InventoryFolderBase", "", true, false, true); |
932 | } | 932 | } |
933 | WriteEndElement(ob.@Folders); | 933 | WriteEndElement(ob.@Folders); |
934 | } | 934 | } |
935 | if (ob.@Items != null) | 935 | if (ob.@Items != null) |
936 | { | 936 | { |
937 | WriteStartElement("Items", "", ob.@Items); | 937 | WriteStartElement("Items", "", ob.@Items); |
938 | foreach (InventoryItem item in ob.Items.Values) | 938 | foreach (InventoryItem item in ob.Items.Values) |
939 | { | 939 | { |
940 | WriteObject_InventoryItem(item, "InventoryItemBase", "", true, false, true); | 940 | WriteObject_InventoryItem(item, "InventoryItemBase", "", true, false, true); |
941 | } | 941 | } |
942 | WriteEndElement(ob.@Items); | 942 | WriteEndElement(ob.@Items); |
943 | } | 943 | } |
944 | WriteObject_UUID(ob.@UserID, "UserID", "", false, false, true); | 944 | WriteObject_UUID(ob.@UserID, "UserID", "", false, false, true); |
945 | if (writeWrappingElem) WriteEndElement(ob); | 945 | if (writeWrappingElem) WriteEndElement(ob); |
946 | } | 946 | } |
947 | 947 | ||
948 | void WriteObject_UUID(OpenMetaverse.UUID ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) | 948 | void WriteObject_UUID(OpenMetaverse.UUID ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) |
949 | { | 949 | { |
950 | System.Type type = ob.GetType(); | 950 | System.Type type = ob.GetType(); |
951 | if (type == typeof(OpenMetaverse.UUID)) | 951 | if (type == typeof(OpenMetaverse.UUID)) |
952 | { } | 952 | { } |
953 | else | 953 | else |
954 | { | 954 | { |
955 | throw CreateUnknownTypeException(ob); | 955 | throw CreateUnknownTypeException(ob); |
956 | } | 956 | } |
957 | 957 | ||
958 | if (writeWrappingElem) | 958 | if (writeWrappingElem) |
959 | { | 959 | { |
960 | WriteStartElement(element, namesp, ob); | 960 | WriteStartElement(element, namesp, ob); |
961 | } | 961 | } |
962 | 962 | ||
963 | if (needType) WriteXsiType("UUID", ""); | 963 | if (needType) WriteXsiType("UUID", ""); |
964 | 964 | ||
965 | WriteElementString("Guid", "", XmlConvert.ToString(ob.@Guid)); | 965 | WriteElementString("Guid", "", XmlConvert.ToString(ob.@Guid)); |
966 | if (writeWrappingElem) WriteEndElement(ob); | 966 | if (writeWrappingElem) WriteEndElement(ob); |
967 | } | 967 | } |
968 | 968 | ||
969 | protected override void InitCallbacks() | 969 | protected override void InitCallbacks() |
970 | { | 970 | { |
971 | } | 971 | } |
972 | 972 | ||
973 | } | 973 | } |
974 | 974 | ||
975 | public class BaseXmlSerializer : System.Xml.Serialization.XmlSerializer | 975 | public class BaseXmlSerializer : System.Xml.Serialization.XmlSerializer |
976 | { | 976 | { |
977 | protected override System.Xml.Serialization.XmlSerializationReader CreateReader() | 977 | protected override System.Xml.Serialization.XmlSerializationReader CreateReader() |
978 | { | 978 | { |
979 | return new GeneratedReader(); | 979 | return new GeneratedReader(); |
980 | } | 980 | } |
981 | 981 | ||
982 | protected override System.Xml.Serialization.XmlSerializationWriter CreateWriter() | 982 | protected override System.Xml.Serialization.XmlSerializationWriter CreateWriter() |
983 | { | 983 | { |
984 | return new GeneratedWriter(); | 984 | return new GeneratedWriter(); |
985 | } | 985 | } |
986 | 986 | ||
987 | public override bool CanDeserialize(System.Xml.XmlReader xmlReader) | 987 | public override bool CanDeserialize(System.Xml.XmlReader xmlReader) |
988 | { | 988 | { |
989 | return true; | 989 | return true; |
990 | } | 990 | } |
991 | } | 991 | } |
992 | 992 | ||
993 | public sealed class InventoryFolderSerializer : BaseXmlSerializer | 993 | public sealed class InventoryFolderSerializer : BaseXmlSerializer |
994 | { | 994 | { |
995 | protected override void Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer) | 995 | protected override void Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer) |
996 | { | 996 | { |
997 | ((GeneratedWriter)writer).WriteRoot_InventoryFolder(obj); | 997 | ((GeneratedWriter)writer).WriteRoot_InventoryFolder(obj); |
998 | } | 998 | } |
999 | 999 | ||
1000 | protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) | 1000 | protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) |
1001 | { | 1001 | { |
1002 | return ((GeneratedReader)reader).ReadRoot_InventoryFolderBase(); | 1002 | return ((GeneratedReader)reader).ReadRoot_InventoryFolderBase(); |
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | public sealed class InventoryItemSerializer : BaseXmlSerializer | 1006 | public sealed class InventoryItemSerializer : BaseXmlSerializer |
1007 | { | 1007 | { |
1008 | protected override void Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer) | 1008 | protected override void Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer) |
1009 | { | 1009 | { |
1010 | ((GeneratedWriter)writer).WriteRoot_InventoryItem(obj); | 1010 | ((GeneratedWriter)writer).WriteRoot_InventoryItem(obj); |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) | 1013 | protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) |
1014 | { | 1014 | { |
1015 | return ((GeneratedReader)reader).ReadRoot_InventoryItemBase(); | 1015 | return ((GeneratedReader)reader).ReadRoot_InventoryItemBase(); |
1016 | } | 1016 | } |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | public sealed class InventoryCollectionSerializer : BaseXmlSerializer | 1019 | public sealed class InventoryCollectionSerializer : BaseXmlSerializer |
1020 | { | 1020 | { |
1021 | protected override void Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer) | 1021 | protected override void Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer) |
1022 | { | 1022 | { |
1023 | ((GeneratedWriter)writer).WriteRoot_InventoryCollection(obj); | 1023 | ((GeneratedWriter)writer).WriteRoot_InventoryCollection(obj); |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) | 1026 | protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) |
1027 | { | 1027 | { |
1028 | return ((GeneratedReader)reader).ReadRoot_InventoryCollection(); | 1028 | return ((GeneratedReader)reader).ReadRoot_InventoryCollection(); |
1029 | } | 1029 | } |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | #endregion XML Serialization | 1032 | #endregion XML Serialization |
1033 | } | 1033 | } |
1034 | } | 1034 | } |