Exemple #1
0
        public ntfGroupNotice(METAboltInstance instance, InstantMessage msg)
            : base(NotificationType.GroupNotice)
        {
            InitializeComponent();
            Disposed += new System.EventHandler(ntfGroupNotice_Disposed);

            this.instance = instance;
            this.msg      = msg;
            client.Groups.GroupProfile += new System.EventHandler <GroupProfileEventArgs>(Groups_GroupProfile);

            if (msg.BinaryBucket.Length > 18 && msg.BinaryBucket[0] != 0)
            {
                type = (AssetType)msg.BinaryBucket[1];
                destinationFolderID = client.Inventory.FindFolderForType(type);
                int icoIndx = InventoryConsole.GetItemImageIndex(type.ToString().ToLower());
                if (icoIndx >= 0)
                {
                    icnItem.Image   = frmMain.ResourceImages.Images[icoIndx];
                    icnItem.Visible = true;
                }
                txtItemName.Text = Utils.BytesToString(msg.BinaryBucket, 18, msg.BinaryBucket.Length - 19);
                btnSave.Enabled  = true;
                btnSave.Visible  = icnItem.Visible = txtItemName.Visible = true;
            }


            if (msg.BinaryBucket.Length >= 18)
            {
                groupID = new UUID(msg.BinaryBucket, 2);
            }
            else
            {
                groupID = msg.FromAgentID;
            }

            int    pos   = msg.Message.IndexOf('|');
            string title = msg.Message.Substring(0, pos);

            lblTitle.Text = title;
            string text = msg.Message.Replace("\n", System.Environment.NewLine);

            text = text.Remove(0, pos + 1);

            lblSentBy.Text = string.Format("Sent by {0}", msg.FromAgentName);
            txtNotice.Text = text;

            if (instance.Groups.ContainsKey(groupID))
            {
                group = instance.Groups[groupID];
                ShowNotice();
            }
            else
            {
                client.Groups.RequestGroupProfile(groupID);
            }
        }
Exemple #2
0
        private void tbtbInvShow_Click(object sender, EventArgs e)
        {
            if (tbtbInvShow.Tag == null || !(tbtbInvShow.Tag is InventoryItem))
            {
                return;
            }

            InventoryItem item = (InventoryItem)tbtbInvShow.Tag;

            if (instance.TabConsole.TabExists("inventory"))
            {
                instance.TabConsole.SelectTab("inventory");
                InventoryConsole inv = (InventoryConsole)instance.TabConsole.Tabs["inventory"].Control;
                inv.SelectInventoryNode(item.UUID);
            }
        }
Exemple #3
0
        /// <summary>
        /// Create Tabs that only make sense when connected
        /// </summary>
        private void InitializeOnlineTabs()
        {
            METAboltTab tab = AddTab("friends", "Friends", new FriendsConsole(instance));

            tab.AllowClose  = false;
            tab.AllowDetach = true;
            tab.Visible     = false;

            tab             = AddTab("groups", "Groups", new GroupsConsole(instance));
            tab.AllowClose  = false;
            tab.AllowDetach = true;
            tab.Visible     = false;

            // Ugly workaround for a mono bug
            InventoryConsole inv = new InventoryConsole(instance);

            if (instance.MonoRuntime)
            {
                inv.invTree.Scrollable = false;
            }
            tab = AddTab("inventory", "Inventory", inv);
            if (instance.MonoRuntime)
            {
                inv.invTree.Scrollable = true;
            }
            tab.AllowClose  = false;
            tab.AllowDetach = true;
            tab.Visible     = false;

            tab             = AddTab("search", "Search", new SearchConsole(instance));
            tab.AllowClose  = false;
            tab.AllowDetach = true;
            tab.Visible     = false;

            tab             = AddTab("map", "Map", new MapConsole(instance));
            tab.AllowClose  = false;
            tab.AllowDetach = true;
            tab.Visible     = false;

            tab             = AddTab("voice", "Voice", new VoiceConsole(instance));
            tab.AllowClose  = false;
            tab.AllowDetach = true;
            tab.Visible     = false;
        }
Exemple #4
0
        bool CanExportTexture(UUID id, out string name)
        {
            name = id.ToString();
            if (BuiltInTextures.Contains(id) || Instance.Netcom.LoginOptions.Grid.Platform != "SecondLife")
            {
                return(true);
            }

            InventoryItem item = null;

            foreach (var pair in Client.Inventory.Store.Items)
            {
                if (pair.Value.Data is InventoryItem)
                {
                    var i = (InventoryItem)pair.Value.Data;
                    if (i.AssetUUID == id && (InventoryConsole.IsFullPerm(i) || Instance.advancedDebugging))
                    {
                        item = i;
                        break;
                    }
                }
            }

            if (item != null)
            {
                name = item.Name;
                return(true);
            }
            else if (Instance.advancedDebugging)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
        private void InitializeInventoryTab()
        {
            if (InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    InitializeInventoryTab();
                }));

                return;
            }

            InventoryConsole invConsole = new InventoryConsole(instance);

            invConsole.Dock = DockStyle.Fill;
            invConsole.Visible = false;

            toolStripContainer1.ContentPanel.Controls.Add(invConsole);

            METAboltTab tab = AddTab("inventory", "Inventory", invConsole);
            tab.AllowClose = false;
            tab.AllowDetach = true;

            ToolStripItem item = new ToolStripSeparator();

            tstTabs.Items.Add(item);
        }
Exemple #6
0
        void Assets_OnAssetReceived(AssetDownload transfer, Asset asset)
        {
            if (InvokeRequired)
            {
                if (!instance.MonoRuntime || IsHandleCreated)
                {
                    BeginInvoke(new MethodInvoker(() => Assets_OnAssetReceived(transfer, asset)));
                }
                return;
            }

            if (transfer.Success)
            {
                AssetNotecard n = (AssetNotecard)asset;
                n.Decode();
                receivedNotecard = n;

                string noteText = string.Empty;
                rtbContent.Clear();

                for (int i = 0; i < n.BodyText.Length; i++)
                {
                    char c = n.BodyText[i];

                    if ((int)c == 0xdbc0)
                    {
                        int           index = (int)n.BodyText[++i] - 0xdc00;
                        InventoryItem e     = n.EmbeddedItems[index];
                        rtbContent.AppendText(noteText);
                        rtbContent.InsertLink(e.Name, string.Format("metabolt://embeddedasset/{0}", index));
                        noteText = string.Empty;
                    }
                    else
                    {
                        noteText += c;
                    }
                }

                rtbContent.Text += noteText;

                if (n.EmbeddedItems != null && n.EmbeddedItems.Count > 0)
                {
                    tbtnAttachments.Enabled = true;
                    tbtnAttachments.Visible = true;
                    foreach (InventoryItem item in n.EmbeddedItems)
                    {
                        int ix = InventoryConsole.GetItemImageIndex(item.AssetType.ToString().ToLower());
                        ToolStripMenuItem titem = new ToolStripMenuItem(item.Name);

                        if (ix != -1)
                        {
                            titem.Image        = frmMain.ResourceImages.Images[ix];
                            titem.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                        }
                        else
                        {
                            titem.DisplayStyle = ToolStripItemDisplayStyle.Text;
                        }

                        titem.Name   = item.UUID.ToString();;
                        titem.Tag    = item;
                        titem.Click += new EventHandler(attachmentMenuItem_Click);

                        var saveToInv = new ToolStripMenuItem("Save to inventory");
                        saveToInv.Click += (object xsender, EventArgs xe) =>
                        {
                            client.Inventory.RequestCopyItemFromNotecard(UUID.Zero,
                                                                         notecard.UUID,
                                                                         client.Inventory.FindFolderForType(item.AssetType),
                                                                         item.UUID,
                                                                         Inventory_OnInventoryItemCopied);
                        };

                        titem.DropDownItems.Add(saveToInv);
                        tbtnAttachments.DropDownItems.Add(titem);
                    }
                }
                UpdateStatus("OK");
                rtbContent.Focus();
            }
            else
            {
                UpdateStatus("Failed");
                rtbContent.Text = "Failed to download notecard. " + transfer.Status;
            }
        }
Exemple #7
0
        private void cmsImage_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = false;
            if (AllowUpdateImage)
            {
                tbtnClear.Visible = tbtnPaste.Visible = true;
                tbtnPaste.Enabled = false;
                if (instance.InventoryClipboard != null)
                {
                    if (instance.InventoryClipboard.Item is InventoryTexture ||
                        instance.InventoryClipboard.Item is InventorySnapshot)
                    {
                        tbtnPaste.Enabled = true;
                    }
                }
            }
            else
            {
                tbtnClear.Visible = tbtnPaste.Visible = false;
            }

            tbtbInvShow.Enabled = false;

            InventoryItem found = null;

            foreach (var traversed in client.Inventory.Store.Items.Values)
            {
                if (traversed.Data is InventoryItem)
                {
                    InventoryItem item = (InventoryItem)traversed.Data;
                    if (item.AssetUUID == imageID)
                    {
                        found = item;
                        break;
                    }
                }
            }

            bool save = allowSave;

            if (found == null)
            {
                tbtbInvShow.Enabled = false;
                tbtbInvShow.Tag     = null;
            }
            else
            {
                tbtbInvShow.Enabled = true;
                tbtbInvShow.Tag     = found;
                save |= InventoryConsole.IsFullPerm(found);
            }

            save |= instance.advancedDebugging;

            if (save)
            {
                tbtnCopy.Visible     = true;
                tbtnCopyUUID.Visible = true;
                tbtnSave.Visible     = true;
            }
            else
            {
                tbtnCopy.Visible     = false;
                tbtnCopyUUID.Visible = false;
                tbtnSave.Visible     = false;
            }
        }