entity.MapForms.MapForm.selectTag C# (CSharp) Method

selectTag() public method

Selects the current tag in the Treeview Listing (adds to quick list if not already ppresent) and loads the meta
public selectTag ( int tagNum ) : void
tagNum int The tag number to be selected and loaded
return void
        public void selectTag(int tagNum)
        {
            if (tagNum == -1)
            {
                return;
            }

            string tagType = map.MetaInfo.TagType[tagNum];
            string tagName = map.FileNames.Name[tagNum];

            addToQuickList(tagType, tagName);
            AddToHistory(tagNum);

            if (toolStripTagView.Checked)
            {
                // Check our quick list
                for (int count = 0; count < treeView1.Nodes.Count; count++)
                {
                    if (treeView1.Nodes[count].Text == tagType)
                    {
                        for (int count2 = 0; count2 < treeView1.Nodes[count].Nodes.Count; count2++)
                        {
                            if (treeView1.Nodes[count].Nodes[count2].Text == tagName)
                            {
                                treeView1.SelectedNode = treeView1.Nodes[count].Nodes[count2];
                                return;
                            }
                        }
                    }
                }

                // should never get here since we added tag to our list, but backup code anyways...
                // otherwise, check the main listing and put into out quick list
                for (int count = 0; count < treeView1.Nodes[0].Nodes.Count; count++)
                {
                    if (treeView1.Nodes[0].Nodes[count].Text == tagType)
                    {
                        for (int count2 = 0; count2 < treeView1.Nodes[0].Nodes[count].Nodes.Count; count2++)
                        {
                            if (treeView1.Nodes[0].Nodes[count].Nodes[count2].Text == tagName)
                            {
                                treeView1.SelectedNode = treeView1.Nodes[0].Nodes[count].Nodes[count2];
                                for (int count3 = 0; count3 < treeView1.Nodes.Count; count3++)
                                {
                                    if (treeView1.Nodes[count3].Text == tagType)
                                    {
                                        for (int count4 = 0; count4 < treeView1.Nodes[count3].Nodes.Count; count4++)
                                        {
                                            if (treeView1.Nodes[count3].Nodes[count4].Text == tagName)
                                            {
                                                treeView1.SelectedNode = treeView1.Nodes[count3].Nodes[count4];
                                                return;
                                            }
                                        }
                                    }
                                }

                                return;
                            }
                        }
                    }
                }
            }
            else if (toolStripFolderView.Checked)
            {
                Global.ShowErrorMsg("Jump to tag only supported in Tag View mode.", null);
            }
            else if (toolStripInfoView.Checked)
            {
                Global.ShowErrorMsg("Jump to tag only supported in Tag View mode.", null);
            }
        }
MapForm