diff options
Diffstat (limited to 'OpenSim/Services/InventoryService')
-rw-r--r-- | OpenSim/Services/InventoryService/InventoryService.cs | 13 | ||||
-rw-r--r-- | OpenSim/Services/InventoryService/XInventoryService.cs | 508 |
2 files changed, 520 insertions, 1 deletions
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index d4da4d3..95007f1 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using log4net; | 31 | using log4net; |
@@ -102,7 +103,17 @@ namespace OpenSim.Services.InventoryService | |||
102 | // See IInventoryServices | 103 | // See IInventoryServices |
103 | public bool CreateUserInventory(UUID user) | 104 | public bool CreateUserInventory(UUID user) |
104 | { | 105 | { |
105 | InventoryFolderBase existingRootFolder = GetRootFolder(user); | 106 | InventoryFolderBase existingRootFolder; |
107 | try | ||
108 | { | ||
109 | existingRootFolder = GetRootFolder(user); | ||
110 | } | ||
111 | catch (Exception e) | ||
112 | { | ||
113 | // Munch the exception, it has already been reported | ||
114 | // | ||
115 | return false; | ||
116 | } | ||
106 | 117 | ||
107 | if (null != existingRootFolder) | 118 | if (null != existingRootFolder) |
108 | { | 119 | { |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs new file mode 100644 index 0000000..2c79c77 --- /dev/null +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -0,0 +1,508 @@ | |||
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.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using System.Reflection; | ||
34 | using OpenSim.Services.Base; | ||
35 | using OpenSim.Services.Interfaces; | ||
36 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | ||
38 | |||
39 | namespace OpenSim.Services.InventoryService | ||
40 | { | ||
41 | public class XInventoryService : ServiceBase, IInventoryService | ||
42 | { | ||
43 | private static readonly ILog m_log = | ||
44 | LogManager.GetLogger( | ||
45 | MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | protected IXInventoryData m_Database; | ||
48 | |||
49 | public XInventoryService(IConfigSource config) : base(config) | ||
50 | { | ||
51 | string dllName = String.Empty; | ||
52 | string connString = String.Empty; | ||
53 | //string realm = "Inventory"; // OSG version doesn't use this | ||
54 | |||
55 | // | ||
56 | // Try reading the [InventoryService] section first, if it exists | ||
57 | // | ||
58 | IConfig authConfig = config.Configs["InventoryService"]; | ||
59 | if (authConfig != null) | ||
60 | { | ||
61 | dllName = authConfig.GetString("StorageProvider", dllName); | ||
62 | connString = authConfig.GetString("ConnectionString", connString); | ||
63 | // realm = authConfig.GetString("Realm", realm); | ||
64 | } | ||
65 | |||
66 | // | ||
67 | // Try reading the [DatabaseService] section, if it exists | ||
68 | // | ||
69 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
70 | if (dbConfig != null) | ||
71 | { | ||
72 | if (dllName == String.Empty) | ||
73 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
74 | if (connString == String.Empty) | ||
75 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
76 | } | ||
77 | |||
78 | // | ||
79 | // We tried, but this doesn't exist. We can't proceed. | ||
80 | // | ||
81 | if (dllName == String.Empty) | ||
82 | throw new Exception("No StorageProvider configured"); | ||
83 | |||
84 | m_Database = LoadPlugin<IXInventoryData>(dllName, | ||
85 | new Object[] {connString, String.Empty}); | ||
86 | if (m_Database == null) | ||
87 | throw new Exception("Could not find a storage interface in the given module"); | ||
88 | } | ||
89 | |||
90 | public bool CreateUserInventory(UUID principalID) | ||
91 | { | ||
92 | // This is braindeaad. We can't ever communicate that we fixed | ||
93 | // an existing inventory. Well, just return root folder status, | ||
94 | // but check sanity anyway. | ||
95 | // | ||
96 | bool result = false; | ||
97 | |||
98 | InventoryFolderBase rootFolder = GetRootFolder(principalID); | ||
99 | |||
100 | if (rootFolder == null) | ||
101 | { | ||
102 | rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "My Inventory")); | ||
103 | result = true; | ||
104 | } | ||
105 | |||
106 | XInventoryFolder[] sysFolders = GetSystemFolders(principalID); | ||
107 | |||
108 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; })) | ||
109 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations"); | ||
110 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; })) | ||
111 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Bodypart, "Body Parts"); | ||
112 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; })) | ||
113 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.CallingCard, "Calling Cards"); | ||
114 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) | ||
115 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Clothing, "Clothing"); | ||
116 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) | ||
117 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Gesture, "Gestures"); | ||
118 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) | ||
119 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Landmark, "Landmarks"); | ||
120 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LostAndFoundFolder) return true; return false; })) | ||
121 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.LostAndFoundFolder, "Lost And Found"); | ||
122 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Notecard) return true; return false; })) | ||
123 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Notecard, "Notecards"); | ||
124 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Object) return true; return false; })) | ||
125 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Object, "Objects"); | ||
126 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.SnapshotFolder) return true; return false; })) | ||
127 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.SnapshotFolder, "Photo Album"); | ||
128 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LSLText) return true; return false; })) | ||
129 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.LSLText, "Scripts"); | ||
130 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Sound) return true; return false; })) | ||
131 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Sound, "Sounds"); | ||
132 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Texture) return true; return false; })) | ||
133 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Texture, "Textures"); | ||
134 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) | ||
135 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.TrashFolder, "Trash"); | ||
136 | |||
137 | return result; | ||
138 | } | ||
139 | |||
140 | private XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name) | ||
141 | { | ||
142 | XInventoryFolder newFolder = new XInventoryFolder(); | ||
143 | |||
144 | newFolder.folderName = name; | ||
145 | newFolder.type = type; | ||
146 | newFolder.version = 1; | ||
147 | newFolder.folderID = UUID.Random(); | ||
148 | newFolder.agentID = principalID; | ||
149 | newFolder.parentFolderID = parentID; | ||
150 | |||
151 | m_Database.StoreFolder(newFolder); | ||
152 | |||
153 | return newFolder; | ||
154 | } | ||
155 | |||
156 | private XInventoryFolder[] GetSystemFolders(UUID principalID) | ||
157 | { | ||
158 | XInventoryFolder[] allFolders = m_Database.GetFolders( | ||
159 | new string[] { "agentID" }, | ||
160 | new string[] { principalID.ToString() }); | ||
161 | |||
162 | XInventoryFolder[] sysFolders = Array.FindAll( | ||
163 | allFolders, | ||
164 | delegate (XInventoryFolder f) | ||
165 | { | ||
166 | if (f.type > 0) | ||
167 | return true; | ||
168 | return false; | ||
169 | }); | ||
170 | |||
171 | return sysFolders; | ||
172 | } | ||
173 | |||
174 | public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) | ||
175 | { | ||
176 | XInventoryFolder[] allFolders = m_Database.GetFolders( | ||
177 | new string[] { "agentID" }, | ||
178 | new string[] { principalID.ToString() }); | ||
179 | |||
180 | if (allFolders.Length == 0) | ||
181 | return null; | ||
182 | |||
183 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
184 | |||
185 | foreach (XInventoryFolder x in allFolders) | ||
186 | { | ||
187 | m_log.DebugFormat("[INVENTORY]: Adding folder {0} to skeleton", x.folderName); | ||
188 | folders.Add(ConvertToOpenSim(x)); | ||
189 | } | ||
190 | |||
191 | return folders; | ||
192 | } | ||
193 | |||
194 | public InventoryFolderBase GetRootFolder(UUID principalID) | ||
195 | { | ||
196 | XInventoryFolder[] folders = m_Database.GetFolders( | ||
197 | new string[] { "agentID", "parentFolderID"}, | ||
198 | new string[] { principalID.ToString(), UUID.Zero.ToString() }); | ||
199 | |||
200 | if (folders.Length == 0) | ||
201 | return null; | ||
202 | |||
203 | return ConvertToOpenSim(folders[0]); | ||
204 | } | ||
205 | |||
206 | public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | ||
207 | { | ||
208 | XInventoryFolder[] folders = m_Database.GetFolders( | ||
209 | new string[] { "agentID", "type"}, | ||
210 | new string[] { principalID.ToString(), ((int)type).ToString() }); | ||
211 | |||
212 | if (folders.Length == 0) | ||
213 | return null; | ||
214 | |||
215 | return ConvertToOpenSim(folders[0]); | ||
216 | } | ||
217 | |||
218 | public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) | ||
219 | { | ||
220 | // This method doesn't receive a valud principal id from the | ||
221 | // connector. So we disregard the principal and look | ||
222 | // by ID. | ||
223 | // | ||
224 | m_log.DebugFormat("[INVENTORY]: Fetch contents for folder {0}", folderID.ToString()); | ||
225 | InventoryCollection inventory = new InventoryCollection(); | ||
226 | inventory.UserID = principalID; | ||
227 | inventory.Folders = new List<InventoryFolderBase>(); | ||
228 | inventory.Items = new List<InventoryItemBase>(); | ||
229 | |||
230 | XInventoryFolder[] folders = m_Database.GetFolders( | ||
231 | new string[] { "parentFolderID"}, | ||
232 | new string[] { folderID.ToString() }); | ||
233 | |||
234 | foreach (XInventoryFolder x in folders) | ||
235 | { | ||
236 | m_log.DebugFormat("[INVENTORY]: Adding folder {0} to response", x.folderName); | ||
237 | inventory.Folders.Add(ConvertToOpenSim(x)); | ||
238 | } | ||
239 | |||
240 | XInventoryItem[] items = m_Database.GetItems( | ||
241 | new string[] { "parentFolderID"}, | ||
242 | new string[] { folderID.ToString() }); | ||
243 | |||
244 | foreach (XInventoryItem i in items) | ||
245 | { | ||
246 | m_log.DebugFormat("[INVENTORY]: Adding item {0} to response", i.inventoryName); | ||
247 | inventory.Items.Add(ConvertToOpenSim(i)); | ||
248 | } | ||
249 | |||
250 | return inventory; | ||
251 | } | ||
252 | |||
253 | public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) | ||
254 | { | ||
255 | // Since we probably don't get a valid principal here, either ... | ||
256 | // | ||
257 | List<InventoryItemBase> invItems = new List<InventoryItemBase>(); | ||
258 | |||
259 | XInventoryItem[] items = m_Database.GetItems( | ||
260 | new string[] { "parentFolderID"}, | ||
261 | new string[] { UUID.Zero.ToString() }); | ||
262 | |||
263 | foreach (XInventoryItem i in items) | ||
264 | invItems.Add(ConvertToOpenSim(i)); | ||
265 | |||
266 | return invItems; | ||
267 | } | ||
268 | |||
269 | public bool AddFolder(InventoryFolderBase folder) | ||
270 | { | ||
271 | XInventoryFolder xFolder = ConvertFromOpenSim(folder); | ||
272 | return m_Database.StoreFolder(xFolder); | ||
273 | } | ||
274 | |||
275 | public bool UpdateFolder(InventoryFolderBase folder) | ||
276 | { | ||
277 | return AddFolder(folder); | ||
278 | } | ||
279 | |||
280 | public bool MoveFolder(InventoryFolderBase folder) | ||
281 | { | ||
282 | XInventoryFolder[] x = m_Database.GetFolders( | ||
283 | new string[] { "folderID" }, | ||
284 | new string[] { folder.ID.ToString() }); | ||
285 | |||
286 | if (x.Length == 0) | ||
287 | return false; | ||
288 | |||
289 | x[0].parentFolderID = folder.ParentID; | ||
290 | |||
291 | return m_Database.StoreFolder(x[0]); | ||
292 | } | ||
293 | |||
294 | // We don't check the principal's ID here | ||
295 | // | ||
296 | public bool DeleteFolders(UUID principalID, List<UUID> folderIDs) | ||
297 | { | ||
298 | // Ignore principal ID, it's bogus at connector level | ||
299 | // | ||
300 | foreach (UUID id in folderIDs) | ||
301 | { | ||
302 | InventoryFolderBase f = new InventoryFolderBase(); | ||
303 | f.ID = id; | ||
304 | PurgeFolder(f); | ||
305 | m_Database.DeleteFolders("folderID", id.ToString()); | ||
306 | } | ||
307 | |||
308 | return true; | ||
309 | } | ||
310 | |||
311 | public bool PurgeFolder(InventoryFolderBase folder) | ||
312 | { | ||
313 | XInventoryFolder[] subFolders = m_Database.GetFolders( | ||
314 | new string[] { "parentFolderID" }, | ||
315 | new string[] { folder.ID.ToString() }); | ||
316 | |||
317 | foreach (XInventoryFolder x in subFolders) | ||
318 | { | ||
319 | PurgeFolder(ConvertToOpenSim(x)); | ||
320 | m_Database.DeleteFolders("folderID", x.folderID.ToString()); | ||
321 | } | ||
322 | |||
323 | m_Database.DeleteItems("parentFolderID", folder.ID.ToString()); | ||
324 | |||
325 | return true; | ||
326 | } | ||
327 | |||
328 | public bool AddItem(InventoryItemBase item) | ||
329 | { | ||
330 | return m_Database.StoreItem(ConvertFromOpenSim(item)); | ||
331 | } | ||
332 | |||
333 | public bool UpdateItem(InventoryItemBase item) | ||
334 | { | ||
335 | return m_Database.StoreItem(ConvertFromOpenSim(item)); | ||
336 | } | ||
337 | |||
338 | public bool MoveItems(UUID principalID, List<InventoryItemBase> items) | ||
339 | { | ||
340 | // Principal is b0rked. *sigh* | ||
341 | // | ||
342 | foreach (InventoryItemBase i in items) | ||
343 | { | ||
344 | m_Database.MoveItem(i.ID.ToString(), i.Folder.ToString()); | ||
345 | } | ||
346 | |||
347 | return true; | ||
348 | } | ||
349 | |||
350 | public bool DeleteItems(UUID principalID, List<UUID> itemIDs) | ||
351 | { | ||
352 | // Just use the ID... *facepalms* | ||
353 | // | ||
354 | foreach (UUID id in itemIDs) | ||
355 | m_Database.DeleteItems("inventoryID", id.ToString()); | ||
356 | |||
357 | return true; | ||
358 | } | ||
359 | |||
360 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
361 | { | ||
362 | XInventoryItem[] items = m_Database.GetItems( | ||
363 | new string[] { "inventoryID" }, | ||
364 | new string[] { item.ID.ToString() }); | ||
365 | |||
366 | if (items.Length == 0) | ||
367 | return null; | ||
368 | |||
369 | return ConvertToOpenSim(items[0]); | ||
370 | } | ||
371 | |||
372 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
373 | { | ||
374 | XInventoryFolder[] folders = m_Database.GetFolders( | ||
375 | new string[] { "folderID"}, | ||
376 | new string[] { folder.ID.ToString() }); | ||
377 | |||
378 | if (folders.Length == 0) | ||
379 | return null; | ||
380 | |||
381 | return ConvertToOpenSim(folders[0]); | ||
382 | } | ||
383 | |||
384 | public List<InventoryItemBase> GetActiveGestures(UUID principalID) | ||
385 | { | ||
386 | XInventoryItem[] items = m_Database.GetActiveGestures(principalID); | ||
387 | |||
388 | if (items.Length == 0) | ||
389 | return null; | ||
390 | |||
391 | List<InventoryItemBase> ret = new List<InventoryItemBase>(); | ||
392 | |||
393 | foreach (XInventoryItem x in items) | ||
394 | ret.Add(ConvertToOpenSim(x)); | ||
395 | |||
396 | return ret; | ||
397 | } | ||
398 | |||
399 | public int GetAssetPermissions(UUID principalID, UUID assetID) | ||
400 | { | ||
401 | return m_Database.GetAssetPermissions(principalID, assetID); | ||
402 | } | ||
403 | |||
404 | // CM never needed those. Left unimplemented. | ||
405 | // Obsolete in core | ||
406 | // | ||
407 | public InventoryCollection GetUserInventory(UUID userID) | ||
408 | { | ||
409 | return null; | ||
410 | } | ||
411 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
412 | { | ||
413 | } | ||
414 | |||
415 | // Unused. | ||
416 | // | ||
417 | public bool HasInventoryForUser(UUID userID) | ||
418 | { | ||
419 | return false; | ||
420 | } | ||
421 | |||
422 | // CM Helpers | ||
423 | // | ||
424 | private InventoryFolderBase ConvertToOpenSim(XInventoryFolder folder) | ||
425 | { | ||
426 | InventoryFolderBase newFolder = new InventoryFolderBase(); | ||
427 | |||
428 | newFolder.ParentID = folder.parentFolderID; | ||
429 | newFolder.Type = (short)folder.type; | ||
430 | newFolder.Version = (ushort)folder.version; | ||
431 | newFolder.Name = folder.folderName; | ||
432 | newFolder.Owner = folder.agentID; | ||
433 | newFolder.ID = folder.folderID; | ||
434 | |||
435 | return newFolder; | ||
436 | } | ||
437 | |||
438 | private XInventoryFolder ConvertFromOpenSim(InventoryFolderBase folder) | ||
439 | { | ||
440 | XInventoryFolder newFolder = new XInventoryFolder(); | ||
441 | |||
442 | newFolder.parentFolderID = folder.ParentID; | ||
443 | newFolder.type = (int)folder.Type; | ||
444 | newFolder.version = (int)folder.Version; | ||
445 | newFolder.folderName = folder.Name; | ||
446 | newFolder.agentID = folder.Owner; | ||
447 | newFolder.folderID = folder.ID; | ||
448 | |||
449 | return newFolder; | ||
450 | } | ||
451 | |||
452 | private InventoryItemBase ConvertToOpenSim(XInventoryItem item) | ||
453 | { | ||
454 | InventoryItemBase newItem = new InventoryItemBase(); | ||
455 | |||
456 | newItem.AssetID = item.assetID; | ||
457 | newItem.AssetType = item.assetType; | ||
458 | newItem.Name = item.inventoryName; | ||
459 | newItem.Owner = item.avatarID; | ||
460 | newItem.ID = item.inventoryID; | ||
461 | newItem.InvType = item.invType; | ||
462 | newItem.Folder = item.parentFolderID; | ||
463 | newItem.CreatorId = item.creatorID.ToString(); | ||
464 | newItem.Description = item.inventoryDescription; | ||
465 | newItem.NextPermissions = (uint)item.inventoryNextPermissions; | ||
466 | newItem.CurrentPermissions = (uint)item.inventoryCurrentPermissions; | ||
467 | newItem.BasePermissions = (uint)item.inventoryBasePermissions; | ||
468 | newItem.EveryOnePermissions = (uint)item.inventoryEveryOnePermissions; | ||
469 | newItem.GroupPermissions = (uint)item.inventoryGroupPermissions; | ||
470 | newItem.GroupID = item.groupID; | ||
471 | newItem.GroupOwned = item.groupOwned; | ||
472 | newItem.SalePrice = item.salePrice; | ||
473 | newItem.SaleType = (byte)item.saleType; | ||
474 | newItem.Flags = (uint)item.flags; | ||
475 | newItem.CreationDate = item.creationDate; | ||
476 | |||
477 | return newItem; | ||
478 | } | ||
479 | |||
480 | private XInventoryItem ConvertFromOpenSim(InventoryItemBase item) | ||
481 | { | ||
482 | XInventoryItem newItem = new XInventoryItem(); | ||
483 | |||
484 | newItem.assetID = item.AssetID; | ||
485 | newItem.assetType = item.AssetType; | ||
486 | newItem.inventoryName = item.Name; | ||
487 | newItem.avatarID = item.Owner; | ||
488 | newItem.inventoryID = item.ID; | ||
489 | newItem.invType = item.InvType; | ||
490 | newItem.parentFolderID = item.Folder; | ||
491 | newItem.creatorID = item.CreatorIdAsUuid; | ||
492 | newItem.inventoryDescription = item.Description; | ||
493 | newItem.inventoryNextPermissions = (int)item.NextPermissions; | ||
494 | newItem.inventoryCurrentPermissions = (int)item.CurrentPermissions; | ||
495 | newItem.inventoryBasePermissions = (int)item.BasePermissions; | ||
496 | newItem.inventoryEveryOnePermissions = (int)item.EveryOnePermissions; | ||
497 | newItem.inventoryGroupPermissions = (int)item.GroupPermissions; | ||
498 | newItem.groupID = item.GroupID; | ||
499 | newItem.groupOwned = item.GroupOwned; | ||
500 | newItem.salePrice = item.SalePrice; | ||
501 | newItem.saleType = (int)item.SaleType; | ||
502 | newItem.flags = (int)item.Flags; | ||
503 | newItem.creationDate = item.CreationDate; | ||
504 | |||
505 | return newItem; | ||
506 | } | ||
507 | } | ||
508 | } | ||