protected void ObjectPropertiesHandler(object sender, PacketReceivedEventArgs e)
{
Packet packet = e.Packet;
Simulator simulator = e.Simulator;
ObjectPropertiesPacket op = (ObjectPropertiesPacket)packet;
ObjectPropertiesPacket.ObjectDataBlock[] datablocks = op.ObjectData;
for (int i = 0; i < datablocks.Length; ++i)
{
ObjectPropertiesPacket.ObjectDataBlock objectData = datablocks[i];
Primitive.ObjectProperties props = new Primitive.ObjectProperties();
props.ObjectID = objectData.ObjectID;
props.AggregatePerms = objectData.AggregatePerms;
props.AggregatePermTextures = objectData.AggregatePermTextures;
props.AggregatePermTexturesOwner = objectData.AggregatePermTexturesOwner;
props.Permissions = new Permissions(objectData.BaseMask, objectData.EveryoneMask, objectData.GroupMask,
objectData.NextOwnerMask, objectData.OwnerMask);
props.Category = (ObjectCategory)objectData.Category;
props.CreationDate = Utils.UnixTimeToDateTime((uint)objectData.CreationDate);
props.CreatorID = objectData.CreatorID;
props.Description = Utils.BytesToString(objectData.Description);
props.FolderID = objectData.FolderID;
props.FromTaskID = objectData.FromTaskID;
props.GroupID = objectData.GroupID;
props.InventorySerial = objectData.InventorySerial;
props.ItemID = objectData.ItemID;
props.LastOwnerID = objectData.LastOwnerID;
props.Name = Utils.BytesToString(objectData.Name);
props.OwnerID = objectData.OwnerID;
props.OwnershipCost = objectData.OwnershipCost;
props.SalePrice = objectData.SalePrice;
props.SaleType = (SaleType)objectData.SaleType;
props.SitName = Utils.BytesToString(objectData.SitName);
props.TouchName = Utils.BytesToString(objectData.TouchName);
int numTextures = objectData.TextureID.Length / 16;
props.TextureIDs = new UUID[numTextures];
for (int j = 0; j < numTextures; ++j)
props.TextureIDs[j] = new UUID(objectData.TextureID, j * 16);
if (Client.Settings.OBJECT_TRACKING)
{
Primitive findPrim = simulator.ObjectsPrimitives.Find(
delegate(Primitive prim) { return prim.ID == props.ObjectID; });
if (findPrim != null)
{
OnObjectPropertiesUpdated(new ObjectPropertiesUpdatedEventArgs(simulator, findPrim, props));
lock (simulator.ObjectsPrimitives.Dictionary)
{
if (simulator.ObjectsPrimitives.Dictionary.ContainsKey(findPrim.LocalID))
simulator.ObjectsPrimitives.Dictionary[findPrim.LocalID].Properties = props;
}
}
}
OnObjectProperties(new ObjectPropertiesEventArgs(simulator, props));
}
}