C# Class OpenMetaverse.InventoryManager

Tools for dealing with agents inventory
Mostrar archivo Open project: 3di/3di-viewer-rei-libs Class Usage Examples

Public Methods

Method Description
AssetTypeToString ( AssetType type ) : string

Takes an AssetType and returns the string representation

CreateFolder ( UUID parentID, string name ) : UUID

Creates a new inventory folder

CreateFolder ( UUID parentID, string name, AssetType preferredType ) : UUID

Creates a new inventory folder

If you specify a preferred type of AsseType.Folder it will create a new root folder which may likely cause all sorts of strange problems

CreateInventoryItem ( InventoryType type, UUID id ) : InventoryItem

Wrapper for creating a new InventoryItem object

EmptyLostAndFound ( ) : void

Empty the Lost and Found folder

EmptyTrash ( ) : void

Empty the Trash folder

FetchItem ( UUID itemID, UUID ownerID, int timeoutMS ) : InventoryItem

Fetch an inventory item from the dataserver

Items will also be sent to the InventoryManager.OnItemReceived event

FindFolderForType ( AssetType type ) : UUID

Returns the UUID of the folder (category) that defaults to containing 'type'. The folder is not necessarily only for that type

This will return the root folder if one does not exist

FindObjectByPath ( UUID baseFolder, UUID inventoryOwner, string path, int timeoutMS ) : UUID

Find an object in inventory using a specific path to search

FolderContents ( UUID folder, UUID owner, bool folders, bool items, InventorySortOrder order, int timeoutMS ) : List

Get contents of a folder

InventoryFolder.DescendentCount will only be accurate if both folders and items are requested

GetTaskInventory ( UUID objectID, uint objectLocalID, int timeoutMS ) : List

Get the inventory of a Task (Primitive)

GiveFolder ( UUID folderID, string folderName, AssetType assetType, UUID recipient, bool doEffect ) : void

Give an inventory Folder with contents to another avatar

GiveItem ( UUID itemID, string itemName, AssetType assetType, UUID recipient, bool doEffect ) : void

Give an inventory item to another avatar

InventoryManager ( GridClient client ) : System

Default constructor

InventoryTypeToString ( InventoryType type ) : string

Convert an InventoryType to a string

ItemCRC ( InventoryItem iitem ) : uint

Create a CRC from an InventoryItem

LocalFind ( UUID baseFolder, string path, int level, bool firstOnly ) : List

Search inventory Store object for an item or folder

Move ( InventoryBase item, InventoryFolder newParent ) : void

Move an inventory item or folder to a new location

Move ( InventoryBase item, InventoryFolder newParent, string newName ) : void

Move an inventory item or folder to a new location and change its name

MoveFolder ( UUID folderID, UUID newParentID ) : void

Move a folder

MoveFolder ( UUID folderID, UUID newparentID, string newName ) : void

Move and rename a folder

MoveFolders ( UUID>.Dictionary foldersNewParents ) : void

Move multiple folders, the keys in the Dictionary parameter, to a new parents, the value of that folder's key.

MoveItem ( UUID itemID, UUID folderID ) : void

Move an inventory item to a new folder

MoveItem ( UUID itemID, UUID folderID, string newName ) : void

Move and rename an inventory item

MoveItems ( UUID>.Dictionary itemsNewParents ) : void

Move multiple inventory items to new locations

MoveTaskInventory ( uint objectLocalID, UUID taskItemID, UUID inventoryFolderID, Simulator simulator ) : void

Moves an Item from an objects (Prim) Inventory to the specified folder in the avatars inventory

ParseTaskInventory ( string taskData ) : List

Parse the results of a RequestTaskInventory() response

Remove ( List items, List folders ) : void

Remove multiple items or folders from inventory

RemoveDescendants ( UUID folder ) : void

Remove descendants of a folder

RemoveFolder ( UUID folder ) : void

Remove a folder from inventory

RemoveItem ( UUID item ) : void

Remove a single item from inventory

RemoveTaskInventory ( uint objectLocalID, UUID taskItemID, Simulator simulator ) : void

Remove an item from an objects (Prim) Inventory

RequestCopyItem ( UUID item, UUID newParent, string newName, ItemCopiedCallback callback ) : void

RequestCopyItem ( UUID item, UUID newParent, string newName, UUID oldOwnerID, ItemCopiedCallback callback ) : void

RequestCopyItemFromNotecard ( UUID objectID, UUID notecardID, UUID folderID, UUID itemID, ItemCopiedCallback callback ) : void

Request a copy of an asset embedded within a notecard

RequestCopyItems ( List items, List targetFolders, List newNames, UUID oldOwnerID, ItemCopiedCallback callback ) : void

RequestCreateItem ( UUID parentFolder, string name, string description, AssetType type, UUID assetTransactionID, InventoryType invType, PermissionMask nextOwnerMask, ItemCreatedCallback callback ) : void

RequestCreateItem ( UUID parentFolder, string name, string description, AssetType type, UUID assetTransactionID, InventoryType invType, WearableType wearableType, PermissionMask nextOwnerMask, ItemCreatedCallback callback ) : void

RequestCreateItemFromAsset ( byte data, string name, string description, AssetType assetType, InventoryType invType, UUID folderID, OpenMetaverse.Capabilities.CapsClient progCallback, ItemCreatedFromAssetCallback callback ) : void
RequestDeRezToInventory ( uint objectLocalID ) : void

DeRez an object from the simulator to the agents Objects folder in the agents Inventory

RequestDeRezToInventory ( uint objectLocalID, DeRezDestination destType, UUID destFolder, UUID transactionID ) : void

DeRez an object from the simulator and return to inventory

RequestFetchInventory ( List itemIDs, List ownerIDs ) : void

Request inventory items

RequestFetchInventory ( UUID itemID, UUID ownerID ) : void

Request A single inventory item

RequestFindObjectByPath ( UUID baseFolder, UUID inventoryOwner, string path ) : void

Find inventory items by path

Results are sent to the InventoryManager.OnFindObjectByPath event

RequestFolderContents ( UUID folder, UUID owner, bool folders, bool items, InventorySortOrder order ) : void

Request the contents of an inventory folder

RequestRezFromInventory ( Simulator simulator, Quaternion rotation, System.Vector3 position, InventoryItem item ) : UUID

Rez an object from inventory

RequestRezFromInventory ( Simulator simulator, Quaternion rotation, System.Vector3 position, InventoryItem item, UUID groupOwner ) : UUID

Rez an object from inventory

RequestRezFromInventory ( Simulator simulator, Quaternion rotation, System.Vector3 position, InventoryItem item, UUID groupOwner, UUID queryID, bool requestObjectDetails ) : UUID

Rez an object from inventory

RequestTaskInventory ( uint objectLocalID ) : void

RequestTaskInventory ( uint objectLocalID, Simulator simulator ) : void

Request the contents of a tasks (primitives) inventory

RequestUpdateItem ( InventoryItem item ) : void

RequestUpdateItems ( List items ) : void

RequestUpdateItems ( List items, UUID transactionID ) : void

RequestUploadNotecardAsset ( byte data, UUID notecardID, NotecardUploadedAssetCallback callback ) : void

SaleTypeToString ( SaleType type ) : string
StringToAssetType ( string type ) : AssetType

Translate a string name of an AssetType into the proper Type

StringToInventoryType ( string type ) : InventoryType

Convert a string into a valid InventoryType

StringToSaleType ( string value ) : SaleType
UpdateTaskInventory ( uint objectLocalID, InventoryItem item ) : UUID

Private Methods

Method Description
BulkUpdateInventoryHandler ( Packet packet, Simulator simulator ) : void
CreateItemFromAssetResponse ( OpenMetaverse.Capabilities.CapsClient client, OSD result, Exception error ) : void
EmptySystemFolder ( AssetType folderType ) : void
FetchInventoryReplyHandler ( Packet packet, Simulator simulator ) : void
InventoryDescendentsHandler ( Packet packet, Simulator simulator ) : void
MoveInventoryItemHandler ( Packet packet, Simulator simulator ) : void
Network_OnLoginResponse ( bool loginSuccess, bool redirect, string message, string reason, LoginResponseData replyData ) : void
ParseLine ( string line, string &key, string &value ) : bool
RegisterItemCreatedCallback ( ItemCreatedCallback callback ) : uint
RegisterItemsCopiedCallback ( ItemCopiedCallback callback ) : uint
ReplyTaskInventoryHandler ( Packet packet, Simulator simulator ) : void
SafeCreateInventoryItem ( InventoryType InvType, UUID ItemID ) : InventoryItem
SaveAssetIntoInventoryHandler ( Packet packet, Simulator simulator ) : void
Self_OnInstantMessage ( InstantMessage im, Simulator simulator ) : void
UpdateCreateInventoryItemHandler ( Packet packet, Simulator simulator ) : void

UpdateCreateInventoryItem packets are received when a new inventory item is created. This may occur when an object that's rezzed in world is taken into inventory, when an item is created using the CreateInventoryItem packet, or when an object is purchased

UploadNotecardAssetResponse ( CapsClient client, OSD result, Exception error ) : void

Method Details

AssetTypeToString() public static method

Takes an AssetType and returns the string representation
public static AssetTypeToString ( AssetType type ) : string
type AssetType The source
return string

CreateFolder() public method

Creates a new inventory folder
public CreateFolder ( UUID parentID, string name ) : UUID
parentID UUID ID of the folder to put this folder in
name string Name of the folder to create
return UUID

CreateFolder() public method

Creates a new inventory folder
If you specify a preferred type of AsseType.Folder it will create a new root folder which may likely cause all sorts of strange problems
public CreateFolder ( UUID parentID, string name, AssetType preferredType ) : UUID
parentID UUID ID of the folder to put this folder in
name string Name of the folder to create
preferredType AssetType Sets this folder as the default folder /// for new assets of the specified type. Use AssetType.Unknown /// to create a normal folder, otherwise it will likely create a /// duplicate of an existing folder type
return UUID

CreateInventoryItem() public static method

Wrapper for creating a new InventoryItem object
public static CreateInventoryItem ( InventoryType type, UUID id ) : InventoryItem
type InventoryType The type of item from the enum
id UUID The of the newly created object
return InventoryItem

EmptyLostAndFound() public method

Empty the Lost and Found folder
public EmptyLostAndFound ( ) : void
return void

EmptyTrash() public method

Empty the Trash folder
public EmptyTrash ( ) : void
return void

FetchItem() public method

Fetch an inventory item from the dataserver
Items will also be sent to the InventoryManager.OnItemReceived event
public FetchItem ( UUID itemID, UUID ownerID, int timeoutMS ) : InventoryItem
itemID UUID The items
ownerID UUID The item Owners
timeoutMS int a integer representing the number of milliseconds to wait for results
return InventoryItem

FindFolderForType() public method

Returns the UUID of the folder (category) that defaults to containing 'type'. The folder is not necessarily only for that type
This will return the root folder if one does not exist
public FindFolderForType ( AssetType type ) : UUID
type AssetType
return UUID

FindObjectByPath() public method

Find an object in inventory using a specific path to search
public FindObjectByPath ( UUID baseFolder, UUID inventoryOwner, string path, int timeoutMS ) : UUID
baseFolder UUID The folder to begin the search in
inventoryOwner UUID The object owners
path string A string path to search
timeoutMS int milliseconds to wait for a reply
return UUID

FolderContents() public method

Get contents of a folder
InventoryFolder.DescendentCount will only be accurate if both folders and items are requested
public FolderContents ( UUID folder, UUID owner, bool folders, bool items, InventorySortOrder order, int timeoutMS ) : List
folder UUID The of the folder to search
owner UUID The of the folders owner
folders bool true to retrieve folders
items bool true to retrieve items
order InventorySortOrder sort order to return results in
timeoutMS int a integer representing the number of milliseconds to wait for results
return List

GetTaskInventory() public method

Get the inventory of a Task (Primitive)
public GetTaskInventory ( UUID objectID, uint objectLocalID, int timeoutMS ) : List
objectID UUID The tasks
objectLocalID uint The tasks simulator local ID
timeoutMS int milliseconds to wait for reply from simulator
return List

GiveFolder() public method

Give an inventory Folder with contents to another avatar
public GiveFolder ( UUID folderID, string folderName, AssetType assetType, UUID recipient, bool doEffect ) : void
folderID UUID The of the Folder to give
folderName string The name of the folder
assetType AssetType The type of the item from the enum
recipient UUID The of the recipient
doEffect bool true to generate a beameffect during transfer
return void

GiveItem() public method

Give an inventory item to another avatar
public GiveItem ( UUID itemID, string itemName, AssetType assetType, UUID recipient, bool doEffect ) : void
itemID UUID The of the item to give
itemName string The name of the item
assetType AssetType The type of the item from the enum
recipient UUID The of the recipient
doEffect bool true to generate a beameffect during transfer
return void

InventoryManager() public method

Default constructor
public InventoryManager ( GridClient client ) : System
client GridClient Reference to the GridClient object
return System

InventoryTypeToString() public static method

Convert an InventoryType to a string
public static InventoryTypeToString ( InventoryType type ) : string
type InventoryType The to convert
return string

ItemCRC() public static method

Create a CRC from an InventoryItem
public static ItemCRC ( InventoryItem iitem ) : uint
iitem InventoryItem The source InventoryItem
return uint

LocalFind() public method

Search inventory Store object for an item or folder
public LocalFind ( UUID baseFolder, string path, int level, bool firstOnly ) : List
baseFolder UUID The folder to begin the search in
path string An array which creates a path to search
level int Number of levels below baseFolder to conduct searches
firstOnly bool if True, will stop searching after first match is found
return List

Move() public method

Move an inventory item or folder to a new location
public Move ( InventoryBase item, InventoryFolder newParent ) : void
item InventoryBase The item or folder to move
newParent InventoryFolder The to move item or folder to
return void

Move() public method

Move an inventory item or folder to a new location and change its name
public Move ( InventoryBase item, InventoryFolder newParent, string newName ) : void
item InventoryBase The item or folder to move
newParent InventoryFolder The to move item or folder to
newName string The name to change the item or folder to
return void

MoveFolder() public method

Move a folder
public MoveFolder ( UUID folderID, UUID newParentID ) : void
folderID UUID The source folders
newParentID UUID The destination folders
return void

MoveFolder() public method

Move and rename a folder
public MoveFolder ( UUID folderID, UUID newparentID, string newName ) : void
folderID UUID The source folders
newparentID UUID The destination folders
newName string The name to change the folder to
return void

MoveFolders() public method

Move multiple folders, the keys in the Dictionary parameter, to a new parents, the value of that folder's key.
public MoveFolders ( UUID>.Dictionary foldersNewParents ) : void
foldersNewParents UUID>.Dictionary A Dictionary containing the /// of the source as the key, and the /// of the destination as the value
return void

MoveItem() public method

Move an inventory item to a new folder
public MoveItem ( UUID itemID, UUID folderID ) : void
itemID UUID The of the source item to move
folderID UUID The of the destination folder
return void

MoveItem() public method

Move and rename an inventory item
public MoveItem ( UUID itemID, UUID folderID, string newName ) : void
itemID UUID The of the source item to move
folderID UUID The of the destination folder
newName string The name to change the folder to
return void

MoveItems() public method

Move multiple inventory items to new locations
public MoveItems ( UUID>.Dictionary itemsNewParents ) : void
itemsNewParents UUID>.Dictionary A Dictionary containing the /// of the source item as the key, and the /// of the destination folder as the value
return void

MoveTaskInventory() public method

Moves an Item from an objects (Prim) Inventory to the specified folder in the avatars inventory
public MoveTaskInventory ( uint objectLocalID, UUID taskItemID, UUID inventoryFolderID, Simulator simulator ) : void
objectLocalID uint LocalID of the object in the simulator
taskItemID UUID UUID of the task item to move
inventoryFolderID UUID UUID of the folder to move the item to
simulator Simulator Simulator Object
return void

ParseTaskInventory() public static method

Parse the results of a RequestTaskInventory() response
public static ParseTaskInventory ( string taskData ) : List
taskData string A string which contains the data from the task reply
return List

Remove() public method

Remove multiple items or folders from inventory
public Remove ( List items, List folders ) : void
items List A List containing the s of items to remove
folders List A List containing the s of the folders to remove
return void

RemoveDescendants() public method

Remove descendants of a folder
public RemoveDescendants ( UUID folder ) : void
folder UUID The of the folder
return void

RemoveFolder() public method

Remove a folder from inventory
public RemoveFolder ( UUID folder ) : void
folder UUID The of the folder to remove
return void

RemoveItem() public method

Remove a single item from inventory
public RemoveItem ( UUID item ) : void
item UUID The of the inventory item to remove
return void

RemoveTaskInventory() public method

Remove an item from an objects (Prim) Inventory
public RemoveTaskInventory ( uint objectLocalID, UUID taskItemID, Simulator simulator ) : void
objectLocalID uint LocalID of the object in the simulator
taskItemID UUID UUID of the task item to remove
simulator Simulator Simulator Object
return void

RequestCopyItem() public method

public RequestCopyItem ( UUID item, UUID newParent, string newName, ItemCopiedCallback callback ) : void
item UUID
newParent UUID
newName string
callback ItemCopiedCallback
return void

RequestCopyItem() public method

public RequestCopyItem ( UUID item, UUID newParent, string newName, UUID oldOwnerID, ItemCopiedCallback callback ) : void
item UUID
newParent UUID
newName string
oldOwnerID UUID
callback ItemCopiedCallback
return void

RequestCopyItemFromNotecard() public method

Request a copy of an asset embedded within a notecard
public RequestCopyItemFromNotecard ( UUID objectID, UUID notecardID, UUID folderID, UUID itemID, ItemCopiedCallback callback ) : void
objectID UUID Usually UUID.Zero for copying an asset from a notecard
notecardID UUID UUID of the notecard to request an asset from
folderID UUID Target folder for asset to go to in your inventory
itemID UUID UUID of the embedded asset
callback ItemCopiedCallback callback to run when item is copied to inventory
return void

RequestCopyItems() public method

public RequestCopyItems ( List items, List targetFolders, List newNames, UUID oldOwnerID, ItemCopiedCallback callback ) : void
items List
targetFolders List
newNames List
oldOwnerID UUID
callback ItemCopiedCallback
return void

RequestCreateItem() public method

public RequestCreateItem ( UUID parentFolder, string name, string description, AssetType type, UUID assetTransactionID, InventoryType invType, PermissionMask nextOwnerMask, ItemCreatedCallback callback ) : void
parentFolder UUID
name string
description string
type AssetType
assetTransactionID UUID Proper use is to upload the inventory's asset first, then provide the Asset's TransactionID here.
invType InventoryType
nextOwnerMask PermissionMask
callback ItemCreatedCallback
return void

RequestCreateItem() public method

public RequestCreateItem ( UUID parentFolder, string name, string description, AssetType type, UUID assetTransactionID, InventoryType invType, WearableType wearableType, PermissionMask nextOwnerMask, ItemCreatedCallback callback ) : void
parentFolder UUID
name string
description string
type AssetType
assetTransactionID UUID Proper use is to upload the inventory's asset first, then provide the Asset's TransactionID here.
invType InventoryType
wearableType WearableType
nextOwnerMask PermissionMask
callback ItemCreatedCallback
return void

RequestCreateItemFromAsset() public method

public RequestCreateItemFromAsset ( byte data, string name, string description, AssetType assetType, InventoryType invType, UUID folderID, OpenMetaverse.Capabilities.CapsClient progCallback, ItemCreatedFromAssetCallback callback ) : void
data byte
name string
description string
assetType AssetType
invType InventoryType
folderID UUID
progCallback OpenMetaverse.Capabilities.CapsClient
callback ItemCreatedFromAssetCallback
return void

RequestDeRezToInventory() public method

DeRez an object from the simulator to the agents Objects folder in the agents Inventory
public RequestDeRezToInventory ( uint objectLocalID ) : void
objectLocalID uint The simulator Local ID of the object
return void

RequestDeRezToInventory() public method

DeRez an object from the simulator and return to inventory
public RequestDeRezToInventory ( uint objectLocalID, DeRezDestination destType, UUID destFolder, UUID transactionID ) : void
objectLocalID uint The simulator Local ID of the object
destType DeRezDestination The type of destination from the enum
destFolder UUID The destination inventory folders -or- /// if DeRezzing object to a tasks Inventory, the Tasks
transactionID UUID The transaction ID for this request which /// can be used to correlate this request with other packets
return void

RequestFetchInventory() public method

Request inventory items
public RequestFetchInventory ( List itemIDs, List ownerIDs ) : void
itemIDs List Inventory items to request
ownerIDs List Owners of the inventory items
return void

RequestFetchInventory() public method

Request A single inventory item
public RequestFetchInventory ( UUID itemID, UUID ownerID ) : void
itemID UUID The items
ownerID UUID The item Owners
return void

RequestFindObjectByPath() public method

Find inventory items by path
Results are sent to the InventoryManager.OnFindObjectByPath event
public RequestFindObjectByPath ( UUID baseFolder, UUID inventoryOwner, string path ) : void
baseFolder UUID The folder to begin the search in
inventoryOwner UUID The object owners
path string A string path to search, folders/objects separated by a '/'
return void

RequestFolderContents() public method

Request the contents of an inventory folder
public RequestFolderContents ( UUID folder, UUID owner, bool folders, bool items, InventorySortOrder order ) : void
folder UUID The folder to search
owner UUID The folder owners
folders bool true to return s contained in folder
items bool true to return s containd in folder
order InventorySortOrder the sort order to return items in
return void

RequestRezFromInventory() public method

Rez an object from inventory
public RequestRezFromInventory ( Simulator simulator, Quaternion rotation, System.Vector3 position, InventoryItem item ) : UUID
simulator Simulator Simulator to place object in
rotation Quaternion Rotation of the object when rezzed
position System.Vector3 Vector of where to place object
item InventoryItem InventoryItem object containing item details
return UUID

RequestRezFromInventory() public method

Rez an object from inventory
public RequestRezFromInventory ( Simulator simulator, Quaternion rotation, System.Vector3 position, InventoryItem item, UUID groupOwner ) : UUID
simulator Simulator Simulator to place object in
rotation Quaternion Rotation of the object when rezzed
position System.Vector3 Vector of where to place object
item InventoryItem InventoryItem object containing item details
groupOwner UUID UUID of group to own the object
return UUID

RequestRezFromInventory() public method

Rez an object from inventory
public RequestRezFromInventory ( Simulator simulator, Quaternion rotation, System.Vector3 position, InventoryItem item, UUID groupOwner, UUID queryID, bool requestObjectDetails ) : UUID
simulator Simulator Simulator to place object in
rotation Quaternion Rotation of the object when rezzed
position System.Vector3 Vector of where to place object
item InventoryItem InventoryItem object containing item details
groupOwner UUID UUID of group to own the object
queryID UUID User defined queryID to correlate replies
requestObjectDetails bool if set to true the simulator /// will automatically send object detail packet(s) back to the client
return UUID

RequestTaskInventory() public method

public RequestTaskInventory ( uint objectLocalID ) : void
objectLocalID uint
return void

RequestTaskInventory() public method

Request the contents of a tasks (primitives) inventory
public RequestTaskInventory ( uint objectLocalID, Simulator simulator ) : void
objectLocalID uint The simulator Local ID of the object
simulator Simulator A reference to the simulator object that contains the object
return void

RequestUpdateItem() public method

public RequestUpdateItem ( InventoryItem item ) : void
item InventoryItem
return void

RequestUpdateItems() public method

public RequestUpdateItems ( List items ) : void
items List
return void

RequestUpdateItems() public method

public RequestUpdateItems ( List items, UUID transactionID ) : void
items List
transactionID UUID
return void

RequestUploadNotecardAsset() public method

public RequestUploadNotecardAsset ( byte data, UUID notecardID, NotecardUploadedAssetCallback callback ) : void
data byte
notecardID UUID
callback NotecardUploadedAssetCallback
return void

SaleTypeToString() public static method

public static SaleTypeToString ( SaleType type ) : string
type SaleType
return string

StringToAssetType() public static method

Translate a string name of an AssetType into the proper Type
public static StringToAssetType ( string type ) : AssetType
type string A string containing the AssetType name
return AssetType

StringToInventoryType() public static method

Convert a string into a valid InventoryType
public static StringToInventoryType ( string type ) : InventoryType
type string A string representation of the InventoryType to convert
return InventoryType

StringToSaleType() public static method

public static StringToSaleType ( string value ) : SaleType
value string
return SaleType

UpdateTaskInventory() public method

public UpdateTaskInventory ( uint objectLocalID, InventoryItem item ) : UUID
objectLocalID uint
item InventoryItem
return UUID