C# Class OpenMetaverse.AssetManager

Inheritance: IDisposable
Show file Open project: N3X15/VoxelSim Class Usage Examples

Public Properties

Property Type Description
Cache AssetCache

Public Methods

Method Description
AssetManager ( GridClient client ) : System

Default constructor

RequestAsset ( UUID assetID, AssetType type, bool priority, AssetReceivedCallback callback ) : void

Request an asset download

RequestAsset ( UUID assetID, AssetType type, bool priority, SourceType sourceType, AssetReceivedCallback callback ) : void

Request an asset download

RequestAsset ( UUID assetID, AssetType type, bool priority, SourceType sourceType, UUID transactionID, AssetReceivedCallback callback ) : void

Request an asset download

RequestAssetXfer ( string filename, bool deleteOnCompletion, bool useBigPackets, UUID vFileID, AssetType vFileType, bool fromCache ) : ulong

Request an asset download through the almost deprecated Xfer system

RequestEstateAsset ( ) : void
RequestImage ( UUID textureID, ImageType imageType, TextureDownloadCallback callback ) : void

Overload: Request a texture asset from the simulator using the TexturePipeline system to manage the requests and re-assemble the image from the packets received from the simulator

RequestImage ( UUID textureID, ImageType imageType, TextureDownloadCallback callback, bool progress ) : void

Overload: Request a texture asset from the simulator using the TexturePipeline system to manage the requests and re-assemble the image from the packets received from the simulator

RequestImage ( UUID textureID, ImageType imageType, float priority, int discardLevel, uint packetStart, TextureDownloadCallback callback, bool progress ) : void

Request a texture asset from the simulator using the TexturePipeline system to manage the requests and re-assemble the image from the packets received from the simulator

A bug exists in the Linden Simulator where a -1 will occasionally be sent with a non-zero priority indicating an off-by-one error.

RequestImage ( UUID textureID, TextureDownloadCallback callback ) : void

Overload: Request a texture asset from the simulator using the TexturePipeline system to manage the requests and re-assemble the image from the packets received from the simulator

RequestImageCancel ( UUID textureID ) : void

Cancel a texture request

RequestInventoryAsset ( InventoryItem item, bool priority, AssetReceivedCallback callback ) : void
RequestInventoryAsset ( UUID assetID, UUID itemID, UUID taskID, UUID ownerID, AssetType type, bool priority, AssetReceivedCallback callback ) : void

RequestMesh ( UUID meshID, MeshDownloadCallback callback ) : void

Requests download of a mesh asset

RequestUpload ( Asset asset, bool storeLocal ) : UUID

Request an asset be uploaded to the simulator

RequestUpload ( AssetType type, byte data, bool storeLocal ) : UUID

Request an asset be uploaded to the simulator

RequestUpload ( UUID &assetID, AssetType type, byte data, bool storeLocal ) : UUID

Request an asset be uploaded to the simulator

RequestUpload ( UUID &assetID, AssetType type, byte data, bool storeLocal, UUID transactionID ) : UUID

Initiate an asset upload

RequestUploadBakedTexture ( byte textureData, BakedTextureUploadedCallback callback ) : void

Protected Methods

Method Description
AbortXferHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void

Process an incoming packet and raise the appropriate events

AssetUploadCompleteHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void

Process an incoming packet and raise the appropriate events

ConfirmXferPacketHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void

Process an incoming packet and raise the appropriate events

InitiateDownloadPacketHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void

Process an incoming packet and raise the appropriate events

OnAssetUploaded ( AssetUploadEventArgs e ) : void

Raises the AssetUploaded event

OnImageReceiveProgress ( ImageReceiveProgressEventArgs e ) : void

Raises the ImageReceiveProgress event

OnInitiateDownload ( InitiateDownloadEventArgs e ) : void

Raises the InitiateDownload event

OnUploadProgress ( AssetUploadEventArgs e ) : void

Raises the UploadProgress event

OnXferReceived ( XferReceivedEventArgs e ) : void

Raises the XferReceived event

RequestXferHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void

Process an incoming packet and raise the appropriate events

SendXferPacketHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void

Process an incoming packet and raise the appropriate events

TransferInfoHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void

Process an incoming packet and raise the appropriate events

TransferPacketHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void

Process an incoming packet and raise the appropriate events

Private Methods

Method Description
CreateAssetWrapper ( AssetType type ) : Asset
FireImageProgressEvent ( UUID texureID, int transferredBytes, int totalBytes ) : void

Lets TexturePipeline class fire the progress event

HttpRequestTexture ( UUID textureID, ImageType imageType, float priority, int discardLevel, uint packetStart, TextureDownloadCallback callback, bool progress ) : void
SendConfirmXferPacket ( ulong xferID, uint packetNum ) : void
SendNextUploadPacket ( AssetUpload upload ) : void
SetPendingAssetUploadData ( AssetUpload assetData ) : void

Used to force asset data into the PendingUpload property, ie: for raw terrain uploads

WrapAsset ( AssetDownload download ) : Asset

Method Details

AbortXferHandler() protected method

Process an incoming packet and raise the appropriate events
protected AbortXferHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object The sender
e OpenMetaverse.PacketReceivedEventArgs The EventArgs object containing the packet data
return void

AssetManager() public method

Default constructor
public AssetManager ( GridClient client ) : System
client GridClient A reference to the GridClient object
return System

AssetUploadCompleteHandler() protected method

Process an incoming packet and raise the appropriate events
protected AssetUploadCompleteHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object The sender
e OpenMetaverse.PacketReceivedEventArgs The EventArgs object containing the packet data
return void

ConfirmXferPacketHandler() protected method

Process an incoming packet and raise the appropriate events
protected ConfirmXferPacketHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object The sender
e OpenMetaverse.PacketReceivedEventArgs The EventArgs object containing the packet data
return void

InitiateDownloadPacketHandler() protected method

Process an incoming packet and raise the appropriate events
protected InitiateDownloadPacketHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object The sender
e OpenMetaverse.PacketReceivedEventArgs The EventArgs object containing the packet data
return void

OnAssetUploaded() protected method

Raises the AssetUploaded event
protected OnAssetUploaded ( AssetUploadEventArgs e ) : void
e AssetUploadEventArgs A AssetUploadedEventArgs object containing the /// data returned from the simulator
return void

OnImageReceiveProgress() protected method

Raises the ImageReceiveProgress event
protected OnImageReceiveProgress ( ImageReceiveProgressEventArgs e ) : void
e ImageReceiveProgressEventArgs A ImageReceiveProgressEventArgs object containing the /// data returned from the simulator
return void

OnInitiateDownload() protected method

Raises the InitiateDownload event
protected OnInitiateDownload ( InitiateDownloadEventArgs e ) : void
e InitiateDownloadEventArgs A InitiateDownloadEventArgs object containing the /// data returned from the simulator
return void

OnUploadProgress() protected method

Raises the UploadProgress event
protected OnUploadProgress ( AssetUploadEventArgs e ) : void
e AssetUploadEventArgs A UploadProgressEventArgs object containing the /// data returned from the simulator
return void

OnXferReceived() protected method

Raises the XferReceived event
protected OnXferReceived ( XferReceivedEventArgs e ) : void
e XferReceivedEventArgs A XferReceivedEventArgs object containing the /// data returned from the simulator
return void

RequestAsset() public method

Request an asset download
public RequestAsset ( UUID assetID, AssetType type, bool priority, AssetReceivedCallback callback ) : void
assetID UUID Asset UUID
type AssetType Asset type, must be correct for the transfer to succeed
priority bool Whether to give this transfer an elevated priority
callback AssetReceivedCallback The callback to fire when the simulator responds with the asset data
return void

RequestAsset() public method

Request an asset download
public RequestAsset ( UUID assetID, AssetType type, bool priority, SourceType sourceType, AssetReceivedCallback callback ) : void
assetID UUID Asset UUID
type AssetType Asset type, must be correct for the transfer to succeed
priority bool Whether to give this transfer an elevated priority
sourceType SourceType Source location of the requested asset
callback AssetReceivedCallback The callback to fire when the simulator responds with the asset data
return void

RequestAsset() public method

Request an asset download
public RequestAsset ( UUID assetID, AssetType type, bool priority, SourceType sourceType, UUID transactionID, AssetReceivedCallback callback ) : void
assetID UUID Asset UUID
type AssetType Asset type, must be correct for the transfer to succeed
priority bool Whether to give this transfer an elevated priority
sourceType SourceType Source location of the requested asset
transactionID UUID UUID of the transaction
callback AssetReceivedCallback The callback to fire when the simulator responds with the asset data
return void

RequestAssetXfer() public method

Request an asset download through the almost deprecated Xfer system
public RequestAssetXfer ( string filename, bool deleteOnCompletion, bool useBigPackets, UUID vFileID, AssetType vFileType, bool fromCache ) : ulong
filename string Filename of the asset to request
deleteOnCompletion bool Whether or not to delete the asset /// off the server after it is retrieved
useBigPackets bool Use large transfer packets or not
vFileID UUID UUID of the file to request, if filename is /// left empty
vFileType AssetType Asset type of vFileID, or /// AssetType.Unknown if filename is not empty
fromCache bool Sets the FilePath in the request to Cache /// (4) if true, otherwise Unknown (0) is used
return ulong

RequestEstateAsset() public method

public RequestEstateAsset ( ) : void
return void

RequestImage() public method

Overload: Request a texture asset from the simulator using the TexturePipeline system to manage the requests and re-assemble the image from the packets received from the simulator
public RequestImage ( UUID textureID, ImageType imageType, TextureDownloadCallback callback ) : void
textureID UUID The of the texture asset to download
imageType ImageType The of the texture asset. /// Use for most textures, or for baked layer texture assets
callback TextureDownloadCallback The callback to fire when the image is retrieved. The callback /// will contain the result of the request and the texture asset data
return void

RequestImage() public method

Overload: Request a texture asset from the simulator using the TexturePipeline system to manage the requests and re-assemble the image from the packets received from the simulator
public RequestImage ( UUID textureID, ImageType imageType, TextureDownloadCallback callback, bool progress ) : void
textureID UUID The of the texture asset to download
imageType ImageType The of the texture asset. /// Use for most textures, or for baked layer texture assets
callback TextureDownloadCallback The callback to fire when the image is retrieved. The callback /// will contain the result of the request and the texture asset data
progress bool If true, the callback will be fired for each chunk of the downloaded image. /// The callback asset parameter will contain all previously received chunks of the texture asset starting /// from the beginning of the request
return void

RequestImage() public method

Request a texture asset from the simulator using the TexturePipeline system to manage the requests and re-assemble the image from the packets received from the simulator
A bug exists in the Linden Simulator where a -1 will occasionally be sent with a non-zero priority indicating an off-by-one error.
public RequestImage ( UUID textureID, ImageType imageType, float priority, int discardLevel, uint packetStart, TextureDownloadCallback callback, bool progress ) : void
textureID UUID The of the texture asset to download
imageType ImageType The of the texture asset. /// Use for most textures, or for baked layer texture assets
priority float A float indicating the requested priority for the transfer. Higher priority values tell the simulator /// to prioritize the request before lower valued requests. An image already being transferred using the can have /// its priority changed by resending the request with the new priority value
discardLevel int Number of quality layers to discard. /// This controls the end marker of the data sent. Sending with value -1 combined with priority of 0 cancels an in-progress /// transfer.
packetStart uint The packet number to begin the request at. A value of 0 begins the request /// from the start of the asset texture
callback TextureDownloadCallback The callback to fire when the image is retrieved. The callback /// will contain the result of the request and the texture asset data
progress bool If true, the callback will be fired for each chunk of the downloaded image. /// The callback asset parameter will contain all previously received chunks of the texture asset starting /// from the beginning of the request
return void

RequestImage() public method

Overload: Request a texture asset from the simulator using the TexturePipeline system to manage the requests and re-assemble the image from the packets received from the simulator
public RequestImage ( UUID textureID, TextureDownloadCallback callback ) : void
textureID UUID The of the texture asset to download
callback TextureDownloadCallback The callback to fire when the image is retrieved. The callback /// will contain the result of the request and the texture asset data
return void

RequestImageCancel() public method

Cancel a texture request
public RequestImageCancel ( UUID textureID ) : void
textureID UUID The texture assets
return void

RequestInventoryAsset() public method

public RequestInventoryAsset ( InventoryItem item, bool priority, AssetReceivedCallback callback ) : void
item InventoryItem
priority bool
callback AssetReceivedCallback
return void

RequestInventoryAsset() public method

public RequestInventoryAsset ( UUID assetID, UUID itemID, UUID taskID, UUID ownerID, AssetType type, bool priority, AssetReceivedCallback callback ) : void
assetID UUID Use UUID.Zero if you do not have the /// asset ID but have all the necessary permissions
itemID UUID The item ID of this asset in the inventory
taskID UUID Use UUID.Zero if you are not requesting an /// asset from an object inventory
ownerID UUID The owner of this asset
type AssetType Asset type
priority bool Whether to prioritize this asset download or not
callback AssetReceivedCallback
return void

RequestMesh() public method

Requests download of a mesh asset
public RequestMesh ( UUID meshID, MeshDownloadCallback callback ) : void
meshID UUID UUID of the mesh asset
callback MeshDownloadCallback Callback when the request completes
return void

RequestUpload() public method

Request an asset be uploaded to the simulator
public RequestUpload ( Asset asset, bool storeLocal ) : UUID
asset Asset The Object containing the asset data
storeLocal bool If True, the asset once uploaded will be stored on the simulator /// in which the client was connected in addition to being stored on the asset server
return UUID

RequestUpload() public method

Request an asset be uploaded to the simulator
public RequestUpload ( AssetType type, byte data, bool storeLocal ) : UUID
type AssetType The of the asset being uploaded
data byte A byte array containing the encoded asset data
storeLocal bool If True, the asset once uploaded will be stored on the simulator /// in which the client was connected in addition to being stored on the asset server
return UUID

RequestUpload() public method

Request an asset be uploaded to the simulator
public RequestUpload ( UUID &assetID, AssetType type, byte data, bool storeLocal ) : UUID
assetID UUID
type AssetType Asset type to upload this data as
data byte A byte array containing the encoded asset data
storeLocal bool If True, the asset once uploaded will be stored on the simulator /// in which the client was connected in addition to being stored on the asset server
return UUID

RequestUpload() public method

Initiate an asset upload
public RequestUpload ( UUID &assetID, AssetType type, byte data, bool storeLocal, UUID transactionID ) : UUID
assetID UUID The ID this asset will have if the /// upload succeeds
type AssetType Asset type to upload this data as
data byte Raw asset data to upload
storeLocal bool Whether to store this asset on the local /// simulator or the grid-wide asset server
transactionID UUID The tranaction id for the upload
return UUID

RequestUploadBakedTexture() public method

public RequestUploadBakedTexture ( byte textureData, BakedTextureUploadedCallback callback ) : void
textureData byte
callback BakedTextureUploadedCallback
return void

RequestXferHandler() protected method

Process an incoming packet and raise the appropriate events
protected RequestXferHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object The sender
e OpenMetaverse.PacketReceivedEventArgs The EventArgs object containing the packet data
return void

SendXferPacketHandler() protected method

Process an incoming packet and raise the appropriate events
protected SendXferPacketHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object The sender
e OpenMetaverse.PacketReceivedEventArgs The EventArgs object containing the packet data
return void

TransferInfoHandler() protected method

Process an incoming packet and raise the appropriate events
protected TransferInfoHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object The sender
e OpenMetaverse.PacketReceivedEventArgs The EventArgs object containing the packet data
return void

TransferPacketHandler() protected method

Process an incoming packet and raise the appropriate events
protected TransferPacketHandler ( object sender, OpenMetaverse.PacketReceivedEventArgs e ) : void
sender object The sender
e OpenMetaverse.PacketReceivedEventArgs The EventArgs object containing the packet data
return void

Property Details

Cache public property

Texture download cache
public AssetCache Cache
return AssetCache