using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Globalization; using OpenMetaverse; namespace Simian { [Flags] public enum InventorySortOrder : uint { // ItemsByName = 0, /// ByDate = 1, /// FoldersByName = 2, /// SystemFoldersToTop = 4 } #region Inventory Item Containers /// /// Base class that inventory items and folders inherit from /// public abstract class InventoryObject { /// of the inventory item public UUID ID; /// of the parent folder public UUID ParentID; /// Item name public string Name = String.Empty; /// Item owner public UUID OwnerID; /// Parent folder public InventoryObject Parent; public override int GetHashCode() { return ID.GetHashCode(); } } /// /// Inventory item /// public class InventoryItem : InventoryObject { /// of the asset this item points to public UUID AssetID; /// The type of item from public AssetType AssetType; /// The type of item from the enum public InventoryType InventoryType; /// The of the creator of this item public UUID CreatorID; /// The s this item is set to or owned by public UUID GroupID; /// A Description of this item public string Description = String.Empty; /// If true, item is owned by a group public bool GroupOwned; /// The combined of this item public Permissions Permissions; /// The price this item can be purchased for public int SalePrice; /// The type of sale from the enum public SaleType SaleType; /// Combined flags from public uint Flags; /// Time and date this inventory item was created, stored as /// UTC (Coordinated Universal Time) public DateTime CreationDate; /// Cyclic redundancy check for this inventory item, calculated by adding most of /// the fields together public uint CRC { get { return Helpers.InventoryCRC((int)Utils.DateTimeToUnixTime(CreationDate), (byte)SaleType, (sbyte)InventoryType, (sbyte)AssetType, AssetID, GroupID, SalePrice, OwnerID, CreatorID, ID, ParentID, (uint)Permissions.EveryoneMask, Flags, (uint)Permissions.NextOwnerMask, (uint)Permissions.GroupMask, (uint)Permissions.OwnerMask); } } public override int GetHashCode() { return ID.GetHashCode(); } public override bool Equals(object obj) { if (!(obj is InventoryItem)) return false; InventoryItem o = (InventoryItem)obj; return o.ID == ID; } public static bool operator ==(InventoryItem lhs, InventoryItem rhs) { return lhs.Equals(rhs); } public static bool operator !=(InventoryItem lhs, InventoryItem rhs) { return !(lhs == rhs); } } /// /// Inventory folder /// public class InventoryFolder : InventoryObject { /// The Preferred for a folder. public AssetType PreferredType; /// The Version of this folder public int Version; /// Number of child items this folder contains public InternalDictionary Children = new InternalDictionary(); public override int GetHashCode() { return ID.GetHashCode(); } public override bool Equals(object obj) { if (!(obj is InventoryFolder)) return false; InventoryFolder o = (InventoryFolder)obj; return o.ID == ID; } public static bool operator ==(InventoryFolder lhs, InventoryFolder rhs) { return lhs.Equals(rhs); } public static bool operator !=(InventoryFolder lhs, InventoryFolder rhs) { return !(lhs == rhs); } } #endregion Inventory Item Containers }