Esempio n. 1
0
        internal InventoryFolder FolderCreate(String name, LLUUID parentid)
        {
            InventoryFolder ifolder = new InventoryFolder(this, name, LLUUID.GenerateUUID(), parentid);

            ifolder._Type = -1;

            if (htFoldersByUUID.ContainsKey(ifolder.ParentID))
            {
                if (((InventoryFolder)htFoldersByUUID[ifolder.ParentID]).alContents.Contains(ifolder) == false)
                {
                    // Add new folder to the contents of the parent folder.
                    ((InventoryFolder)htFoldersByUUID[ifolder.ParentID]).alContents.Add(ifolder);
                }
            }
            else
            {
                throw new Exception("Parent Folder " + ifolder.ParentID + " does not exist in this Inventory Manager.");
            }

            if (htFoldersByUUID.ContainsKey(ifolder.FolderID) == false)
            {
                htFoldersByUUID[ifolder.FolderID] = ifolder;
            }

            Packet packet = InvPacketHelper.CreateInventoryFolder(ifolder.Name, ifolder.ParentID, ifolder.Type, ifolder.FolderID);

            slClient.Network.SendPacket(packet);

            return(ifolder);
        }
Esempio n. 2
0
        public void Init()
        {
            Client = new SecondLife();
            Client.Network.AgentID   = LLUUID.GenerateUUID();
            Client.Network.SessionID = LLUUID.GenerateUUID();

            Server = new DebugServer("keywords.txt", "message_template.msg", 8338);
            Assert.IsTrue(Server.Initialized, "Failed to initialize the server, couldn't bind to port 8338?");

            Simulator debugSim = Client.Network.Connect(IPAddress.Loopback, 8338, 1, true);

            Assert.IsNotNull(debugSim, "Failed to connect to the debugging simulator");

            Client.Network.RegisterCallback(PacketType.SimulatorAssign, new PacketCallback(SimulatorAssignHandler));
        }
Esempio n. 3
0
        private void cmdFind_Click(object sender, System.EventArgs e)
        {
            lstFind.Items.Clear();

            DirFindQueryPacket query = new DirFindQueryPacket();

            query.AgentData.AgentID    = client.Network.AgentID;
            query.AgentData.SessionID  = client.Network.SessionID;
            query.QueryData.QueryFlags = 1;
            query.QueryData.QueryID    = LLUUID.GenerateUUID();
            query.QueryData.QueryStart = 0;
            query.QueryData.QueryText  = Helpers.StringToField(txtFind.Text);
            query.Header.Reliable      = true;

            client.Network.SendPacket((Packet)query);
        }
Esempio n. 4
0
        internal void ItemGiveTo(InventoryItem iitem, LLUUID ToAgentID)
        {
            LLUUID MessageID = LLUUID.GenerateUUID();

            Packet packet = InvPacketHelper.ImprovedInstantMessage(
                MessageID
                , ToAgentID
                , slClient.Self.FirstName + " " + slClient.Self.LastName
                , slClient.Self.Position
                , iitem
                );

            slClient.Network.SendPacket(packet);

            #if DEBUG_PACKETS
            Console.WriteLine(packet);
            #endif
        }
 /// <summary>
 /// </summary>
 /// <param name="assetData"></param>
 override internal void SetAssetData(byte[] assetData)
 {
     if (_Asset == null)
     {
         if (AssetID != null)
         {
             _Asset = new AssetNotecard(AssetID, assetData);
         }
         else
         {
             _Asset   = new AssetNotecard(LLUUID.GenerateUUID(), assetData);
             _AssetID = _Asset.AssetID;
         }
     }
     else
     {
         _Asset.AssetData = assetData;
     }
 }
Esempio n. 6
0
 /// <summary>
 /// </summary>
 /// <param name="assetData"></param>
 virtual internal void SetAssetData(byte[] assetData)
 {
     if (_Asset == null)
     {
         if (AssetID != null)
         {
             _Asset = new Asset(AssetID, Type, assetData);
         }
         else
         {
             _Asset   = new Asset(LLUUID.GenerateUUID(), Type, assetData);
             _AssetID = _Asset.AssetID;
         }
     }
     else
     {
         _Asset.AssetData = assetData;
     }
 }
Esempio n. 7
0
        public void Connected()
        {
            lblName.Text = Client.Network.LoginValues["first_name"] + " " +
                           Client.Network.LoginValues["last_name"];

            // MoneyBalanceRequest
            Hashtable blocks = new Hashtable();
            Hashtable fields = new Hashtable();

            blocks                  = new Hashtable();
            fields                  = new Hashtable();
            fields["AgentID"]       = Client.Network.AgentID;
            fields["TransactionID"] = LLUUID.GenerateUUID();
            blocks[fields]          = "MoneyData";
            Packet packet = PacketBuilder.BuildPacket("MoneyBalanceRequest", Client.Protocol, blocks,
                                                      Helpers.MSG_RELIABLE);

            Client.Network.SendPacket(packet);
        }
Esempio n. 8
0
        /// <summary>
        /// Upload an asset to Second Life
        /// </summary>
        /// <param name="asset">The asset to be uploaded</param>
        /// <returns>The Asset ID of the completed upload</returns>
        public LLUUID UploadAsset(Asset asset)
        {
            if (curUploadRequest != null)
            {
                throw new Exception("An existing asset upload is currently in-progress.");
            }

            try
            {
                curUploadRequest = new AssetRequestUpload(slClient, LLUUID.GenerateUUID(), asset);

                LLUUID assetID = curUploadRequest.DoUpload();
                if (asset.Type == Asset.ASSET_TYPE_IMAGE)
                {
                    //SinkFee(SINK_FEE_IMAGE);
                }
                return(assetID);
            }
            finally
            {
                curUploadRequest = null;
            }
        }
Esempio n. 9
0
        private void cmdFind_Click(object sender, System.EventArgs e)
        {
            lstFind.Items.Clear();

            Hashtable blocks = new Hashtable();
            Hashtable fields = new Hashtable();

            fields["QueryID"]    = LLUUID.GenerateUUID();
            fields["QueryFlags"] = (uint)1;
            fields["QueryStart"] = (int)0;
            fields["QueryText"]  = txtFind.Text;
            blocks[fields]       = "QueryData";

            fields              = new Hashtable();
            fields["AgentID"]   = Client.Network.AgentID;
            fields["SessionID"] = Client.Network.SessionID;
            blocks[fields]      = "AgentData";

            Packet packet = PacketBuilder.BuildPacket("DirFindQuery", Client.Protocol, blocks,
                                                      Helpers.MSG_RELIABLE);

            Client.Network.SendPacket(packet);
        }
Esempio n. 10
0
        /// <summary>
        /// Get the Asset data for an item
        /// </summary>
        /// <param name="item"></param>
        public void GetInventoryAsset(InventoryItem item)
        {
            LLUUID TransferID = LLUUID.GenerateUUID();

            AssetRequestDownload request = new AssetRequestDownload(TransferID);

            request.Size     = int.MaxValue; // Number of bytes expected
            request.Received = 0;            // Number of bytes received
            request.UpdateLastPacketTime();  // last time we recevied a packet for this request

            htDownloadRequests[TransferID] = request;

            Packet packet = AssetPacketHelpers.TransferRequest(slClient.Network.SessionID, slClient.Network.AgentID, TransferID, item);

            slClient.Network.SendPacket(packet);

            #if DEBUG_PACKETS
            Console.WriteLine(packet);
            #endif

            request.Completed.WaitOne();

            item.SetAssetData(request.AssetData);
        }