/*private Packet UpdateInventory(Packet packet, IPEndPoint sim) * { * /* * UpdateInventoryItemPacket uip = (UpdateInventoryItemPacket)packet; * foreach (UpdateInventoryItemPacket.InventoryDataBlock block in uip.InventoryData) * { * if (block.Type == 10) * { * if(trans2Item.ContainsKey(block.TransactionID)) * { * trans2Item[block.TransactionID]=block.ItemID; * }else * trans2Item.Add(block.TransactionID, block.ItemID); * } * } * foreach (CurrentUploadType cu in name2SaveBuffer) * { * if (trans2Item.ContainsKey(cu.uploadID)) * { * string filename = trans2Item[curentUpload.uploadID].ToString(); * * File.WriteAllBytes("Scripts Cache\\" + filename, curentUpload.oldscriptdata); * } * } * name2SaveBuffer.Clear(); * return packet; * }*/ private Packet TryToSendAsset(Packet packet, IPEndPoint sim) { if (Enabled) { AssetUploadRequestPacket ass = (AssetUploadRequestPacket)packet; if (ass.AssetBlock.Type == (sbyte)AssetType.LSLText) { Console.WriteLine("Atempting to save to inv with asset type " + ass.AssetBlock.Type.ToString()); CurrentUploadType curentUpload = new CurrentUploadType(); curentUpload.proxySending = false; curentUpload.local = ass.AssetBlock.StoreLocal; curentUpload.temp = ass.AssetBlock.Tempfile; curentUpload.uploadID = ass.AssetBlock.TransactionID; curentUpload.type = ass.AssetBlock.Type; curentUpload.data = new byte[] { }; curentUpload.paid = false; curentUpload.oldscriptdata = new byte[300000]; /*uint newperms = 0; * newperms |= (uint)PermissionMask.Modify; * newperms |= (uint)PermissionMask.Copy; * newperms |= (uint)PermissionMask.Transfer; * * curentUpload.ownerMask = newperms;*/ curentUpload.curentdatalenght = 0; curentUpload.oldmaxsize = 90000; //Buffer.BlockCopy(ass.AssetBlock.AssetData, 0, curentUpload.oldscriptdata, 0, curentUpload.curentdatalenght); AssetUploadRequestPacket asetUp = new AssetUploadRequestPacket(); asetUp.AssetBlock.StoreLocal = curentUpload.local; asetUp.AssetBlock.Tempfile = false; asetUp.AssetBlock.TransactionID = curentUpload.uploadID; asetUp.AssetBlock.Type = (sbyte)AssetType.LSLText; asetUp.AssetBlock.AssetData = new byte[] { }; //proxy.InjectPacket(asetUp, Direction.Outgoing); //proxy curentUpload.VFileAssetID = UUID.Combine(curentUpload.uploadID, frame.SecureSessionID); form.log("We are expecintg a vfile id of " + curentUpload.VFileAssetID.ToString(), System.Drawing.Color.Black, System.Drawing.Color.Magenta); if (this.uploadsLookingForXferId.ContainsKey(curentUpload.VFileAssetID)) { this.uploadsLookingForXferId[curentUpload.VFileAssetID] = curentUpload; } else { this.uploadsLookingForXferId.Add(curentUpload.VFileAssetID, curentUpload); } } } return(packet); }
public void SaveToSLInventory(byte[] uploaddata, String nname, sbyte type, bool copy, bool mod, bool trans, bool pay, bool local, bool temp) { Console.WriteLine("Atempting to save to inv"); uploadID = UUID.Random(); AssetUploadRequestPacket asetUp = new AssetUploadRequestPacket(); asetUp.AssetBlock.StoreLocal = local; asetUp.AssetBlock.Tempfile = temp; asetUp.AssetBlock.TransactionID = uploadID; specialID = UUID.Combine(uploadID, frame.SessionID); asetUp.AssetBlock.Type = (sbyte)type; asetUp.AssetBlock.AssetData = new byte[] { }; proxy.InjectPacket(asetUp, Direction.Outgoing); this.curentUpload = new CurrentUploadType(); curentUpload.name = nname; curentUpload.data = uploaddata; curentUpload.temp = temp; curentUpload.type = (sbyte)type; curentUpload.local = local; curentUpload.paid = pay; grabbed = 0; if (pay) { payMoney(10); } uint newperms = 0; if (mod) { newperms |= (uint)PermissionMask.Modify; } if (copy) { newperms |= (uint)PermissionMask.Copy; } if (trans) { newperms |= (uint)PermissionMask.Transfer; } curentUpload.ownerMask = newperms; //generate owner mask }
/*private Packet UpdateInventory(Packet packet, IPEndPoint sim) { /* UpdateInventoryItemPacket uip = (UpdateInventoryItemPacket)packet; foreach (UpdateInventoryItemPacket.InventoryDataBlock block in uip.InventoryData) { if (block.Type == 10) { if(trans2Item.ContainsKey(block.TransactionID)) { trans2Item[block.TransactionID]=block.ItemID; }else trans2Item.Add(block.TransactionID, block.ItemID); } } foreach (CurrentUploadType cu in name2SaveBuffer) { if (trans2Item.ContainsKey(cu.uploadID)) { string filename = trans2Item[curentUpload.uploadID].ToString(); File.WriteAllBytes("Scripts Cache\\" + filename, curentUpload.oldscriptdata); } } name2SaveBuffer.Clear(); return packet; }*/ private Packet TryToSendAsset(Packet packet, IPEndPoint sim) { if (Enabled) { AssetUploadRequestPacket ass = (AssetUploadRequestPacket)packet; if (ass.AssetBlock.Type == (sbyte)AssetType.LSLText) { Console.WriteLine("Atempting to save to inv with asset type " + ass.AssetBlock.Type.ToString()); CurrentUploadType curentUpload = new CurrentUploadType(); curentUpload.proxySending = false; curentUpload.local = ass.AssetBlock.StoreLocal; curentUpload.temp = ass.AssetBlock.Tempfile; curentUpload.uploadID = ass.AssetBlock.TransactionID; curentUpload.type = ass.AssetBlock.Type; curentUpload.data = new byte[] { }; curentUpload.paid = false; curentUpload.oldscriptdata = new byte[300000]; /*uint newperms = 0; newperms |= (uint)PermissionMask.Modify; newperms |= (uint)PermissionMask.Copy; newperms |= (uint)PermissionMask.Transfer; curentUpload.ownerMask = newperms;*/ curentUpload.curentdatalenght = 0; curentUpload.oldmaxsize = 90000; //Buffer.BlockCopy(ass.AssetBlock.AssetData, 0, curentUpload.oldscriptdata, 0, curentUpload.curentdatalenght); AssetUploadRequestPacket asetUp = new AssetUploadRequestPacket(); asetUp.AssetBlock.StoreLocal = curentUpload.local; asetUp.AssetBlock.Tempfile = false; asetUp.AssetBlock.TransactionID = curentUpload.uploadID; asetUp.AssetBlock.Type = (sbyte)AssetType.LSLText; asetUp.AssetBlock.AssetData = new byte[] { }; //proxy.InjectPacket(asetUp, Direction.Outgoing); //proxy curentUpload.VFileAssetID = UUID.Combine(curentUpload.uploadID, frame.SecureSessionID); form.log("We are expecintg a vfile id of " + curentUpload.VFileAssetID.ToString(), System.Drawing.Color.Black, System.Drawing.Color.Magenta); if (this.uploadsLookingForXferId.ContainsKey(curentUpload.VFileAssetID)) { this.uploadsLookingForXferId[curentUpload.VFileAssetID] = curentUpload; } else this.uploadsLookingForXferId.Add(curentUpload.VFileAssetID, curentUpload); } } return packet; }
public void SaveToSLInventory(byte[] uploaddata, String nname, sbyte type, bool copy, bool mod, bool trans, bool pay, bool local, bool temp) { Console.WriteLine("Atempting to save to inv"); uploadID = UUID.Random(); AssetUploadRequestPacket asetUp = new AssetUploadRequestPacket(); asetUp.AssetBlock.StoreLocal = local; asetUp.AssetBlock.Tempfile = temp; asetUp.AssetBlock.TransactionID = uploadID; specialID = UUID.Combine(uploadID, frame.SessionID); asetUp.AssetBlock.Type = (sbyte)type; asetUp.AssetBlock.AssetData = new byte[] { }; proxy.InjectPacket(asetUp, Direction.Outgoing); this.curentUpload = new CurrentUploadType(); curentUpload.name = nname; curentUpload.data = uploaddata; curentUpload.temp = temp; curentUpload.type = (sbyte)type; curentUpload.local = local; curentUpload.paid = pay; grabbed = 0; if (pay) payMoney(10); uint newperms = 0; if (mod) newperms |= (uint)PermissionMask.Modify; if (copy) newperms |= (uint)PermissionMask.Copy; if (trans) newperms |= (uint)PermissionMask.Transfer; curentUpload.ownerMask = newperms; //generate owner mask }