Should now be able to create and edit Notecards

0.1-prestable
MW 2007-03-30 11:09:51 +00:00
parent d14a24d5ca
commit 00579d3581
3 changed files with 30 additions and 2 deletions

View File

@ -84,14 +84,14 @@ namespace OpenSim
} }
else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5) else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7)
{ {
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = assetID; asset.FullID = assetID;
// Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated()); // Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated());
asset.Type = pack.AssetBlock.Type; asset.Type = pack.AssetBlock.Type;
asset.InvType = asset.Type; asset.InvType = asset.Type ;
asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000"); asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000");
asset.Data = pack.AssetBlock.AssetData; asset.Data = pack.AssetBlock.AssetData;

View File

@ -329,6 +329,7 @@ namespace OpenSim.Assets
/// <param name="transferRequest"></param> /// <param name="transferRequest"></param>
public void AddAssetRequest(SimClient userInfo, TransferRequestPacket transferRequest) public void AddAssetRequest(SimClient userInfo, TransferRequestPacket transferRequest)
{ {
Console.WriteLine("AssetCache- got asset request: " + transferRequest.TransferInfo.TransferID.ToString());
LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0); LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0);
//check to see if asset is in local cache, if not we need to request it from asset server. //check to see if asset is in local cache, if not we need to request it from asset server.
if (!this.Assets.ContainsKey(requestID)) if (!this.Assets.ContainsKey(requestID))
@ -337,6 +338,7 @@ namespace OpenSim.Assets
// so request from asset server // so request from asset server
if (!this.RequestedAssets.ContainsKey(requestID)) if (!this.RequestedAssets.ContainsKey(requestID))
{ {
Console.WriteLine("which isn't in our cache, so requesting from asset server");
AssetRequest request = new AssetRequest(); AssetRequest request = new AssetRequest();
request.RequestUser = userInfo; request.RequestUser = userInfo;
request.RequestAssetID = requestID; request.RequestAssetID = requestID;
@ -347,6 +349,7 @@ namespace OpenSim.Assets
return; return;
} }
//it is in our cache //it is in our cache
Console.WriteLine("which is in our cache so will be sending it");
AssetInfo asset = this.Assets[requestID]; AssetInfo asset = this.Assets[requestID];
//work out how many packets it should be sent in //work out how many packets it should be sent in

View File

@ -341,6 +341,10 @@ namespace OpenSim
{ {
this.UploadAssets.CreateInventoryItem(createItem); this.UploadAssets.CreateInventoryItem(createItem);
} }
else
{
this.CreateInventoryItem(createItem);
}
break; break;
case PacketType.FetchInventory: case PacketType.FetchInventory:
//Console.WriteLine("fetch item packet"); //Console.WriteLine("fetch item packet");
@ -735,5 +739,26 @@ namespace OpenSim
} }
return inventory; return inventory;
} }
private void CreateInventoryItem(CreateInventoryItemPacket packet)
{
if (packet.InventoryBlock.Type == 7)
{
Console.WriteLine(packet.ToString());
this.debug = true;
//lets try this out with creating a notecard
AssetBase asset = new AssetBase();
asset.Name = Helpers.FieldToString(packet.InventoryBlock.Name);
asset.Description = Helpers.FieldToString(packet.InventoryBlock.Description);
asset.InvType = packet.InventoryBlock.InvType;
asset.Type = packet.InventoryBlock.Type;
asset.FullID = LLUUID.Random();
asset.Data = new byte[0];
Console.WriteLine("created new notecard with asset : " + asset.FullID.ToStringHyphenated());
m_assetCache.AddAsset(asset);
m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset);
}
}
} }
} }