InventoryObjects.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 OpenMetaverse;
  30. using OpenSim.Framework;
  31. namespace OpenSim.Grid.AssetInventoryServer
  32. {
  33. //public class InventoryBase
  34. //{
  35. //}
  36. //public class InventoryFolder : InventoryBase
  37. //{
  38. // public string Name;
  39. // public UUID Owner;
  40. // public UUID ParentID;
  41. // public UUID ID;
  42. // public short Type;
  43. // public ushort Version;
  44. // [NonSerialized]
  45. // public Dictionary<UUID, InventoryBase> Children = new Dictionary<UUID, InventoryBase>();
  46. // public InventoryFolder()
  47. // {
  48. // }
  49. // public InventoryFolder(string name, UUID ownerID, UUID parentID, short assetType)
  50. // {
  51. // ID = UUID.Random();
  52. // Name = name;
  53. // Owner = ownerID;
  54. // ParentID = parentID;
  55. // Type = assetType;
  56. // Version = 1;
  57. // }
  58. // public override string ToString()
  59. // {
  60. // return String.Format("{0} ({1})", Name, ID);
  61. // }
  62. //}
  63. //public class InventoryItem : InventoryBase
  64. //{
  65. // public UUID ID;
  66. // public int InvType;
  67. // public UUID Folder;
  68. // public UUID Owner;
  69. // public UUID Creator;
  70. // public string Name;
  71. // public string Description;
  72. // public uint NextPermissions;
  73. // public uint CurrentPermissions;
  74. // public uint BasePermissions;
  75. // public uint EveryOnePermissions;
  76. // public uint GroupPermissions;
  77. // public int AssetType;
  78. // public UUID AssetID;
  79. // public UUID GroupID;
  80. // public bool GroupOwned;
  81. // public int SalePrice;
  82. // public byte SaleType;
  83. // public uint Flags;
  84. // public int CreationDate;
  85. // public override string ToString()
  86. // {
  87. // return String.Format("{0} ({1})", Name, ID);
  88. // }
  89. //}
  90. public class InventoryFolderWithChildren : InventoryFolderBase
  91. {
  92. public InventoryFolderWithChildren()
  93. {
  94. }
  95. public InventoryFolderWithChildren(InventoryFolderBase folder)
  96. {
  97. // from InventoryNodeBase
  98. Name = folder.Name;
  99. ID = folder.ID;
  100. Owner = folder.Owner;
  101. // from InventoryFolderBase
  102. ParentID = folder.ParentID;
  103. Type = folder.Type;
  104. Version = folder.Version;
  105. }
  106. public InventoryFolderWithChildren(string name, UUID ownerID, UUID parentID, short assetType)
  107. {
  108. ID = UUID.Random();
  109. Name = name;
  110. Owner = ownerID;
  111. ParentID = parentID;
  112. Type = assetType;
  113. Version = 1;
  114. }
  115. [NonSerialized]
  116. public Dictionary<UUID, InventoryNodeBase> Children = new Dictionary<UUID, InventoryNodeBase>();
  117. }
  118. public class InventoryCollection
  119. {
  120. public Dictionary<UUID, InventoryFolderWithChildren> Folders;
  121. public Dictionary<UUID, InventoryItemBase> Items;
  122. public UUID UserID;
  123. }
  124. }