InventoryService.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  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. using System;
  28. using System.Collections.Generic;
  29. using System.Reflection;
  30. using log4net;
  31. using Nini.Config;
  32. using OpenMetaverse;
  33. using OpenSim.Data;
  34. using OpenSim.Framework;
  35. using OpenSim.Services.Interfaces;
  36. namespace OpenSim.Services.InventoryService
  37. {
  38. /// <summary>
  39. /// The Inventory service reference implementation
  40. /// </summary>
  41. public class InventoryService : InventoryServiceBase, IInventoryService
  42. {
  43. private static readonly ILog m_log
  44. = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  45. public InventoryService(IConfigSource config) : base(config)
  46. {
  47. m_log.Debug("[INVENTORY SERVICE]: Initialized.");
  48. }
  49. #region IInventoryServices methods
  50. public string Host
  51. {
  52. get { return "default"; }
  53. }
  54. public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
  55. {
  56. m_log.DebugFormat("[INVENTORY SERVICE]: Getting inventory skeleton for {0}", userId);
  57. InventoryFolderBase rootFolder = GetRootFolder(userId);
  58. // Agent has no inventory structure yet.
  59. if (null == rootFolder)
  60. {
  61. m_log.DebugFormat("[INVENTORY SERVICE]: No root folder");
  62. return null;
  63. }
  64. List<InventoryFolderBase> userFolders = new List<InventoryFolderBase>();
  65. userFolders.Add(rootFolder);
  66. IList<InventoryFolderBase> folders = m_Database.getFolderHierarchy(rootFolder.ID);
  67. userFolders.AddRange(folders);
  68. // m_log.DebugFormat("[INVENTORY SERVICE]: Got folder {0} {1}", folder.name, folder.folderID);
  69. return userFolders;
  70. }
  71. public virtual bool HasInventoryForUser(UUID userID)
  72. {
  73. return false;
  74. }
  75. // See IInventoryServices
  76. public virtual InventoryFolderBase GetRootFolder(UUID userID)
  77. {
  78. //m_log.DebugFormat("[INVENTORY SERVICE]: Getting root folder for {0}", userID);
  79. // Retrieve the first root folder we get from the DB.
  80. InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID);
  81. if (rootFolder != null)
  82. return rootFolder;
  83. // Return nothing if the plugin was unable to supply a root folder
  84. return null;
  85. }
  86. // See IInventoryServices
  87. public bool CreateUserInventory(UUID user)
  88. {
  89. InventoryFolderBase existingRootFolder;
  90. try
  91. {
  92. existingRootFolder = GetRootFolder(user);
  93. }
  94. catch /*(Exception e)*/
  95. {
  96. // Munch the exception, it has already been reported
  97. //
  98. return false;
  99. }
  100. if (null != existingRootFolder)
  101. {
  102. m_log.WarnFormat(
  103. "[INVENTORY SERVICE]: Did not create a new inventory for user {0} since they already have "
  104. + "a root inventory folder with id {1}",
  105. user, existingRootFolder.ID);
  106. }
  107. else
  108. {
  109. UsersInventory inven = new UsersInventory();
  110. inven.CreateNewInventorySet(user);
  111. AddNewInventorySet(inven);
  112. return true;
  113. }
  114. return false;
  115. }
  116. // See IInventoryServices
  117. /// <summary>
  118. /// Return a user's entire inventory synchronously
  119. /// </summary>
  120. /// <param name="rawUserID"></param>
  121. /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns>
  122. public InventoryCollection GetUserInventory(UUID userID)
  123. {
  124. m_log.InfoFormat("[INVENTORY SERVICE]: Processing request for inventory of {0}", userID);
  125. // Uncomment me to simulate a slow responding inventory server
  126. //Thread.Sleep(16000);
  127. InventoryCollection invCollection = new InventoryCollection();
  128. List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
  129. if (null == allFolders)
  130. {
  131. m_log.WarnFormat("[INVENTORY SERVICE]: No inventory found for user {0}", userID);
  132. return invCollection;
  133. }
  134. List<InventoryItemBase> allItems = new List<InventoryItemBase>();
  135. foreach (InventoryFolderBase folder in allFolders)
  136. {
  137. List<InventoryItemBase> items = GetFolderItems(userID, folder.ID);
  138. if (items != null)
  139. {
  140. allItems.InsertRange(0, items);
  141. }
  142. }
  143. invCollection.UserID = userID;
  144. invCollection.Folders = allFolders;
  145. invCollection.Items = allItems;
  146. // foreach (InventoryFolderBase folder in invCollection.Folders)
  147. // {
  148. // m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back folder {0} {1}", folder.Name, folder.ID);
  149. // }
  150. //
  151. // foreach (InventoryItemBase item in invCollection.Items)
  152. // {
  153. // m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
  154. // }
  155. m_log.InfoFormat(
  156. "[INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items",
  157. invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
  158. return invCollection;
  159. }
  160. /// <summary>
  161. /// Asynchronous inventory fetch.
  162. /// </summary>
  163. /// <param name="userID"></param>
  164. /// <param name="callback"></param>
  165. public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
  166. {
  167. m_log.InfoFormat("[INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
  168. List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
  169. List<InventoryItemBase> items = new List<InventoryItemBase>();
  170. List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID);
  171. if (skeletonFolders != null)
  172. {
  173. InventoryFolderImpl rootFolder = null;
  174. // Need to retrieve the root folder on the first pass
  175. foreach (InventoryFolderBase folder in skeletonFolders)
  176. {
  177. if (folder.ParentID == UUID.Zero)
  178. {
  179. rootFolder = new InventoryFolderImpl(folder);
  180. folders.Add(rootFolder);
  181. items.AddRange(GetFolderItems(userID, rootFolder.ID));
  182. break; // Only 1 root folder per user
  183. }
  184. }
  185. if (rootFolder != null)
  186. {
  187. foreach (InventoryFolderBase folder in skeletonFolders)
  188. {
  189. if (folder.ID != rootFolder.ID)
  190. {
  191. folders.Add(new InventoryFolderImpl(folder));
  192. items.AddRange(GetFolderItems(userID, folder.ID));
  193. }
  194. }
  195. }
  196. m_log.InfoFormat(
  197. "[INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items",
  198. userID, folders.Count, items.Count);
  199. }
  200. else
  201. {
  202. m_log.WarnFormat("[INVENTORY SERVICE]: User {0} inventory not available", userID);
  203. }
  204. Util.FireAndForget(delegate { callback(folders, items); });
  205. }
  206. public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
  207. {
  208. // Uncomment me to simulate a slow responding inventory server
  209. //Thread.Sleep(16000);
  210. InventoryCollection invCollection = new InventoryCollection();
  211. List<InventoryItemBase> items = GetFolderItems(userID, folderID);
  212. List<InventoryFolderBase> folders = RequestSubFolders(folderID);
  213. invCollection.UserID = userID;
  214. invCollection.Folders = folders;
  215. invCollection.Items = items;
  216. m_log.DebugFormat("[INVENTORY SERVICE]: Found {0} items and {1} folders in folder {2}", items.Count, folders.Count, folderID);
  217. return invCollection;
  218. }
  219. public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
  220. {
  221. InventoryFolderBase root = m_Database.getUserRootFolder(userID);
  222. if (root != null)
  223. {
  224. List<InventoryFolderBase> folders = RequestSubFolders(root.ID);
  225. foreach (InventoryFolderBase folder in folders)
  226. {
  227. if (folder.Type == (short)type)
  228. return folder;
  229. }
  230. }
  231. // we didn't find any folder of that type. Return the root folder
  232. // hopefully the root folder is not null. If it is, too bad
  233. return root;
  234. }
  235. public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
  236. {
  237. InventoryFolderBase root = GetRootFolder(userID);
  238. if (root != null)
  239. {
  240. InventoryCollection content = GetFolderContent(userID, root.ID);
  241. if (content != null)
  242. {
  243. Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>();
  244. foreach (InventoryFolderBase folder in content.Folders)
  245. {
  246. if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
  247. folders[(AssetType)folder.Type] = folder;
  248. }
  249. m_log.DebugFormat("[INVENTORY SERVICE]: Got {0} system folders for {1}", folders.Count, userID);
  250. return folders;
  251. }
  252. }
  253. m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID);
  254. return new Dictionary<AssetType, InventoryFolderBase>();
  255. }
  256. public List<InventoryItemBase> GetActiveGestures(UUID userId)
  257. {
  258. List<InventoryItemBase> activeGestures = new List<InventoryItemBase>();
  259. activeGestures.AddRange(m_Database.fetchActiveGestures(userId));
  260. return activeGestures;
  261. }
  262. #endregion
  263. #region Methods used by GridInventoryService
  264. public List<InventoryFolderBase> RequestSubFolders(UUID parentFolderID)
  265. {
  266. List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
  267. inventoryList.AddRange(m_Database.getInventoryFolders(parentFolderID));
  268. return inventoryList;
  269. }
  270. public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
  271. {
  272. List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
  273. itemsList.AddRange(m_Database.getInventoryInFolder(folderID));
  274. return itemsList;
  275. }
  276. #endregion
  277. // See IInventoryServices
  278. public virtual bool AddFolder(InventoryFolderBase folder)
  279. {
  280. m_log.DebugFormat(
  281. "[INVENTORY SERVICE]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
  282. m_Database.addInventoryFolder(folder);
  283. // FIXME: Should return false on failure
  284. return true;
  285. }
  286. // See IInventoryServices
  287. public virtual bool UpdateFolder(InventoryFolderBase folder)
  288. {
  289. m_log.DebugFormat(
  290. "[INVENTORY SERVICE]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
  291. m_Database.updateInventoryFolder(folder);
  292. // FIXME: Should return false on failure
  293. return true;
  294. }
  295. // See IInventoryServices
  296. public virtual bool MoveFolder(InventoryFolderBase folder)
  297. {
  298. m_log.DebugFormat(
  299. "[INVENTORY SERVICE]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
  300. m_Database.moveInventoryFolder(folder);
  301. // FIXME: Should return false on failure
  302. return true;
  303. }
  304. // See IInventoryServices
  305. public virtual bool AddItem(InventoryItemBase item)
  306. {
  307. m_log.DebugFormat(
  308. "[INVENTORY SERVICE]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
  309. m_Database.addInventoryItem(item);
  310. // FIXME: Should return false on failure
  311. return true;
  312. }
  313. // See IInventoryServices
  314. public virtual bool UpdateItem(InventoryItemBase item)
  315. {
  316. m_log.InfoFormat(
  317. "[INVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
  318. m_Database.updateInventoryItem(item);
  319. // FIXME: Should return false on failure
  320. return true;
  321. }
  322. public virtual bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
  323. {
  324. m_log.InfoFormat(
  325. "[INVENTORY SERVICE]: Moving {0} items from user {1}", items.Count, ownerID);
  326. InventoryItemBase itm = null;
  327. foreach (InventoryItemBase item in items)
  328. {
  329. itm = GetInventoryItem(item.ID);
  330. itm.Folder = item.Folder;
  331. if ((item.Name != null) && !item.Name.Equals(string.Empty))
  332. itm.Name = item.Name;
  333. m_Database.updateInventoryItem(itm);
  334. }
  335. return true;
  336. }
  337. // See IInventoryServices
  338. public virtual bool DeleteItems(UUID owner, List<UUID> itemIDs)
  339. {
  340. m_log.InfoFormat(
  341. "[INVENTORY SERVICE]: Deleting {0} items from user {1}", itemIDs.Count, owner);
  342. // uhh.....
  343. foreach (UUID uuid in itemIDs)
  344. m_Database.deleteInventoryItem(uuid);
  345. // FIXME: Should return false on failure
  346. return true;
  347. }
  348. public virtual InventoryItemBase GetItem(InventoryItemBase item)
  349. {
  350. InventoryItemBase result = m_Database.getInventoryItem(item.ID);
  351. if (result != null)
  352. return result;
  353. m_log.DebugFormat("[INVENTORY SERVICE]: GetItem failed to find item {0}", item.ID);
  354. return null;
  355. }
  356. public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
  357. {
  358. InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID);
  359. if (result != null)
  360. return result;
  361. m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID);
  362. return null;
  363. }
  364. public virtual bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
  365. {
  366. m_log.InfoFormat("[INVENTORY SERVICE]: Deleting {0} folders from user {1}", folderIDs.Count, ownerID);
  367. foreach (UUID id in folderIDs)
  368. {
  369. InventoryFolderBase folder = new InventoryFolderBase(id, ownerID);
  370. PurgeFolder(folder);
  371. m_Database.deleteInventoryFolder(id);
  372. }
  373. return true;
  374. }
  375. /// <summary>
  376. /// Purge a folder of all items items and subfolders.
  377. ///
  378. /// FIXME: Really nasty in a sense, because we have to query the database to get information we may
  379. /// already know... Needs heavy refactoring.
  380. /// </summary>
  381. /// <param name="folder"></param>
  382. public virtual bool PurgeFolder(InventoryFolderBase folder)
  383. {
  384. m_log.DebugFormat(
  385. "[INVENTORY SERVICE]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
  386. List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
  387. foreach (InventoryFolderBase subFolder in subFolders)
  388. {
  389. // m_log.DebugFormat("[INVENTORY SERVICE]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
  390. m_Database.deleteInventoryFolder(subFolder.ID);
  391. }
  392. List<InventoryItemBase> items = GetFolderItems(folder.Owner, folder.ID);
  393. List<UUID> uuids = new List<UUID>();
  394. foreach (InventoryItemBase item in items)
  395. {
  396. uuids.Add(item.ID);
  397. }
  398. DeleteItems(folder.Owner, uuids);
  399. // FIXME: Should return false on failure
  400. return true;
  401. }
  402. private void AddNewInventorySet(UsersInventory inventory)
  403. {
  404. foreach (InventoryFolderBase folder in inventory.Folders.Values)
  405. {
  406. AddFolder(folder);
  407. }
  408. }
  409. public InventoryItemBase GetInventoryItem(UUID itemID)
  410. {
  411. InventoryItemBase item = m_Database.getInventoryItem(itemID);
  412. if (item != null)
  413. return item;
  414. return null;
  415. }
  416. public int GetAssetPermissions(UUID userID, UUID assetID)
  417. {
  418. InventoryFolderBase parent = GetRootFolder(userID);
  419. return FindAssetPerms(parent, assetID);
  420. }
  421. private int FindAssetPerms(InventoryFolderBase folder, UUID assetID)
  422. {
  423. InventoryCollection contents = GetFolderContent(folder.Owner, folder.ID);
  424. int perms = 0;
  425. foreach (InventoryItemBase item in contents.Items)
  426. {
  427. if (item.AssetID == assetID)
  428. perms = (int)item.CurrentPermissions | perms;
  429. }
  430. foreach (InventoryFolderBase subfolder in contents.Folders)
  431. perms = perms | FindAssetPerms(subfolder, assetID);
  432. return perms;
  433. }
  434. /// <summary>
  435. /// Used to create a new user inventory.
  436. /// </summary>
  437. private class UsersInventory
  438. {
  439. public Dictionary<UUID, InventoryFolderBase> Folders = new Dictionary<UUID, InventoryFolderBase>();
  440. public Dictionary<UUID, InventoryItemBase> Items = new Dictionary<UUID, InventoryItemBase>();
  441. public virtual void CreateNewInventorySet(UUID user)
  442. {
  443. InventoryFolderBase folder = new InventoryFolderBase();
  444. folder.ParentID = UUID.Zero;
  445. folder.Owner = user;
  446. folder.ID = UUID.Random();
  447. folder.Name = "My Inventory";
  448. folder.Type = (short)AssetType.Folder;
  449. folder.Version = 1;
  450. Folders.Add(folder.ID, folder);
  451. UUID rootFolder = folder.ID;
  452. folder = new InventoryFolderBase();
  453. folder.ParentID = rootFolder;
  454. folder.Owner = user;
  455. folder.ID = UUID.Random();
  456. folder.Name = "Animations";
  457. folder.Type = (short)AssetType.Animation;
  458. folder.Version = 1;
  459. Folders.Add(folder.ID, folder);
  460. folder = new InventoryFolderBase();
  461. folder.ParentID = rootFolder;
  462. folder.Owner = user;
  463. folder.ID = UUID.Random();
  464. folder.Name = "Body Parts";
  465. folder.Type = (short)AssetType.Bodypart;
  466. folder.Version = 1;
  467. Folders.Add(folder.ID, folder);
  468. folder = new InventoryFolderBase();
  469. folder.ParentID = rootFolder;
  470. folder.Owner = user;
  471. folder.ID = UUID.Random();
  472. folder.Name = "Calling Cards";
  473. folder.Type = (short)AssetType.CallingCard;
  474. folder.Version = 1;
  475. Folders.Add(folder.ID, folder);
  476. folder = new InventoryFolderBase();
  477. folder.ParentID = rootFolder;
  478. folder.Owner = user;
  479. folder.ID = UUID.Random();
  480. folder.Name = "Clothing";
  481. folder.Type = (short)AssetType.Clothing;
  482. folder.Version = 1;
  483. Folders.Add(folder.ID, folder);
  484. folder = new InventoryFolderBase();
  485. folder.ParentID = rootFolder;
  486. folder.Owner = user;
  487. folder.ID = UUID.Random();
  488. folder.Name = "Gestures";
  489. folder.Type = (short)AssetType.Gesture;
  490. folder.Version = 1;
  491. Folders.Add(folder.ID, folder);
  492. folder = new InventoryFolderBase();
  493. folder.ParentID = rootFolder;
  494. folder.Owner = user;
  495. folder.ID = UUID.Random();
  496. folder.Name = "Landmarks";
  497. folder.Type = (short)AssetType.Landmark;
  498. folder.Version = 1;
  499. Folders.Add(folder.ID, folder);
  500. folder = new InventoryFolderBase();
  501. folder.ParentID = rootFolder;
  502. folder.Owner = user;
  503. folder.ID = UUID.Random();
  504. folder.Name = "Lost And Found";
  505. folder.Type = (short)AssetType.LostAndFoundFolder;
  506. folder.Version = 1;
  507. Folders.Add(folder.ID, folder);
  508. folder = new InventoryFolderBase();
  509. folder.ParentID = rootFolder;
  510. folder.Owner = user;
  511. folder.ID = UUID.Random();
  512. folder.Name = "Notecards";
  513. folder.Type = (short)AssetType.Notecard;
  514. folder.Version = 1;
  515. Folders.Add(folder.ID, folder);
  516. folder = new InventoryFolderBase();
  517. folder.ParentID = rootFolder;
  518. folder.Owner = user;
  519. folder.ID = UUID.Random();
  520. folder.Name = "Objects";
  521. folder.Type = (short)AssetType.Object;
  522. folder.Version = 1;
  523. Folders.Add(folder.ID, folder);
  524. folder = new InventoryFolderBase();
  525. folder.ParentID = rootFolder;
  526. folder.Owner = user;
  527. folder.ID = UUID.Random();
  528. folder.Name = "Photo Album";
  529. folder.Type = (short)AssetType.SnapshotFolder;
  530. folder.Version = 1;
  531. Folders.Add(folder.ID, folder);
  532. folder = new InventoryFolderBase();
  533. folder.ParentID = rootFolder;
  534. folder.Owner = user;
  535. folder.ID = UUID.Random();
  536. folder.Name = "Scripts";
  537. folder.Type = (short)AssetType.LSLText;
  538. folder.Version = 1;
  539. Folders.Add(folder.ID, folder);
  540. folder = new InventoryFolderBase();
  541. folder.ParentID = rootFolder;
  542. folder.Owner = user;
  543. folder.ID = UUID.Random();
  544. folder.Name = "Sounds";
  545. folder.Type = (short)AssetType.Sound;
  546. folder.Version = 1;
  547. Folders.Add(folder.ID, folder);
  548. folder = new InventoryFolderBase();
  549. folder.ParentID = rootFolder;
  550. folder.Owner = user;
  551. folder.ID = UUID.Random();
  552. folder.Name = "Textures";
  553. folder.Type = (short)AssetType.Texture;
  554. folder.Version = 1;
  555. Folders.Add(folder.ID, folder);
  556. folder = new InventoryFolderBase();
  557. folder.ParentID = rootFolder;
  558. folder.Owner = user;
  559. folder.ID = UUID.Random();
  560. folder.Name = "Trash";
  561. folder.Type = (short)AssetType.TrashFolder;
  562. folder.Version = 1;
  563. Folders.Add(folder.ID, folder);
  564. }
  565. }
  566. }
  567. }