Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="assetID">Use LLUUID.Zero if you do not have the
        /// asset ID but have all the necessary permissions</param>
        /// <param name="itemID">The item ID of this asset in the inventory</param>
        /// <param name="taskID">Use LLUUID.Zero if you are not requesting an
        /// asset from an object inventory</param>
        /// <param name="ownerID">The owner of this asset</param>
        /// <param name="type">Asset type</param>
        /// <param name="priority">Whether to prioritize this asset download or not</param>
        public LLUUID RequestInventoryAsset(LLUUID assetID, LLUUID itemID, LLUUID taskID, LLUUID ownerID, AssetType type, bool priority)
        {
            AssetDownload transfer = new AssetDownload();

            transfer.ID      = LLUUID.Random();
            transfer.AssetID = assetID;
            //transfer.AssetType = type; // Set in TransferInfoHandler.
            transfer.Priority  = 100.0f + (priority ? 1.0f : 0.0f);
            transfer.Channel   = ChannelType.Asset;
            transfer.Source    = SourceType.SimInventoryItem;
            transfer.Simulator = Client.Network.CurrentSim;

            // Add this transfer to the dictionary
            lock (Transfers) Transfers[transfer.ID] = transfer;

            // Build the request packet and send it
            TransferRequestPacket request = new TransferRequestPacket();

            request.TransferInfo.ChannelType = (int)transfer.Channel;
            request.TransferInfo.Priority    = transfer.Priority;
            request.TransferInfo.SourceType  = (int)transfer.Source;
            request.TransferInfo.TransferID  = transfer.ID;

            byte[] paramField = new byte[100];
            Buffer.BlockCopy(Client.Self.AgentID.GetBytes(), 0, paramField, 0, 16);
            Buffer.BlockCopy(Client.Self.SessionID.GetBytes(), 0, paramField, 16, 16);
            Buffer.BlockCopy(ownerID.GetBytes(), 0, paramField, 32, 16);
            Buffer.BlockCopy(taskID.GetBytes(), 0, paramField, 48, 16);
            Buffer.BlockCopy(itemID.GetBytes(), 0, paramField, 64, 16);
            Buffer.BlockCopy(assetID.GetBytes(), 0, paramField, 80, 16);
            Buffer.BlockCopy(Helpers.IntToBytes((int)type), 0, paramField, 96, 4);
            request.TransferInfo.Params = paramField;

            Client.Network.SendPacket(request, transfer.Simulator);
            return(transfer.ID);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reservedNewbie"></param>
        /// <param name="forSale"></param>
        /// <param name="auction"></param>
        /// <returns></returns>
        public int DirLandRequest(bool reservedNewbie, bool forSale, bool auction)
        {
            // Set the class-wide variables so the callback has them
//            ReservedNewbie = reservedNewbie; // FIXME FIXME FIXME
//            ForSale = forSale;
//            Auction = auction;

            // Clear the list
            ParcelsForSale.Clear();

            // Start the timer
            DirLandTimeout = false;
            DirLandTimer.Start();

            DirLandQueryPacket query = new DirLandQueryPacket();

            query.AgentData.AgentID   = Client.Network.AgentID;
            query.AgentData.SessionID = Client.Network.SessionID;
//            query.QueryData.Auction = auction; // FIXME FIXME FIXME
//            query.QueryData.ForSale = forSale;
            query.QueryData.QueryFlags = 0;
            query.QueryData.QueryID    = LLUUID.Random();
//            query.QueryData.ReservedNewbie = reservedNewbie; // FIXME FIXME FIXME

            Client.Network.SendPacket((Packet)query);

            while (!DirLandTimeout)
            {
                Client.Tick();
            }

            // Make sure the timer is actually stopped
            DirLandTimer.Stop();

            return(ParcelsForSale.Count);
        }
Пример #3
0
 /// <summary>
 /// Search Events with Options to specify category and Mature events.
 /// </summary>
 /// <param name="searchText">Text to search for</param>
 /// <param name="showMature">true to include Mature events</param>
 /// <param name="category">category to search</param>
 /// <returns>UUID of query to correlate results in callback.</returns>
 public LLUUID StartEventsSearch(string searchText, bool showMature, EventCategories category)
 {
     return(StartEventsSearch(searchText, showMature, "u", 0, category, LLUUID.Random()));
 }
Пример #4
0
 /// <summary>
 /// Searches Places for Land owned by a specific user or group
 /// </summary>
 /// <param name="findFlags">One of the Values from the DirFindFlags struct, ie: AgentOwned, GroupOwned, etc.</param>
 /// <param name="groupID">LLUID of group you want to recieve land list for (You must be in group), or
 /// LLUID.Zero for Your own land</param>
 /// <returns>Transaction (Query) ID which can be associated with results from your request.</returns>
 public LLUUID StartPlacesSearch(DirFindFlags findFlags, LLUUID groupID)
 {
     return(StartPlacesSearch(findFlags, Parcel.ParcelCategory.Any, String.Empty, String.Empty, groupID,
                              LLUUID.Random()));
 }
Пример #5
0
 public LLUUID StartPeopleSearch(DirFindFlags findFlags, string searchText, int queryStart)
 {
     return(StartPeopleSearch(findFlags, searchText, queryStart, LLUUID.Random()));
 }
Пример #6
0
        /// <summary>
        /// Initiate an asset upload
        /// </summary>
        /// <param name="transactionID">The ID this asset will have if the
        /// upload succeeds</param>
        /// <param name="type">Asset type to upload this data as</param>
        /// <param name="data">Raw asset data to upload</param>
        /// <param name="tempFile">Whether this is a temporary file or not</param>
        /// <param name="storeLocal">Whether to store this asset on the local
        /// simulator or the grid-wide asset server</param>
        /// <param name="isPriority">Give this upload a higher priority</param>
        /// <returns>The transaction ID of this transfer</returns>
        public LLUUID RequestUpload(out LLUUID assetID, AssetType type, byte[] data, bool tempFile, bool storeLocal, bool isPriority)
        {
            AssetUpload upload = new AssetUpload();

            upload.AssetData = data;
            upload.AssetType = type;
            upload.ID        = LLUUID.Random();
            assetID          = LLUUID.Combine(upload.ID, Client.Self.SecureSessionID);
            upload.AssetID   = assetID;
            upload.Size      = data.Length;
            upload.XferID    = 0;

            // Build and send the upload packet
            AssetUploadRequestPacket request = new AssetUploadRequestPacket();

            request.AssetBlock.StoreLocal    = storeLocal;
            request.AssetBlock.Tempfile      = tempFile;
            request.AssetBlock.TransactionID = upload.ID;
            request.AssetBlock.Type          = (sbyte)type;

            if (data.Length + 100 < Settings.MAX_PACKET_SIZE)
            {
                Client.Log(
                    String.Format("Beginning asset upload [Single Packet], ID: {0}, AssetID: {1}, Size: {2}",
                                  upload.ID.ToString(), upload.AssetID.ToString(), upload.Size),
                    Helpers.LogLevel.Info);

                // The whole asset will fit in this packet, makes things easy
                request.AssetBlock.AssetData = data;
                upload.Transferred           = data.Length;
            }
            else
            {
                Client.Log(
                    String.Format("Beginning asset upload [Multiple Packets], ID: {0}, AssetID: {1}, Size: {2}",
                                  upload.ID.ToString(), upload.AssetID.ToString(), upload.Size),
                    Helpers.LogLevel.Info);

                // Asset is too big, send in multiple packets
                request.AssetBlock.AssetData = new byte[0];
            }

            //Client.DebugLog(request.ToString());

            /*
             * // Add this upload to the Transfers dictionary using the assetID as the key.
             * // Once the simulator assigns an actual identifier for this upload it will be
             * // removed from Transfers and reinserted with the proper identifier
             * lock (Transfers) Transfers[upload.AssetID] = upload;
             */

            // Wait for the previous upload to receive a RequestXferPacket
            if (PendingUploadEvent.WaitOne(10000, false))
            {
                PendingUpload = upload;

                Client.Network.SendPacket(request);

                return(upload.ID);
            }
            else
            {
                throw new Exception("Timeout waiting for previous asset upload to begin");
            }
        }