InventoryService.cs 25 KB

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