InventoryService.cs 24 KB

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