diff options
author | Melanie | 2010-01-16 00:05:08 +0000 |
---|---|---|
committer | Melanie | 2010-01-16 00:05:08 +0000 |
commit | 10f8c2ea9b67158c32b361f9652d503ea48de292 (patch) | |
tree | be0d88bc4b6df3825a0d27f62a08170d7c7ad262 /OpenSim/Server/Handlers | |
parent | Merge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff) | |
parent | Add "create user" instructions to README.txt (diff) | |
download | opensim-SC-10f8c2ea9b67158c32b361f9652d503ea48de292.zip opensim-SC-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.gz opensim-SC-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.bz2 opensim-SC-10f8c2ea9b67158c32b361f9652d503ea48de292.tar.xz |
Merge branch 'master' into presence-refactor
This merge was very conflicted. I think I got them all, but I can't be sure.
I had to merge to master or risk divergence to the point of unmergeability.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 16 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 456 |
2 files changed, 469 insertions, 3 deletions
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 1601575..318ce85 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -162,14 +162,14 @@ namespace OpenSim.Server.Handlers.Grid | |||
162 | m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e); | 162 | m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e); |
163 | } | 163 | } |
164 | 164 | ||
165 | bool result = false; | 165 | string result = "Error communicating with grid service"; |
166 | if (rinfo != null) | 166 | if (rinfo != null) |
167 | result = m_GridService.RegisterRegion(scopeID, rinfo); | 167 | result = m_GridService.RegisterRegion(scopeID, rinfo); |
168 | 168 | ||
169 | if (result) | 169 | if (result == String.Empty) |
170 | return SuccessResult(); | 170 | return SuccessResult(); |
171 | else | 171 | else |
172 | return FailureResult(); | 172 | return FailureResult(result); |
173 | } | 173 | } |
174 | 174 | ||
175 | byte[] Deregister(Dictionary<string, object> request) | 175 | byte[] Deregister(Dictionary<string, object> request) |
@@ -509,6 +509,11 @@ namespace OpenSim.Server.Handlers.Grid | |||
509 | 509 | ||
510 | private byte[] FailureResult() | 510 | private byte[] FailureResult() |
511 | { | 511 | { |
512 | return FailureResult(String.Empty); | ||
513 | } | ||
514 | |||
515 | private byte[] FailureResult(string msg) | ||
516 | { | ||
512 | XmlDocument doc = new XmlDocument(); | 517 | XmlDocument doc = new XmlDocument(); |
513 | 518 | ||
514 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | 519 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, |
@@ -526,6 +531,11 @@ namespace OpenSim.Server.Handlers.Grid | |||
526 | 531 | ||
527 | rootElement.AppendChild(result); | 532 | rootElement.AppendChild(result); |
528 | 533 | ||
534 | XmlElement message = doc.CreateElement("", "Message", ""); | ||
535 | message.AppendChild(doc.CreateTextNode(msg)); | ||
536 | |||
537 | rootElement.AppendChild(message); | ||
538 | |||
529 | return DocToBytes(doc); | 539 | return DocToBytes(doc); |
530 | } | 540 | } |
531 | 541 | ||
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs new file mode 100644 index 0000000..c7d5ff1 --- /dev/null +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -0,0 +1,456 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Text; | ||
31 | using System.Xml; | ||
32 | using System.Collections.Generic; | ||
33 | using System.IO; | ||
34 | using Nini.Config; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Server.Base; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Framework.Servers.HttpServer; | ||
39 | using OpenSim.Server.Handlers.Base; | ||
40 | using log4net; | ||
41 | using OpenMetaverse; | ||
42 | |||
43 | namespace OpenSim.Server.Handlers.Asset | ||
44 | { | ||
45 | public class XInventoryInConnector : ServiceConnector | ||
46 | { | ||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private IInventoryService m_InventoryService; | ||
50 | private string m_ConfigName = "InventoryService"; | ||
51 | |||
52 | public XInventoryInConnector(IConfigSource config, IHttpServer server, string configName) : | ||
53 | base(config, server, configName) | ||
54 | { | ||
55 | if (configName != String.Empty) | ||
56 | m_ConfigName = configName; | ||
57 | |||
58 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
59 | if (serverConfig == null) | ||
60 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); | ||
61 | |||
62 | string inventoryService = serverConfig.GetString("LocalServiceModule", | ||
63 | String.Empty); | ||
64 | |||
65 | if (inventoryService == String.Empty) | ||
66 | throw new Exception("No InventoryService in config file"); | ||
67 | |||
68 | Object[] args = new Object[] { config }; | ||
69 | m_InventoryService = | ||
70 | ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args); | ||
71 | |||
72 | server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService)); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | public class XInventoryConnectorPostHandler : BaseStreamHandler | ||
77 | { | ||
78 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
79 | |||
80 | private IInventoryService m_InventoryService; | ||
81 | |||
82 | public XInventoryConnectorPostHandler(IInventoryService service) : | ||
83 | base("POST", "/xinventory") | ||
84 | { | ||
85 | m_InventoryService = service; | ||
86 | } | ||
87 | |||
88 | public override byte[] Handle(string path, Stream requestData, | ||
89 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
90 | { | ||
91 | StreamReader sr = new StreamReader(requestData); | ||
92 | string body = sr.ReadToEnd(); | ||
93 | sr.Close(); | ||
94 | body = body.Trim(); | ||
95 | |||
96 | m_log.DebugFormat("[XXX]: query String: {0}", body); | ||
97 | |||
98 | try | ||
99 | { | ||
100 | Dictionary<string, object> request = | ||
101 | ServerUtils.ParseQueryString(body); | ||
102 | |||
103 | if (!request.ContainsKey("METHOD")) | ||
104 | return FailureResult(); | ||
105 | |||
106 | string method = request["METHOD"].ToString(); | ||
107 | request.Remove("METHOD"); | ||
108 | |||
109 | switch (method) | ||
110 | { | ||
111 | case "CREATEUSERINVENTORY": | ||
112 | return HandleCreateUserInventory(request); | ||
113 | case "GETINVENTORYSKELETON": | ||
114 | return HandleGetInventorySkeleton(request); | ||
115 | case "GETROOTFOLDER": | ||
116 | return HandleGetRootFolder(request); | ||
117 | case "GETFOLDERFORTYPE": | ||
118 | return HandleGetFolderForType(request); | ||
119 | case "GETFOLDERCONTENT": | ||
120 | return HandleGetFolderContent(request); | ||
121 | case "GETFOLDERITEMS": | ||
122 | return HandleGetFolderItems(request); | ||
123 | case "ADDFOLDER": | ||
124 | return HandleAddFolder(request); | ||
125 | case "UPDATEFOLDER": | ||
126 | return HandleUpdateFolder(request); | ||
127 | case "MOVEFOLDER": | ||
128 | return HandleMoveFolder(request); | ||
129 | case "DELETEFOLDERS": | ||
130 | return HandleDeleteFolders(request); | ||
131 | case "PURGEFOLDER": | ||
132 | return HandlePurgeFolder(request); | ||
133 | case "ADDITEM": | ||
134 | return HandleAddItem(request); | ||
135 | case "UPDATEITEM": | ||
136 | return HandleUpdateItem(request); | ||
137 | case "MOVEITEMS": | ||
138 | return HandleMoveItems(request); | ||
139 | case "DELETEITEMS": | ||
140 | return HandleDeleteItems(request); | ||
141 | case "GETITEM": | ||
142 | return HandleGetItem(request); | ||
143 | case "GETFOLDER": | ||
144 | return HandleGetFolder(request); | ||
145 | case "GETACTIVEGESTURES": | ||
146 | return HandleGetActiveGestures(request); | ||
147 | case "GETASSETPERMISSIONS": | ||
148 | return HandleGetAssetPermissions(request); | ||
149 | } | ||
150 | m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method); | ||
151 | } | ||
152 | catch (Exception e) | ||
153 | { | ||
154 | m_log.Debug("[XINVENTORY HANDLER]: Exception {0}" + e); | ||
155 | } | ||
156 | |||
157 | return FailureResult(); | ||
158 | } | ||
159 | |||
160 | private byte[] FailureResult() | ||
161 | { | ||
162 | XmlDocument doc = new XmlDocument(); | ||
163 | |||
164 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | ||
165 | "", ""); | ||
166 | |||
167 | doc.AppendChild(xmlnode); | ||
168 | |||
169 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", | ||
170 | ""); | ||
171 | |||
172 | doc.AppendChild(rootElement); | ||
173 | |||
174 | XmlElement result = doc.CreateElement("", "RESULT", ""); | ||
175 | result.AppendChild(doc.CreateTextNode("False")); | ||
176 | |||
177 | rootElement.AppendChild(result); | ||
178 | |||
179 | return DocToBytes(doc); | ||
180 | } | ||
181 | |||
182 | private byte[] DocToBytes(XmlDocument doc) | ||
183 | { | ||
184 | MemoryStream ms = new MemoryStream(); | ||
185 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
186 | xw.Formatting = Formatting.Indented; | ||
187 | doc.WriteTo(xw); | ||
188 | xw.Flush(); | ||
189 | |||
190 | return ms.ToArray(); | ||
191 | } | ||
192 | |||
193 | byte[] HandleCreateUserInventory(Dictionary<string,object> request) | ||
194 | { | ||
195 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
196 | |||
197 | if (!request.ContainsKey("PRINCIPAL")) | ||
198 | return FailureResult(); | ||
199 | |||
200 | if(m_InventoryService.CreateUserInventory(new UUID(request["PRINCIPAL"].ToString()))) | ||
201 | result["RESULT"] = "True"; | ||
202 | else | ||
203 | result["RESULT"] = "False"; | ||
204 | |||
205 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
206 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
207 | UTF8Encoding encoding = new UTF8Encoding(); | ||
208 | return encoding.GetBytes(xmlString); | ||
209 | } | ||
210 | |||
211 | byte[] HandleGetInventorySkeleton(Dictionary<string,object> request) | ||
212 | { | ||
213 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
214 | |||
215 | if (!request.ContainsKey("PRINCIPAL")) | ||
216 | return FailureResult(); | ||
217 | |||
218 | |||
219 | List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); | ||
220 | |||
221 | foreach (InventoryFolderBase f in folders) | ||
222 | result[f.ID.ToString()] = EncodeFolder(f); | ||
223 | |||
224 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
225 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
226 | UTF8Encoding encoding = new UTF8Encoding(); | ||
227 | return encoding.GetBytes(xmlString); | ||
228 | } | ||
229 | |||
230 | byte[] HandleGetRootFolder(Dictionary<string,object> request) | ||
231 | { | ||
232 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
233 | |||
234 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
235 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
236 | UTF8Encoding encoding = new UTF8Encoding(); | ||
237 | return encoding.GetBytes(xmlString); | ||
238 | } | ||
239 | |||
240 | byte[] HandleGetFolderForType(Dictionary<string,object> request) | ||
241 | { | ||
242 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
243 | |||
244 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
245 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
246 | UTF8Encoding encoding = new UTF8Encoding(); | ||
247 | return encoding.GetBytes(xmlString); | ||
248 | } | ||
249 | |||
250 | byte[] HandleGetFolderContent(Dictionary<string,object> request) | ||
251 | { | ||
252 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
253 | |||
254 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
255 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
256 | UTF8Encoding encoding = new UTF8Encoding(); | ||
257 | return encoding.GetBytes(xmlString); | ||
258 | } | ||
259 | |||
260 | byte[] HandleGetFolderItems(Dictionary<string,object> request) | ||
261 | { | ||
262 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
263 | |||
264 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
265 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
266 | UTF8Encoding encoding = new UTF8Encoding(); | ||
267 | return encoding.GetBytes(xmlString); | ||
268 | } | ||
269 | |||
270 | byte[] HandleAddFolder(Dictionary<string,object> request) | ||
271 | { | ||
272 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
273 | |||
274 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
275 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
276 | UTF8Encoding encoding = new UTF8Encoding(); | ||
277 | return encoding.GetBytes(xmlString); | ||
278 | } | ||
279 | |||
280 | byte[] HandleUpdateFolder(Dictionary<string,object> request) | ||
281 | { | ||
282 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
283 | |||
284 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
285 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
286 | UTF8Encoding encoding = new UTF8Encoding(); | ||
287 | return encoding.GetBytes(xmlString); | ||
288 | } | ||
289 | |||
290 | byte[] HandleMoveFolder(Dictionary<string,object> request) | ||
291 | { | ||
292 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
293 | |||
294 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
295 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
296 | UTF8Encoding encoding = new UTF8Encoding(); | ||
297 | return encoding.GetBytes(xmlString); | ||
298 | } | ||
299 | |||
300 | byte[] HandleDeleteFolders(Dictionary<string,object> request) | ||
301 | { | ||
302 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
303 | |||
304 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
305 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
306 | UTF8Encoding encoding = new UTF8Encoding(); | ||
307 | return encoding.GetBytes(xmlString); | ||
308 | } | ||
309 | |||
310 | byte[] HandlePurgeFolder(Dictionary<string,object> request) | ||
311 | { | ||
312 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
313 | |||
314 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
315 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
316 | UTF8Encoding encoding = new UTF8Encoding(); | ||
317 | return encoding.GetBytes(xmlString); | ||
318 | } | ||
319 | |||
320 | byte[] HandleAddItem(Dictionary<string,object> request) | ||
321 | { | ||
322 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
323 | |||
324 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
325 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
326 | UTF8Encoding encoding = new UTF8Encoding(); | ||
327 | return encoding.GetBytes(xmlString); | ||
328 | } | ||
329 | |||
330 | byte[] HandleUpdateItem(Dictionary<string,object> request) | ||
331 | { | ||
332 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
333 | |||
334 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
335 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
336 | UTF8Encoding encoding = new UTF8Encoding(); | ||
337 | return encoding.GetBytes(xmlString); | ||
338 | } | ||
339 | |||
340 | byte[] HandleMoveItems(Dictionary<string,object> request) | ||
341 | { | ||
342 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
343 | |||
344 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
345 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
346 | UTF8Encoding encoding = new UTF8Encoding(); | ||
347 | return encoding.GetBytes(xmlString); | ||
348 | } | ||
349 | |||
350 | byte[] HandleDeleteItems(Dictionary<string,object> request) | ||
351 | { | ||
352 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
353 | |||
354 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
355 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
356 | UTF8Encoding encoding = new UTF8Encoding(); | ||
357 | return encoding.GetBytes(xmlString); | ||
358 | } | ||
359 | |||
360 | byte[] HandleGetItem(Dictionary<string,object> request) | ||
361 | { | ||
362 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
363 | |||
364 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
365 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
366 | UTF8Encoding encoding = new UTF8Encoding(); | ||
367 | return encoding.GetBytes(xmlString); | ||
368 | } | ||
369 | |||
370 | byte[] HandleGetFolder(Dictionary<string,object> request) | ||
371 | { | ||
372 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
373 | |||
374 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
375 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
376 | UTF8Encoding encoding = new UTF8Encoding(); | ||
377 | return encoding.GetBytes(xmlString); | ||
378 | } | ||
379 | |||
380 | byte[] HandleGetActiveGestures(Dictionary<string,object> request) | ||
381 | { | ||
382 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
383 | |||
384 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
385 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
386 | UTF8Encoding encoding = new UTF8Encoding(); | ||
387 | return encoding.GetBytes(xmlString); | ||
388 | } | ||
389 | |||
390 | byte[] HandleGetAssetPermissions(Dictionary<string,object> request) | ||
391 | { | ||
392 | Dictionary<string,object> result = new Dictionary<string,object>(); | ||
393 | |||
394 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
395 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
396 | UTF8Encoding encoding = new UTF8Encoding(); | ||
397 | return encoding.GetBytes(xmlString); | ||
398 | } | ||
399 | |||
400 | private Dictionary<string, object> EncodeFolder(InventoryFolderBase f) | ||
401 | { | ||
402 | Dictionary<string, object> ret = new Dictionary<string, object>(); | ||
403 | |||
404 | ret["ParentID"] = f.ParentID.ToString(); | ||
405 | ret["Type"] = f.Type.ToString(); | ||
406 | ret["Version"] = f.Version.ToString(); | ||
407 | ret["Name"] = f.Name; | ||
408 | ret["Owner"] = f.Owner.ToString(); | ||
409 | ret["ID"] = f.ID.ToString(); | ||
410 | |||
411 | return ret; | ||
412 | } | ||
413 | |||
414 | private InventoryFolderBase BuildFolder(Dictionary<string,object> data) | ||
415 | { | ||
416 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
417 | |||
418 | folder.ParentID = new UUID(data["ParentID"].ToString()); | ||
419 | folder.Type = short.Parse(data["Type"].ToString()); | ||
420 | folder.Version = ushort.Parse(data["Version"].ToString()); | ||
421 | folder.Name = data["Name"].ToString(); | ||
422 | folder.Owner = new UUID(data["Owner"].ToString()); | ||
423 | folder.ID = new UUID(data["ID"].ToString()); | ||
424 | |||
425 | return folder; | ||
426 | } | ||
427 | |||
428 | private InventoryItemBase BuildItem(Dictionary<string,object> data) | ||
429 | { | ||
430 | InventoryItemBase item = new InventoryItemBase(); | ||
431 | |||
432 | item.AssetID = new UUID(data["AssetID"].ToString()); | ||
433 | item.AssetType = int.Parse(data["AssetType"].ToString()); | ||
434 | item.Name = data["Name"].ToString(); | ||
435 | item.Owner = new UUID(data["Owner"].ToString()); | ||
436 | item.ID = new UUID(data["ID"].ToString()); | ||
437 | item.InvType = int.Parse(data["InvType"].ToString()); | ||
438 | item.Folder = new UUID(data["Folder"].ToString()); | ||
439 | item.CreatorId = data["CreatorId"].ToString(); | ||
440 | item.Description = data["Description"].ToString(); | ||
441 | item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); | ||
442 | item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); | ||
443 | item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); | ||
444 | item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); | ||
445 | item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); | ||
446 | item.GroupID = new UUID(data["GroupID"].ToString()); | ||
447 | item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); | ||
448 | item.SalePrice = int.Parse(data["SalePrice"].ToString()); | ||
449 | item.SaleType = byte.Parse(data["SaleType"].ToString()); | ||
450 | item.Flags = uint.Parse(data["Flags"].ToString()); | ||
451 | item.CreationDate = int.Parse(data["CreationDate"].ToString()); | ||
452 | |||
453 | return item; | ||
454 | } | ||
455 | } | ||
456 | } | ||