aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs1272
1 files changed, 636 insertions, 636 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs b/OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs
index a0ebba5..340e00c 100644
--- a/OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimInventoryFrontend.cs
@@ -1,636 +1,636 @@
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
30using System; 30using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Net; 32using System.Net;
33using System.IO; 33using System.IO;
34using System.Xml; 34using System.Xml;
35using ExtensionLoader; 35using ExtensionLoader;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
38using HttpServer; 38using HttpServer;
39 39
40namespace OpenSim.Grid.AssetInventoryServer.Extensions 40namespace OpenSim.Grid.AssetInventoryServer.Extensions
41{ 41{
42 public class OpenSimInventoryFrontend : IExtension<AssetInventoryServer> 42 public class OpenSimInventoryFrontend : IExtension<AssetInventoryServer>
43 { 43 {
44 AssetInventoryServer server; 44 AssetInventoryServer server;
45 Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer(); 45 Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
46 Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer(); 46 Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
47 Utils.InventoryCollectionSerializer collectionSerializer = new Utils.InventoryCollectionSerializer(); 47 Utils.InventoryCollectionSerializer collectionSerializer = new Utils.InventoryCollectionSerializer();
48 48
49 public OpenSimInventoryFrontend() 49 public OpenSimInventoryFrontend()
50 { 50 {
51 } 51 }
52 52
53 public void Start(AssetInventoryServer server) 53 public void Start(AssetInventoryServer server)
54 { 54 {
55 this.server = server; 55 this.server = server;
56 56
57 server.HttpServer.AddHandler("post", null, @"^/GetInventory/", GetInventoryHandler); 57 server.HttpServer.AddHandler("post", null, @"^/GetInventory/", GetInventoryHandler);
58 server.HttpServer.AddHandler("post", null, @"^/CreateInventory/", CreateInventoryHandler); 58 server.HttpServer.AddHandler("post", null, @"^/CreateInventory/", CreateInventoryHandler);
59 server.HttpServer.AddHandler("post", null, @"^/NewFolder/", NewFolderHandler); 59 server.HttpServer.AddHandler("post", null, @"^/NewFolder/", NewFolderHandler);
60 server.HttpServer.AddHandler("post", null, @"^/UpdateFolder/", UpdateFolderHandler); 60 server.HttpServer.AddHandler("post", null, @"^/UpdateFolder/", UpdateFolderHandler);
61 server.HttpServer.AddHandler("post", null, @"^/MoveFolder/", MoveFolderHandler); 61 server.HttpServer.AddHandler("post", null, @"^/MoveFolder/", MoveFolderHandler);
62 server.HttpServer.AddHandler("post", null, @"^/PurgeFolder/", PurgeFolderHandler); 62 server.HttpServer.AddHandler("post", null, @"^/PurgeFolder/", PurgeFolderHandler);
63 server.HttpServer.AddHandler("post", null, @"^/NewItem/", NewItemHandler); 63 server.HttpServer.AddHandler("post", null, @"^/NewItem/", NewItemHandler);
64 server.HttpServer.AddHandler("post", null, @"^/DeleteItem/", DeleteItemHandler); 64 server.HttpServer.AddHandler("post", null, @"^/DeleteItem/", DeleteItemHandler);
65 server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler); 65 server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler);
66 server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler); 66 server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler);
67 } 67 }
68 68
69 public void Stop() 69 public void Stop()
70 { 70 {
71 } 71 }
72 72
73 bool GetInventoryHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 73 bool GetInventoryHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
74 { 74 {
75 UUID sessionID, agentID; 75 UUID sessionID, agentID;
76 UUID ownerID = DeserializeUUID(request.Body, out agentID, out sessionID); 76 UUID ownerID = DeserializeUUID(request.Body, out agentID, out sessionID);
77 77
78 if (ownerID != UUID.Zero) 78 if (ownerID != UUID.Zero)
79 { 79 {
80 Logger.Log.Warn("GetInventory is not scalable on some inventory backends, avoid calling it wherever possible"); 80 Logger.Log.Warn("GetInventory is not scalable on some inventory backends, avoid calling it wherever possible");
81 81
82 Uri owner = Utils.GetOpenSimUri(ownerID); 82 Uri owner = Utils.GetOpenSimUri(ownerID);
83 InventoryCollection inventory; 83 InventoryCollection inventory;
84 BackendResponse storageResponse = server.InventoryProvider.TryFetchInventory(owner, out inventory); 84 BackendResponse storageResponse = server.InventoryProvider.TryFetchInventory(owner, out inventory);
85 85
86 if (storageResponse == BackendResponse.Success) 86 if (storageResponse == BackendResponse.Success)
87 { 87 {
88 collectionSerializer.Serialize(response.Body, inventory); 88 collectionSerializer.Serialize(response.Body, inventory);
89 response.Body.Flush(); 89 response.Body.Flush();
90 } 90 }
91 else if (storageResponse == BackendResponse.NotFound) 91 else if (storageResponse == BackendResponse.NotFound)
92 { 92 {
93 // Return an empty inventory set to mimic OpenSim.Grid.InventoryServer.exe 93 // Return an empty inventory set to mimic OpenSim.Grid.InventoryServer.exe
94 inventory = new InventoryCollection(); 94 inventory = new InventoryCollection();
95 inventory.UserID = ownerID; 95 inventory.UserID = ownerID;
96 inventory.Folders = new Dictionary<UUID, InventoryFolder>(); 96 inventory.Folders = new Dictionary<UUID, InventoryFolder>();
97 inventory.Items = new Dictionary<UUID, InventoryItem>(); 97 inventory.Items = new Dictionary<UUID, InventoryItem>();
98 collectionSerializer.Serialize(response.Body, inventory); 98 collectionSerializer.Serialize(response.Body, inventory);
99 response.Body.Flush(); 99 response.Body.Flush();
100 } 100 }
101 else 101 else
102 { 102 {
103 response.Status = HttpStatusCode.InternalServerError; 103 response.Status = HttpStatusCode.InternalServerError;
104 } 104 }
105 } 105 }
106 else 106 else
107 { 107 {
108 response.Status = HttpStatusCode.BadRequest; 108 response.Status = HttpStatusCode.BadRequest;
109 } 109 }
110 110
111 return true; 111 return true;
112 } 112 }
113 113
114 bool CreateInventoryHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 114 bool CreateInventoryHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
115 { 115 {
116 UUID ownerID = DeserializeUUID(request.Body); 116 UUID ownerID = DeserializeUUID(request.Body);
117 117
118 if (ownerID != UUID.Zero) 118 if (ownerID != UUID.Zero)
119 { 119 {
120 Uri owner = Utils.GetOpenSimUri(ownerID); 120 Uri owner = Utils.GetOpenSimUri(ownerID);
121 Logger.Log.DebugFormat("Created URI {0} for inventory creation", owner); 121 Logger.Log.DebugFormat("Created URI {0} for inventory creation", owner);
122 122
123 InventoryFolder rootFolder = new InventoryFolder("My Inventory", ownerID, UUID.Zero, (short)AssetType.Folder); 123 InventoryFolder rootFolder = new InventoryFolder("My Inventory", ownerID, UUID.Zero, (short)AssetType.Folder);
124 BackendResponse storageResponse = server.InventoryProvider.TryCreateInventory(owner, rootFolder); 124 BackendResponse storageResponse = server.InventoryProvider.TryCreateInventory(owner, rootFolder);
125 if (storageResponse == BackendResponse.Success) 125 if (storageResponse == BackendResponse.Success)
126 { 126 {
127 CreateFolder("Animations", ownerID, rootFolder.ID, AssetType.Animation); 127 CreateFolder("Animations", ownerID, rootFolder.ID, AssetType.Animation);
128 CreateFolder("Body Parts", ownerID, rootFolder.ID, AssetType.Bodypart); 128 CreateFolder("Body Parts", ownerID, rootFolder.ID, AssetType.Bodypart);
129 CreateFolder("Calling Cards", ownerID, rootFolder.ID, AssetType.CallingCard); 129 CreateFolder("Calling Cards", ownerID, rootFolder.ID, AssetType.CallingCard);
130 CreateFolder("Clothing", ownerID, rootFolder.ID, AssetType.Clothing); 130 CreateFolder("Clothing", ownerID, rootFolder.ID, AssetType.Clothing);
131 CreateFolder("Gestures", ownerID, rootFolder.ID, AssetType.Gesture); 131 CreateFolder("Gestures", ownerID, rootFolder.ID, AssetType.Gesture);
132 CreateFolder("Landmarks", ownerID, rootFolder.ID, AssetType.Landmark); 132 CreateFolder("Landmarks", ownerID, rootFolder.ID, AssetType.Landmark);
133 CreateFolder("Lost and Found", ownerID, rootFolder.ID, AssetType.LostAndFoundFolder); 133 CreateFolder("Lost and Found", ownerID, rootFolder.ID, AssetType.LostAndFoundFolder);
134 CreateFolder("Notecards", ownerID, rootFolder.ID, AssetType.Notecard); 134 CreateFolder("Notecards", ownerID, rootFolder.ID, AssetType.Notecard);
135 CreateFolder("Objects", ownerID, rootFolder.ID, AssetType.Object); 135 CreateFolder("Objects", ownerID, rootFolder.ID, AssetType.Object);
136 CreateFolder("Photo Album", ownerID, rootFolder.ID, AssetType.SnapshotFolder); 136 CreateFolder("Photo Album", ownerID, rootFolder.ID, AssetType.SnapshotFolder);
137 CreateFolder("Scripts", ownerID, rootFolder.ID, AssetType.LSLText); 137 CreateFolder("Scripts", ownerID, rootFolder.ID, AssetType.LSLText);
138 CreateFolder("Sounds", ownerID, rootFolder.ID, AssetType.Sound); 138 CreateFolder("Sounds", ownerID, rootFolder.ID, AssetType.Sound);
139 CreateFolder("Textures", ownerID, rootFolder.ID, AssetType.Texture); 139 CreateFolder("Textures", ownerID, rootFolder.ID, AssetType.Texture);
140 CreateFolder("Trash", ownerID, rootFolder.ID, AssetType.TrashFolder); 140 CreateFolder("Trash", ownerID, rootFolder.ID, AssetType.TrashFolder);
141 141
142 SerializeBool(response.Body, true); 142 SerializeBool(response.Body, true);
143 return true; 143 return true;
144 } 144 }
145 } 145 }
146 146
147 SerializeBool(response.Body, false); 147 SerializeBool(response.Body, false);
148 return true; 148 return true;
149 } 149 }
150 150
151 bool NewFolderHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 151 bool NewFolderHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
152 { 152 {
153 UUID agentID, sessionID; 153 UUID agentID, sessionID;
154 InventoryFolder folder = DeserializeFolder(request.Body, out agentID, out sessionID); 154 InventoryFolder folder = DeserializeFolder(request.Body, out agentID, out sessionID);
155 155
156 if (folder != null) 156 if (folder != null)
157 { 157 {
158 Uri owner = Utils.GetOpenSimUri(folder.Owner); 158 Uri owner = Utils.GetOpenSimUri(folder.Owner);
159 159
160 // Some calls that are moving or updating a folder instead of creating a new one 160 // Some calls that are moving or updating a folder instead of creating a new one
161 // will pass in an InventoryFolder without the name set. If this is the case we 161 // will pass in an InventoryFolder without the name set. If this is the case we
162 // need to look up the name first 162 // need to look up the name first
163 if (String.IsNullOrEmpty(folder.Name)) 163 if (String.IsNullOrEmpty(folder.Name))
164 { 164 {
165 InventoryFolder oldFolder; 165 InventoryFolder oldFolder;
166 if (server.InventoryProvider.TryFetchFolder(owner, folder.ID, out oldFolder) == BackendResponse.Success) 166 if (server.InventoryProvider.TryFetchFolder(owner, folder.ID, out oldFolder) == BackendResponse.Success)
167 folder.Name = oldFolder.Name; 167 folder.Name = oldFolder.Name;
168 } 168 }
169 169
170 BackendResponse storageResponse = server.InventoryProvider.TryCreateFolder(owner, folder); 170 BackendResponse storageResponse = server.InventoryProvider.TryCreateFolder(owner, folder);
171 171
172 if (storageResponse == BackendResponse.Success) 172 if (storageResponse == BackendResponse.Success)
173 { 173 {
174 SerializeBool(response.Body, true); 174 SerializeBool(response.Body, true);
175 return true; 175 return true;
176 } 176 }
177 } 177 }
178 178
179 SerializeBool(response.Body, false); 179 SerializeBool(response.Body, false);
180 return true; 180 return true;
181 } 181 }
182 182
183 bool UpdateFolderHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 183 bool UpdateFolderHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
184 { 184 {
185 return NewFolderHandler(client, request, response); 185 return NewFolderHandler(client, request, response);
186 } 186 }
187 187
188 bool MoveFolderHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 188 bool MoveFolderHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
189 { 189 {
190 return NewFolderHandler(client, request, response); 190 return NewFolderHandler(client, request, response);
191 } 191 }
192 192
193 bool PurgeFolderHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 193 bool PurgeFolderHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
194 { 194 {
195 UUID agentID, sessionID; 195 UUID agentID, sessionID;
196 InventoryFolder folder = DeserializeFolder(request.Body, out agentID, out sessionID); 196 InventoryFolder folder = DeserializeFolder(request.Body, out agentID, out sessionID);
197 197
198 if (folder != null) 198 if (folder != null)
199 { 199 {
200 Uri owner = Utils.GetOpenSimUri(folder.Owner); 200 Uri owner = Utils.GetOpenSimUri(folder.Owner);
201 BackendResponse storageResponse = server.InventoryProvider.TryPurgeFolder(owner, folder.ID); 201 BackendResponse storageResponse = server.InventoryProvider.TryPurgeFolder(owner, folder.ID);
202 202
203 if (storageResponse == BackendResponse.Success) 203 if (storageResponse == BackendResponse.Success)
204 { 204 {
205 SerializeBool(response.Body, true); 205 SerializeBool(response.Body, true);
206 return true; 206 return true;
207 } 207 }
208 } 208 }
209 209
210 SerializeBool(response.Body, false); 210 SerializeBool(response.Body, false);
211 return true; 211 return true;
212 } 212 }
213 213
214 bool NewItemHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 214 bool NewItemHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
215 { 215 {
216 UUID agentID, sessionID; 216 UUID agentID, sessionID;
217 InventoryItem item = DeserializeItem(request.Body, out agentID, out sessionID); 217 InventoryItem item = DeserializeItem(request.Body, out agentID, out sessionID);
218 218
219 if (item != null) 219 if (item != null)
220 { 220 {
221 Uri owner = Utils.GetOpenSimUri(agentID); 221 Uri owner = Utils.GetOpenSimUri(agentID);
222 BackendResponse storageResponse = server.InventoryProvider.TryCreateItem(owner, item); 222 BackendResponse storageResponse = server.InventoryProvider.TryCreateItem(owner, item);
223 223
224 if (storageResponse == BackendResponse.Success) 224 if (storageResponse == BackendResponse.Success)
225 { 225 {
226 SerializeBool(response.Body, true); 226 SerializeBool(response.Body, true);
227 return true; 227 return true;
228 } 228 }
229 } 229 }
230 230
231 SerializeBool(response.Body, false); 231 SerializeBool(response.Body, false);
232 return true; 232 return true;
233 } 233 }
234 234
235 bool DeleteItemHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 235 bool DeleteItemHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
236 { 236 {
237 UUID agentID, sessionID; 237 UUID agentID, sessionID;
238 InventoryItem item = DeserializeItem(request.Body, out agentID, out sessionID); 238 InventoryItem item = DeserializeItem(request.Body, out agentID, out sessionID);
239 239
240 if (item != null) 240 if (item != null)
241 { 241 {
242 Uri owner = Utils.GetOpenSimUri(item.Owner); 242 Uri owner = Utils.GetOpenSimUri(item.Owner);
243 BackendResponse storageResponse = server.InventoryProvider.TryDeleteItem(owner, item.ID); 243 BackendResponse storageResponse = server.InventoryProvider.TryDeleteItem(owner, item.ID);
244 244
245 if (storageResponse == BackendResponse.Success) 245 if (storageResponse == BackendResponse.Success)
246 { 246 {
247 SerializeBool(response.Body, true); 247 SerializeBool(response.Body, true);
248 return true; 248 return true;
249 } 249 }
250 } 250 }
251 251
252 SerializeBool(response.Body, false); 252 SerializeBool(response.Body, false);
253 return true; 253 return true;
254 } 254 }
255 255
256 bool RootFoldersHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 256 bool RootFoldersHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
257 { 257 {
258 UUID ownerID = DeserializeUUID(request.Body); 258 UUID ownerID = DeserializeUUID(request.Body);
259 259
260 if (ownerID != UUID.Zero) 260 if (ownerID != UUID.Zero)
261 { 261 {
262 Uri owner = Utils.GetOpenSimUri(ownerID); 262 Uri owner = Utils.GetOpenSimUri(ownerID);
263 List<InventoryFolder> skeleton; 263 List<InventoryFolder> skeleton;
264 BackendResponse storageResponse = server.InventoryProvider.TryFetchFolderList(owner, out skeleton); 264 BackendResponse storageResponse = server.InventoryProvider.TryFetchFolderList(owner, out skeleton);
265 265
266 if (storageResponse == BackendResponse.Success) 266 if (storageResponse == BackendResponse.Success)
267 { 267 {
268 SerializeFolderList(response.Body, skeleton); 268 SerializeFolderList(response.Body, skeleton);
269 } 269 }
270 else if (storageResponse == BackendResponse.NotFound) 270 else if (storageResponse == BackendResponse.NotFound)
271 { 271 {
272 // Return an empty set of inventory so the requester knows that 272 // Return an empty set of inventory so the requester knows that
273 // an inventory needs to be created for this agent 273 // an inventory needs to be created for this agent
274 SerializeFolderList(response.Body, new List<InventoryFolder>(0)); 274 SerializeFolderList(response.Body, new List<InventoryFolder>(0));
275 } 275 }
276 else 276 else
277 { 277 {
278 response.Status = HttpStatusCode.InternalServerError; 278 response.Status = HttpStatusCode.InternalServerError;
279 } 279 }
280 } 280 }
281 else 281 else
282 { 282 {
283 response.Status = HttpStatusCode.BadRequest; 283 response.Status = HttpStatusCode.BadRequest;
284 } 284 }
285 285
286 return true; 286 return true;
287 } 287 }
288 288
289 bool ActiveGesturesHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) 289 bool ActiveGesturesHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
290 { 290 {
291 UUID ownerID = DeserializeUUID(request.Body); 291 UUID ownerID = DeserializeUUID(request.Body);
292 292
293 if (ownerID != UUID.Zero) 293 if (ownerID != UUID.Zero)
294 { 294 {
295 Uri owner = Utils.GetOpenSimUri(ownerID); 295 Uri owner = Utils.GetOpenSimUri(ownerID);
296 List<InventoryItem> gestures; 296 List<InventoryItem> gestures;
297 BackendResponse storageResponse = server.InventoryProvider.TryFetchActiveGestures(owner, out gestures); 297 BackendResponse storageResponse = server.InventoryProvider.TryFetchActiveGestures(owner, out gestures);
298 298
299 if (storageResponse == BackendResponse.Success) 299 if (storageResponse == BackendResponse.Success)
300 { 300 {
301 SerializeItemList(response.Body, gestures); 301 SerializeItemList(response.Body, gestures);
302 } 302 }
303 else if (storageResponse == BackendResponse.NotFound) 303 else if (storageResponse == BackendResponse.NotFound)
304 { 304 {
305 // Return an empty set of gestures to match OpenSim.Grid.InventoryServer.exe behavior 305 // Return an empty set of gestures to match OpenSim.Grid.InventoryServer.exe behavior
306 SerializeItemList(response.Body, new List<InventoryItem>(0)); 306 SerializeItemList(response.Body, new List<InventoryItem>(0));
307 } 307 }
308 else 308 else
309 { 309 {
310 response.Status = HttpStatusCode.InternalServerError; 310 response.Status = HttpStatusCode.InternalServerError;
311 } 311 }
312 } 312 }
313 else 313 else
314 { 314 {
315 response.Status = HttpStatusCode.BadRequest; 315 response.Status = HttpStatusCode.BadRequest;
316 } 316 }
317 317
318 return true; 318 return true;
319 } 319 }
320 320
321 BackendResponse CreateFolder(string name, UUID ownerID, UUID parentID, AssetType assetType) 321 BackendResponse CreateFolder(string name, UUID ownerID, UUID parentID, AssetType assetType)
322 { 322 {
323 InventoryFolder folder = new InventoryFolder(name, ownerID, parentID, (short)assetType); 323 InventoryFolder folder = new InventoryFolder(name, ownerID, parentID, (short)assetType);
324 Uri owner = Utils.GetOpenSimUri(ownerID); 324 Uri owner = Utils.GetOpenSimUri(ownerID);
325 return server.InventoryProvider.TryCreateFolder(owner, folder); 325 return server.InventoryProvider.TryCreateFolder(owner, folder);
326 } 326 }
327 327
328 UUID DeserializeUUID(Stream stream) 328 UUID DeserializeUUID(Stream stream)
329 { 329 {
330 UUID id = UUID.Zero; 330 UUID id = UUID.Zero;
331 331
332 try 332 try
333 { 333 {
334 using (XmlReader reader = XmlReader.Create(stream)) 334 using (XmlReader reader = XmlReader.Create(stream))
335 { 335 {
336 reader.MoveToContent(); 336 reader.MoveToContent();
337 UUID.TryParse(reader.ReadElementContentAsString("guid", String.Empty), out id); 337 UUID.TryParse(reader.ReadElementContentAsString("guid", String.Empty), out id);
338 } 338 }
339 } 339 }
340 catch (Exception ex) 340 catch (Exception ex)
341 { 341 {
342 Logger.Log.Warn("Failed to parse POST data (expecting guid): " + ex.Message); 342 Logger.Log.Warn("Failed to parse POST data (expecting guid): " + ex.Message);
343 } 343 }
344 344
345 return id; 345 return id;
346 } 346 }
347 347
348 UUID DeserializeUUID(Stream stream, out UUID agentID, out UUID sessionID) 348 UUID DeserializeUUID(Stream stream, out UUID agentID, out UUID sessionID)
349 { 349 {
350 UUID id; 350 UUID id;
351 351
352 try 352 try
353 { 353 {
354 using (XmlReader reader = XmlReader.Create(stream)) 354 using (XmlReader reader = XmlReader.Create(stream))
355 { 355 {
356 reader.MoveToContent(); 356 reader.MoveToContent();
357 reader.ReadStartElement("RestSessionObjectOfGuid"); 357 reader.ReadStartElement("RestSessionObjectOfGuid");
358 UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID); 358 UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID);
359 UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); 359 UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID);
360 UUID.TryParse(reader.ReadElementContentAsString("Body", String.Empty), out id); 360 UUID.TryParse(reader.ReadElementContentAsString("Body", String.Empty), out id);
361 reader.ReadEndElement(); 361 reader.ReadEndElement();
362 } 362 }
363 } 363 }
364 catch (Exception ex) 364 catch (Exception ex)
365 { 365 {
366 Logger.Log.Warn("Failed to parse GetInventory POST data: " + ex.Message); 366 Logger.Log.Warn("Failed to parse GetInventory POST data: " + ex.Message);
367 agentID = UUID.Zero; 367 agentID = UUID.Zero;
368 sessionID = UUID.Zero; 368 sessionID = UUID.Zero;
369 return UUID.Zero; 369 return UUID.Zero;
370 } 370 }
371 371
372 return id; 372 return id;
373 } 373 }
374 374
375 InventoryFolder DeserializeFolder(Stream stream, out UUID agentID, out UUID sessionID) 375 InventoryFolder DeserializeFolder(Stream stream, out UUID agentID, out UUID sessionID)
376 { 376 {
377 InventoryFolder folder = new InventoryFolder(); 377 InventoryFolder folder = new InventoryFolder();
378 378
379 try 379 try
380 { 380 {
381 using (XmlReader reader = XmlReader.Create(stream)) 381 using (XmlReader reader = XmlReader.Create(stream))
382 { 382 {
383 reader.MoveToContent(); 383 reader.MoveToContent();
384 reader.ReadStartElement("RestSessionObjectOfInventoryFolderBase"); 384 reader.ReadStartElement("RestSessionObjectOfInventoryFolderBase");
385 UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID); 385 UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID);
386 UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); 386 UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID);
387 reader.ReadStartElement("Body"); 387 reader.ReadStartElement("Body");
388 if (reader.Name == "Name") 388 if (reader.Name == "Name")
389 folder.Name = reader.ReadElementContentAsString("Name", String.Empty); 389 folder.Name = reader.ReadElementContentAsString("Name", String.Empty);
390 else 390 else
391 folder.Name = String.Empty; 391 folder.Name = String.Empty;
392 ReadUUID(reader, "Owner", out folder.Owner); 392 ReadUUID(reader, "Owner", out folder.Owner);
393 ReadUUID(reader, "ParentID", out folder.ParentID); 393 ReadUUID(reader, "ParentID", out folder.ParentID);
394 ReadUUID(reader, "ID", out folder.ID); 394 ReadUUID(reader, "ID", out folder.ID);
395 Int16.TryParse(reader.ReadElementContentAsString("Type", String.Empty), out folder.Type); 395 Int16.TryParse(reader.ReadElementContentAsString("Type", String.Empty), out folder.Type);
396 UInt16.TryParse(reader.ReadElementContentAsString("Version", String.Empty), out folder.Version); 396 UInt16.TryParse(reader.ReadElementContentAsString("Version", String.Empty), out folder.Version);
397 reader.ReadEndElement(); 397 reader.ReadEndElement();
398 reader.ReadEndElement(); 398 reader.ReadEndElement();
399 } 399 }
400 } 400 }
401 catch (Exception ex) 401 catch (Exception ex)
402 { 402 {
403 Logger.Log.Warn("Failed to parse POST data (expecting InventoryFolderBase): " + ex.Message); 403 Logger.Log.Warn("Failed to parse POST data (expecting InventoryFolderBase): " + ex.Message);
404 agentID = UUID.Zero; 404 agentID = UUID.Zero;
405 sessionID = UUID.Zero; 405 sessionID = UUID.Zero;
406 return null; 406 return null;
407 } 407 }
408 408
409 return folder; 409 return folder;
410 } 410 }
411 411
412 InventoryItem DeserializeItem(Stream stream, out UUID agentID, out UUID sessionID) 412 InventoryItem DeserializeItem(Stream stream, out UUID agentID, out UUID sessionID)
413 { 413 {
414 InventoryItem item = new InventoryItem(); 414 InventoryItem item = new InventoryItem();
415 415
416 try 416 try
417 { 417 {
418 using (XmlReader reader = XmlReader.Create(stream)) 418 using (XmlReader reader = XmlReader.Create(stream))
419 { 419 {
420 reader.MoveToContent(); 420 reader.MoveToContent();
421 reader.ReadStartElement("RestSessionObjectOfInventoryItemBase"); 421 reader.ReadStartElement("RestSessionObjectOfInventoryItemBase");
422 UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID); 422 UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID);
423 UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); 423 UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID);
424 reader.ReadStartElement("Body"); 424 reader.ReadStartElement("Body");
425 ReadUUID(reader, "ID", out item.ID); 425 ReadUUID(reader, "ID", out item.ID);
426 Int32.TryParse(reader.ReadElementContentAsString("InvType", String.Empty), out item.InvType); 426 Int32.TryParse(reader.ReadElementContentAsString("InvType", String.Empty), out item.InvType);
427 ReadUUID(reader, "Folder", out item.Folder); 427 ReadUUID(reader, "Folder", out item.Folder);
428 ReadUUID(reader, "Owner", out item.Owner); 428 ReadUUID(reader, "Owner", out item.Owner);
429 ReadUUID(reader, "Creator", out item.Creator); 429 ReadUUID(reader, "Creator", out item.Creator);
430 item.Name = reader.ReadElementContentAsString("Name", String.Empty); 430 item.Name = reader.ReadElementContentAsString("Name", String.Empty);
431 item.Description = reader.ReadElementContentAsString("Description", String.Empty); 431 item.Description = reader.ReadElementContentAsString("Description", String.Empty);
432 UInt32.TryParse(reader.ReadElementContentAsString("NextPermissions", String.Empty), out item.NextPermissions); 432 UInt32.TryParse(reader.ReadElementContentAsString("NextPermissions", String.Empty), out item.NextPermissions);
433 UInt32.TryParse(reader.ReadElementContentAsString("CurrentPermissions", String.Empty), out item.CurrentPermissions); 433 UInt32.TryParse(reader.ReadElementContentAsString("CurrentPermissions", String.Empty), out item.CurrentPermissions);
434 UInt32.TryParse(reader.ReadElementContentAsString("BasePermissions", String.Empty), out item.BasePermissions); 434 UInt32.TryParse(reader.ReadElementContentAsString("BasePermissions", String.Empty), out item.BasePermissions);
435 UInt32.TryParse(reader.ReadElementContentAsString("EveryOnePermissions", String.Empty), out item.EveryOnePermissions); 435 UInt32.TryParse(reader.ReadElementContentAsString("EveryOnePermissions", String.Empty), out item.EveryOnePermissions);
436 UInt32.TryParse(reader.ReadElementContentAsString("GroupPermissions", String.Empty), out item.GroupPermissions); 436 UInt32.TryParse(reader.ReadElementContentAsString("GroupPermissions", String.Empty), out item.GroupPermissions);
437 Int32.TryParse(reader.ReadElementContentAsString("AssetType", String.Empty), out item.AssetType); 437 Int32.TryParse(reader.ReadElementContentAsString("AssetType", String.Empty), out item.AssetType);
438 ReadUUID(reader, "AssetID", out item.AssetID); 438 ReadUUID(reader, "AssetID", out item.AssetID);
439 ReadUUID(reader, "GroupID", out item.GroupID); 439 ReadUUID(reader, "GroupID", out item.GroupID);
440 Boolean.TryParse(reader.ReadElementContentAsString("GroupOwned", String.Empty), out item.GroupOwned); 440 Boolean.TryParse(reader.ReadElementContentAsString("GroupOwned", String.Empty), out item.GroupOwned);
441 Int32.TryParse(reader.ReadElementContentAsString("SalePrice", String.Empty), out item.SalePrice); 441 Int32.TryParse(reader.ReadElementContentAsString("SalePrice", String.Empty), out item.SalePrice);
442 Byte.TryParse(reader.ReadElementContentAsString("SaleType", String.Empty), out item.SaleType); 442 Byte.TryParse(reader.ReadElementContentAsString("SaleType", String.Empty), out item.SaleType);
443 UInt32.TryParse(reader.ReadElementContentAsString("Flags", String.Empty), out item.Flags); 443 UInt32.TryParse(reader.ReadElementContentAsString("Flags", String.Empty), out item.Flags);
444 Int32.TryParse(reader.ReadElementContentAsString("CreationDate", String.Empty), out item.CreationDate); 444 Int32.TryParse(reader.ReadElementContentAsString("CreationDate", String.Empty), out item.CreationDate);
445 reader.ReadEndElement(); 445 reader.ReadEndElement();
446 reader.ReadEndElement(); 446 reader.ReadEndElement();
447 } 447 }
448 } 448 }
449 catch (Exception ex) 449 catch (Exception ex)
450 { 450 {
451 Logger.Log.Warn("Failed to parse POST data (expecting InventoryItemBase): " + ex.Message); 451 Logger.Log.Warn("Failed to parse POST data (expecting InventoryItemBase): " + ex.Message);
452 agentID = UUID.Zero; 452 agentID = UUID.Zero;
453 sessionID = UUID.Zero; 453 sessionID = UUID.Zero;
454 return null; 454 return null;
455 } 455 }
456 456
457 return item; 457 return item;
458 } 458 }
459 459
460 void SerializeBool(Stream stream, bool value) 460 void SerializeBool(Stream stream, bool value)
461 { 461 {
462 using (XmlWriter writer = XmlWriter.Create(stream)) 462 using (XmlWriter writer = XmlWriter.Create(stream))
463 { 463 {
464 writer.WriteStartDocument(); 464 writer.WriteStartDocument();
465 writer.WriteStartElement("boolean"); 465 writer.WriteStartElement("boolean");
466 writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); 466 writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
467 writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); 467 writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema");
468 writer.WriteString(value.ToString().ToLower()); 468 writer.WriteString(value.ToString().ToLower());
469 writer.WriteEndElement(); 469 writer.WriteEndElement();
470 writer.WriteEndDocument(); 470 writer.WriteEndDocument();
471 writer.Flush(); 471 writer.Flush();
472 } 472 }
473 473
474 stream.Flush(); 474 stream.Flush();
475 } 475 }
476 476
477 void SerializeFolderList(Stream stream, List<InventoryFolder> folders) 477 void SerializeFolderList(Stream stream, List<InventoryFolder> folders)
478 { 478 {
479 using (XmlWriter writer = XmlWriter.Create(stream)) 479 using (XmlWriter writer = XmlWriter.Create(stream))
480 { 480 {
481 writer.WriteStartDocument(); 481 writer.WriteStartDocument();
482 writer.WriteStartElement("ArrayOfInventoryFolderBase"); 482 writer.WriteStartElement("ArrayOfInventoryFolderBase");
483 writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); 483 writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
484 writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); 484 writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema");
485 485
486 if (folders != null) 486 if (folders != null)
487 { 487 {
488 foreach (InventoryFolder folder in folders) 488 foreach (InventoryFolder folder in folders)
489 { 489 {
490 writer.WriteStartElement("InventoryFolderBase"); 490 writer.WriteStartElement("InventoryFolderBase");
491 writer.WriteElementString("Name", folder.Name); 491 writer.WriteElementString("Name", folder.Name);
492 WriteUUID(writer, "Owner", folder.Owner); 492 WriteUUID(writer, "Owner", folder.Owner);
493 WriteUUID(writer, "ParentID", folder.ParentID); 493 WriteUUID(writer, "ParentID", folder.ParentID);
494 WriteUUID(writer, "ID", folder.ID); 494 WriteUUID(writer, "ID", folder.ID);
495 writer.WriteElementString("Type", XmlConvert.ToString(folder.Type)); 495 writer.WriteElementString("Type", XmlConvert.ToString(folder.Type));
496 writer.WriteElementString("Version", XmlConvert.ToString(folder.Version)); 496 writer.WriteElementString("Version", XmlConvert.ToString(folder.Version));
497 writer.WriteEndElement(); 497 writer.WriteEndElement();
498 } 498 }
499 } 499 }
500 500
501 writer.WriteEndElement(); 501 writer.WriteEndElement();
502 writer.WriteEndDocument(); 502 writer.WriteEndDocument();
503 503
504 writer.Flush(); 504 writer.Flush();
505 } 505 }
506 506
507 stream.Flush(); 507 stream.Flush();
508 } 508 }
509 509
510 void SerializeItemList(Stream stream, List<InventoryItem> items) 510 void SerializeItemList(Stream stream, List<InventoryItem> items)
511 { 511 {
512 using (XmlWriter writer = XmlWriter.Create(stream)) 512 using (XmlWriter writer = XmlWriter.Create(stream))
513 { 513 {
514 writer.WriteStartDocument(); 514 writer.WriteStartDocument();
515 writer.WriteStartElement("ArrayOfInventoryItemBase"); 515 writer.WriteStartElement("ArrayOfInventoryItemBase");
516 writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); 516 writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
517 writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); 517 writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema");
518 518
519 if (items != null) 519 if (items != null)
520 { 520 {
521 foreach (InventoryItem item in items) 521 foreach (InventoryItem item in items)
522 { 522 {
523 writer.WriteStartElement("InventoryItemBase"); 523 writer.WriteStartElement("InventoryItemBase");
524 WriteUUID(writer, "ID", item.ID); 524 WriteUUID(writer, "ID", item.ID);
525 writer.WriteElementString("InvType", XmlConvert.ToString(item.InvType)); 525 writer.WriteElementString("InvType", XmlConvert.ToString(item.InvType));
526 WriteUUID(writer, "Folder", item.Folder); 526 WriteUUID(writer, "Folder", item.Folder);
527 WriteUUID(writer, "Owner", item.Owner); 527 WriteUUID(writer, "Owner", item.Owner);
528 WriteUUID(writer, "Creator", item.Creator); 528 WriteUUID(writer, "Creator", item.Creator);
529 writer.WriteElementString("Name", item.Name); 529 writer.WriteElementString("Name", item.Name);
530 writer.WriteElementString("Description", item.Description); 530 writer.WriteElementString("Description", item.Description);
531 writer.WriteElementString("NextPermissions", XmlConvert.ToString(item.NextPermissions)); 531 writer.WriteElementString("NextPermissions", XmlConvert.ToString(item.NextPermissions));
532 writer.WriteElementString("CurrentPermissions", XmlConvert.ToString(item.CurrentPermissions)); 532 writer.WriteElementString("CurrentPermissions", XmlConvert.ToString(item.CurrentPermissions));
533 writer.WriteElementString("BasePermissions", XmlConvert.ToString(item.BasePermissions)); 533 writer.WriteElementString("BasePermissions", XmlConvert.ToString(item.BasePermissions));
534 writer.WriteElementString("EveryOnePermissions", XmlConvert.ToString(item.EveryOnePermissions)); 534 writer.WriteElementString("EveryOnePermissions", XmlConvert.ToString(item.EveryOnePermissions));
535 writer.WriteElementString("GroupPermissions", XmlConvert.ToString(item.GroupPermissions)); 535 writer.WriteElementString("GroupPermissions", XmlConvert.ToString(item.GroupPermissions));
536 writer.WriteElementString("AssetType", XmlConvert.ToString(item.AssetType)); 536 writer.WriteElementString("AssetType", XmlConvert.ToString(item.AssetType));
537 WriteUUID(writer, "AssetID", item.AssetID); 537 WriteUUID(writer, "AssetID", item.AssetID);
538 WriteUUID(writer, "GroupID", item.GroupID); 538 WriteUUID(writer, "GroupID", item.GroupID);
539 writer.WriteElementString("GroupOwned", XmlConvert.ToString(item.GroupOwned)); 539 writer.WriteElementString("GroupOwned", XmlConvert.ToString(item.GroupOwned));
540 writer.WriteElementString("SalePrice", XmlConvert.ToString(item.SalePrice)); 540 writer.WriteElementString("SalePrice", XmlConvert.ToString(item.SalePrice));
541 writer.WriteElementString("SaleType", XmlConvert.ToString(item.SaleType)); 541 writer.WriteElementString("SaleType", XmlConvert.ToString(item.SaleType));
542 writer.WriteElementString("Flags", XmlConvert.ToString(item.Flags)); 542 writer.WriteElementString("Flags", XmlConvert.ToString(item.Flags));
543 writer.WriteElementString("CreationDate", XmlConvert.ToString(item.CreationDate)); 543 writer.WriteElementString("CreationDate", XmlConvert.ToString(item.CreationDate));
544 writer.WriteEndElement(); 544 writer.WriteEndElement();
545 } 545 }
546 } 546 }
547 547
548 writer.WriteEndElement(); 548 writer.WriteEndElement();
549 writer.WriteEndDocument(); 549 writer.WriteEndDocument();
550 550
551 writer.Flush(); 551 writer.Flush();
552 } 552 }
553 553
554 stream.Flush(); 554 stream.Flush();
555 } 555 }
556 556
557 void WriteUUID(XmlWriter writer, string name, UUID id) 557 void WriteUUID(XmlWriter writer, string name, UUID id)
558 { 558 {
559 writer.WriteStartElement(name); 559 writer.WriteStartElement(name);
560 writer.WriteElementString("Guid", XmlConvert.ToString(id.Guid)); 560 writer.WriteElementString("Guid", XmlConvert.ToString(id.Guid));
561 writer.WriteEndElement(); 561 writer.WriteEndElement();
562 } 562 }
563 563
564 void ReadUUID(XmlReader reader, string name, out UUID id) 564 void ReadUUID(XmlReader reader, string name, out UUID id)
565 { 565 {
566 reader.ReadStartElement(name); 566 reader.ReadStartElement(name);
567 UUID.TryParse(reader.ReadElementContentAsString("Guid", String.Empty), out id); 567 UUID.TryParse(reader.ReadElementContentAsString("Guid", String.Empty), out id);
568 reader.ReadEndElement(); 568 reader.ReadEndElement();
569 } 569 }
570 } 570 }
571 571
572 #region OpenSim AssetType 572 #region OpenSim AssetType
573 573
574 /// <summary> 574 /// <summary>
575 /// The different types of grid assets 575 /// The different types of grid assets
576 /// </summary> 576 /// </summary>
577 public enum AssetType : sbyte 577 public enum AssetType : sbyte
578 { 578 {
579 /// <summary>Unknown asset type</summary> 579 /// <summary>Unknown asset type</summary>
580 Unknown = -1, 580 Unknown = -1,
581 /// <summary>Texture asset, stores in JPEG2000 J2C stream format</summary> 581 /// <summary>Texture asset, stores in JPEG2000 J2C stream format</summary>
582 Texture = 0, 582 Texture = 0,
583 /// <summary>Sound asset</summary> 583 /// <summary>Sound asset</summary>
584 Sound = 1, 584 Sound = 1,
585 /// <summary>Calling card for another avatar</summary> 585 /// <summary>Calling card for another avatar</summary>
586 CallingCard = 2, 586 CallingCard = 2,
587 /// <summary>Link to a location in world</summary> 587 /// <summary>Link to a location in world</summary>
588 Landmark = 3, 588 Landmark = 3,
589 // <summary>Legacy script asset, you should never see one of these</summary> 589 // <summary>Legacy script asset, you should never see one of these</summary>
590 //[Obsolete] 590 //[Obsolete]
591 //Script = 4, 591 //Script = 4,
592 /// <summary>Collection of textures and parameters that can be 592 /// <summary>Collection of textures and parameters that can be
593 /// worn by an avatar</summary> 593 /// worn by an avatar</summary>
594 Clothing = 5, 594 Clothing = 5,
595 /// <summary>Primitive that can contain textures, sounds, 595 /// <summary>Primitive that can contain textures, sounds,
596 /// scripts and more</summary> 596 /// scripts and more</summary>
597 Object = 6, 597 Object = 6,
598 /// <summary>Notecard asset</summary> 598 /// <summary>Notecard asset</summary>
599 Notecard = 7, 599 Notecard = 7,
600 /// <summary>Holds a collection of inventory items</summary> 600 /// <summary>Holds a collection of inventory items</summary>
601 Folder = 8, 601 Folder = 8,
602 /// <summary>Root inventory folder</summary> 602 /// <summary>Root inventory folder</summary>
603 RootFolder = 9, 603 RootFolder = 9,
604 /// <summary>Linden scripting language script</summary> 604 /// <summary>Linden scripting language script</summary>
605 LSLText = 10, 605 LSLText = 10,
606 /// <summary>LSO bytecode for a script</summary> 606 /// <summary>LSO bytecode for a script</summary>
607 LSLBytecode = 11, 607 LSLBytecode = 11,
608 /// <summary>Uncompressed TGA texture</summary> 608 /// <summary>Uncompressed TGA texture</summary>
609 TextureTGA = 12, 609 TextureTGA = 12,
610 /// <summary>Collection of textures and shape parameters that can 610 /// <summary>Collection of textures and shape parameters that can
611 /// be worn</summary> 611 /// be worn</summary>
612 Bodypart = 13, 612 Bodypart = 13,
613 /// <summary>Trash folder</summary> 613 /// <summary>Trash folder</summary>
614 TrashFolder = 14, 614 TrashFolder = 14,
615 /// <summary>Snapshot folder</summary> 615 /// <summary>Snapshot folder</summary>
616 SnapshotFolder = 15, 616 SnapshotFolder = 15,
617 /// <summary>Lost and found folder</summary> 617 /// <summary>Lost and found folder</summary>
618 LostAndFoundFolder = 16, 618 LostAndFoundFolder = 16,
619 /// <summary>Uncompressed sound</summary> 619 /// <summary>Uncompressed sound</summary>
620 SoundWAV = 17, 620 SoundWAV = 17,
621 /// <summary>Uncompressed TGA non-square image, not to be used as a 621 /// <summary>Uncompressed TGA non-square image, not to be used as a
622 /// texture</summary> 622 /// texture</summary>
623 ImageTGA = 18, 623 ImageTGA = 18,
624 /// <summary>Compressed JPEG non-square image, not to be used as a 624 /// <summary>Compressed JPEG non-square image, not to be used as a
625 /// texture</summary> 625 /// texture</summary>
626 ImageJPEG = 19, 626 ImageJPEG = 19,
627 /// <summary>Animation</summary> 627 /// <summary>Animation</summary>
628 Animation = 20, 628 Animation = 20,
629 /// <summary>Sequence of animations, sounds, chat, and pauses</summary> 629 /// <summary>Sequence of animations, sounds, chat, and pauses</summary>
630 Gesture = 21, 630 Gesture = 21,
631 /// <summary>Simstate file</summary> 631 /// <summary>Simstate file</summary>
632 Simstate = 22, 632 Simstate = 22,
633 } 633 }
634 634
635 #endregion OpenSim AssetType 635 #endregion OpenSim AssetType
636} 636}