InventoryService.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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. // m_log.DebugFormat("[INVENTORY SERVICE]: Looking for folder type {0} for user {1}", type, userID);
  222. InventoryFolderBase root = m_Database.getUserRootFolder(userID);
  223. if (root != null)
  224. {
  225. List<InventoryFolderBase> folders = RequestSubFolders(root.ID);
  226. foreach (InventoryFolderBase folder in folders)
  227. {
  228. if (folder.Type == (short)type)
  229. {
  230. // m_log.DebugFormat(
  231. // "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type);
  232. return folder;
  233. }
  234. }
  235. }
  236. // we didn't find any folder of that type. Return the root folder
  237. // hopefully the root folder is not null. If it is, too bad
  238. return root;
  239. }
  240. public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
  241. {
  242. InventoryFolderBase root = GetRootFolder(userID);
  243. if (root != null)
  244. {
  245. InventoryCollection content = GetFolderContent(userID, root.ID);
  246. if (content != null)
  247. {
  248. Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>();
  249. foreach (InventoryFolderBase folder in content.Folders)
  250. {
  251. if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
  252. folders[(AssetType)folder.Type] = folder;
  253. }
  254. m_log.DebugFormat("[INVENTORY SERVICE]: Got {0} system folders for {1}", folders.Count, userID);
  255. return folders;
  256. }
  257. }
  258. m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID);
  259. return new Dictionary<AssetType, InventoryFolderBase>();
  260. }
  261. public List<InventoryItemBase> GetActiveGestures(UUID userId)
  262. {
  263. List<InventoryItemBase> activeGestures = new List<InventoryItemBase>();
  264. activeGestures.AddRange(m_Database.fetchActiveGestures(userId));
  265. return activeGestures;
  266. }
  267. #endregion
  268. #region Methods used by GridInventoryService
  269. public List<InventoryFolderBase> RequestSubFolders(UUID parentFolderID)
  270. {
  271. List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
  272. inventoryList.AddRange(m_Database.getInventoryFolders(parentFolderID));
  273. return inventoryList;
  274. }
  275. public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
  276. {
  277. List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
  278. itemsList.AddRange(m_Database.getInventoryInFolder(folderID));
  279. return itemsList;
  280. }
  281. #endregion
  282. // See IInventoryServices
  283. public virtual bool AddFolder(InventoryFolderBase folder)
  284. {
  285. m_log.DebugFormat(
  286. "[INVENTORY SERVICE]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
  287. m_Database.addInventoryFolder(folder);
  288. // FIXME: Should return false on failure
  289. return true;
  290. }
  291. // See IInventoryServices
  292. public virtual bool UpdateFolder(InventoryFolderBase folder)
  293. {
  294. m_log.DebugFormat(
  295. "[INVENTORY SERVICE]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
  296. m_Database.updateInventoryFolder(folder);
  297. // FIXME: Should return false on failure
  298. return true;
  299. }
  300. // See IInventoryServices
  301. public virtual bool MoveFolder(InventoryFolderBase folder)
  302. {
  303. m_log.DebugFormat(
  304. "[INVENTORY SERVICE]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
  305. m_Database.moveInventoryFolder(folder);
  306. // FIXME: Should return false on failure
  307. return true;
  308. }
  309. // See IInventoryServices
  310. public virtual bool AddItem(InventoryItemBase item)
  311. {
  312. m_log.DebugFormat(
  313. "[INVENTORY SERVICE]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
  314. m_Database.addInventoryItem(item);
  315. // FIXME: Should return false on failure
  316. return true;
  317. }
  318. // See IInventoryServices
  319. public virtual bool UpdateItem(InventoryItemBase item)
  320. {
  321. m_log.InfoFormat(
  322. "[INVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
  323. m_Database.updateInventoryItem(item);
  324. // FIXME: Should return false on failure
  325. return true;
  326. }
  327. public virtual bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
  328. {
  329. m_log.InfoFormat(
  330. "[INVENTORY SERVICE]: Moving {0} items from user {1}", items.Count, ownerID);
  331. InventoryItemBase itm = null;
  332. foreach (InventoryItemBase item in items)
  333. {
  334. itm = GetInventoryItem(item.ID);
  335. itm.Folder = item.Folder;
  336. if ((item.Name != null) && !item.Name.Equals(string.Empty))
  337. itm.Name = item.Name;
  338. m_Database.updateInventoryItem(itm);
  339. }
  340. return true;
  341. }
  342. // See IInventoryServices
  343. public virtual bool DeleteItems(UUID owner, List<UUID> itemIDs)
  344. {
  345. m_log.InfoFormat(
  346. "[INVENTORY SERVICE]: Deleting {0} items from user {1}", itemIDs.Count, owner);
  347. // uhh.....
  348. foreach (UUID uuid in itemIDs)
  349. m_Database.deleteInventoryItem(uuid);
  350. // FIXME: Should return false on failure
  351. return true;
  352. }
  353. public virtual InventoryItemBase GetItem(InventoryItemBase item)
  354. {
  355. InventoryItemBase result = m_Database.getInventoryItem(item.ID);
  356. if (result != null)
  357. return result;
  358. m_log.DebugFormat("[INVENTORY SERVICE]: GetItem failed to find item {0}", item.ID);
  359. return null;
  360. }
  361. public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
  362. {
  363. InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID);
  364. if (result != null)
  365. return result;
  366. m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID);
  367. return null;
  368. }
  369. public virtual bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
  370. {
  371. m_log.InfoFormat("[INVENTORY SERVICE]: Deleting {0} folders from user {1}", folderIDs.Count, ownerID);
  372. foreach (UUID id in folderIDs)
  373. {
  374. InventoryFolderBase folder = new InventoryFolderBase(id, ownerID);
  375. PurgeFolder(folder);
  376. m_Database.deleteInventoryFolder(id);
  377. }
  378. return true;
  379. }
  380. /// <summary>
  381. /// Purge a folder of all items items and subfolders.
  382. ///
  383. /// FIXME: Really nasty in a sense, because we have to query the database to get information we may
  384. /// already know... Needs heavy refactoring.
  385. /// </summary>
  386. /// <param name="folder"></param>
  387. public virtual bool PurgeFolder(InventoryFolderBase folder)
  388. {
  389. m_log.DebugFormat(
  390. "[INVENTORY SERVICE]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
  391. List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
  392. foreach (InventoryFolderBase subFolder in subFolders)
  393. {
  394. // m_log.DebugFormat("[INVENTORY SERVICE]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
  395. m_Database.deleteInventoryFolder(subFolder.ID);
  396. }
  397. List<InventoryItemBase> items = GetFolderItems(folder.Owner, folder.ID);
  398. List<UUID> uuids = new List<UUID>();
  399. foreach (InventoryItemBase item in items)
  400. {
  401. uuids.Add(item.ID);
  402. }
  403. DeleteItems(folder.Owner, uuids);
  404. // FIXME: Should return false on failure
  405. return true;
  406. }
  407. private void AddNewInventorySet(UsersInventory inventory)
  408. {
  409. foreach (InventoryFolderBase folder in inventory.Folders.Values)
  410. {
  411. AddFolder(folder);
  412. }
  413. }
  414. public InventoryItemBase GetInventoryItem(UUID itemID)
  415. {
  416. InventoryItemBase item = m_Database.getInventoryItem(itemID);
  417. if (item != null)
  418. return item;
  419. return null;
  420. }
  421. public int GetAssetPermissions(UUID userID, UUID assetID)
  422. {
  423. InventoryFolderBase parent = GetRootFolder(userID);
  424. return FindAssetPerms(parent, assetID);
  425. }
  426. private int FindAssetPerms(InventoryFolderBase folder, UUID assetID)
  427. {
  428. InventoryCollection contents = GetFolderContent(folder.Owner, folder.ID);
  429. int perms = 0;
  430. foreach (InventoryItemBase item in contents.Items)
  431. {
  432. if (item.AssetID == assetID)
  433. perms = (int)item.CurrentPermissions | perms;
  434. }
  435. foreach (InventoryFolderBase subfolder in contents.Folders)
  436. perms = perms | FindAssetPerms(subfolder, assetID);
  437. return perms;
  438. }
  439. /// <summary>
  440. /// Used to create a new user inventory.
  441. /// </summary>
  442. private class UsersInventory
  443. {
  444. public Dictionary<UUID, InventoryFolderBase> Folders = new Dictionary<UUID, InventoryFolderBase>();
  445. public Dictionary<UUID, InventoryItemBase> Items = new Dictionary<UUID, InventoryItemBase>();
  446. public virtual void CreateNewInventorySet(UUID user)
  447. {
  448. InventoryFolderBase folder = new InventoryFolderBase();
  449. folder.ParentID = UUID.Zero;
  450. folder.Owner = user;
  451. folder.ID = UUID.Random();
  452. folder.Name = "My Inventory";
  453. folder.Type = (short)AssetType.Folder;
  454. folder.Version = 1;
  455. Folders.Add(folder.ID, folder);
  456. UUID rootFolder = folder.ID;
  457. folder = new InventoryFolderBase();
  458. folder.ParentID = rootFolder;
  459. folder.Owner = user;
  460. folder.ID = UUID.Random();
  461. folder.Name = "Animations";
  462. folder.Type = (short)AssetType.Animation;
  463. folder.Version = 1;
  464. Folders.Add(folder.ID, folder);
  465. folder = new InventoryFolderBase();
  466. folder.ParentID = rootFolder;
  467. folder.Owner = user;
  468. folder.ID = UUID.Random();
  469. folder.Name = "Body Parts";
  470. folder.Type = (short)AssetType.Bodypart;
  471. folder.Version = 1;
  472. Folders.Add(folder.ID, folder);
  473. folder = new InventoryFolderBase();
  474. folder.ParentID = rootFolder;
  475. folder.Owner = user;
  476. folder.ID = UUID.Random();
  477. folder.Name = "Calling Cards";
  478. folder.Type = (short)AssetType.CallingCard;
  479. folder.Version = 1;
  480. Folders.Add(folder.ID, folder);
  481. folder = new InventoryFolderBase();
  482. folder.ParentID = rootFolder;
  483. folder.Owner = user;
  484. folder.ID = UUID.Random();
  485. folder.Name = "Clothing";
  486. folder.Type = (short)AssetType.Clothing;
  487. folder.Version = 1;
  488. Folders.Add(folder.ID, folder);
  489. folder = new InventoryFolderBase();
  490. folder.ParentID = rootFolder;
  491. folder.Owner = user;
  492. folder.ID = UUID.Random();
  493. folder.Name = "Gestures";
  494. folder.Type = (short)AssetType.Gesture;
  495. folder.Version = 1;
  496. Folders.Add(folder.ID, folder);
  497. folder = new InventoryFolderBase();
  498. folder.ParentID = rootFolder;
  499. folder.Owner = user;
  500. folder.ID = UUID.Random();
  501. folder.Name = "Landmarks";
  502. folder.Type = (short)AssetType.Landmark;
  503. folder.Version = 1;
  504. Folders.Add(folder.ID, folder);
  505. folder = new InventoryFolderBase();
  506. folder.ParentID = rootFolder;
  507. folder.Owner = user;
  508. folder.ID = UUID.Random();
  509. folder.Name = "Lost And Found";
  510. folder.Type = (short)AssetType.LostAndFoundFolder;
  511. folder.Version = 1;
  512. Folders.Add(folder.ID, folder);
  513. folder = new InventoryFolderBase();
  514. folder.ParentID = rootFolder;
  515. folder.Owner = user;
  516. folder.ID = UUID.Random();
  517. folder.Name = "Notecards";
  518. folder.Type = (short)AssetType.Notecard;
  519. folder.Version = 1;
  520. Folders.Add(folder.ID, folder);
  521. folder = new InventoryFolderBase();
  522. folder.ParentID = rootFolder;
  523. folder.Owner = user;
  524. folder.ID = UUID.Random();
  525. folder.Name = "Objects";
  526. folder.Type = (short)AssetType.Object;
  527. folder.Version = 1;
  528. Folders.Add(folder.ID, folder);
  529. folder = new InventoryFolderBase();
  530. folder.ParentID = rootFolder;
  531. folder.Owner = user;
  532. folder.ID = UUID.Random();
  533. folder.Name = "Photo Album";
  534. folder.Type = (short)AssetType.SnapshotFolder;
  535. folder.Version = 1;
  536. Folders.Add(folder.ID, folder);
  537. folder = new InventoryFolderBase();
  538. folder.ParentID = rootFolder;
  539. folder.Owner = user;
  540. folder.ID = UUID.Random();
  541. folder.Name = "Scripts";
  542. folder.Type = (short)AssetType.LSLText;
  543. folder.Version = 1;
  544. Folders.Add(folder.ID, folder);
  545. folder = new InventoryFolderBase();
  546. folder.ParentID = rootFolder;
  547. folder.Owner = user;
  548. folder.ID = UUID.Random();
  549. folder.Name = "Sounds";
  550. folder.Type = (short)AssetType.Sound;
  551. folder.Version = 1;
  552. Folders.Add(folder.ID, folder);
  553. folder = new InventoryFolderBase();
  554. folder.ParentID = rootFolder;
  555. folder.Owner = user;
  556. folder.ID = UUID.Random();
  557. folder.Name = "Textures";
  558. folder.Type = (short)AssetType.Texture;
  559. folder.Version = 1;
  560. Folders.Add(folder.ID, folder);
  561. folder = new InventoryFolderBase();
  562. folder.ParentID = rootFolder;
  563. folder.Owner = user;
  564. folder.ID = UUID.Random();
  565. folder.Name = "Trash";
  566. folder.Type = (short)AssetType.TrashFolder;
  567. folder.Version = 1;
  568. Folders.Add(folder.ID, folder);
  569. }
  570. }
  571. }
  572. }