OpenMetaverse.InventoryManager.GiveFolder C# (CSharp) Method

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
        public void GiveFolder(UUID folderID, string folderName, AssetType assetType, UUID recipient,
            bool doEffect)
        {
            byte[] bucket;

                List<InventoryItem> folderContents = new List<InventoryItem>();

                _Client.Inventory.FolderContents(folderID, _Client.Self.AgentID, false, true, InventorySortOrder.ByDate, 1000 * 15).ForEach(
                    delegate(InventoryBase ib)
                    {
                        folderContents.Add(_Client.Inventory.FetchItem(ib.UUID, _Client.Self.AgentID, 1000 * 10));
                    });
                bucket = new byte[17 * (folderContents.Count + 1)];

                //Add parent folder (first item in bucket)
                bucket[0] = (byte)assetType;
                Buffer.BlockCopy(folderID.GetBytes(), 0, bucket, 1, 16);

                //Add contents to bucket after folder
                for (int i = 1; i <= folderContents.Count; ++i)
                {
                    bucket[i * 17] = (byte)folderContents[i - 1].AssetType;
                    Buffer.BlockCopy(folderContents[i - 1].UUID.GetBytes(), 0, bucket, i * 17 + 1, 16);
                }

            _Client.Self.InstantMessage(
                    _Client.Self.Name,
                    recipient,
                    folderName,
                    UUID.Random(),
                    InstantMessageDialog.InventoryOffered,
                    InstantMessageOnline.Online,
                    _Client.Self.SimPosition,
                    _Client.Network.CurrentSim.ID,
                    bucket);

            if (doEffect)
            {
                _Client.Self.BeamEffect(_Client.Self.AgentID, recipient, Vector3d.Zero,
                    _Client.Settings.DEFAULT_EFFECT_COLOR, 1f, UUID.Random());
            }
        }