예제 #1
0
            /// <summary>
            /// The button 1_ click.
            /// </summary>
            /// <param name="sender">The sender.</param>
            /// <param name="e">The e.</param>
            /// <remarks></remarks>
            private void button1_Click(object sender, EventArgs e)
            {
                ControlSwapper parent = (ControlSwapper)this.Parent.Parent.Parent;

                // Add selected control
                IFPIO.Option[] options = null;
                //int strLength = 0;
                Control con = null;
                switch (((dataTypeStruct)comboBox1.SelectedItem).name.ToLower())
                {
                    /*
                    parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Byte, parent.lineNum));
                    parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Short, parent.lineNum));
                    parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Int, parent.lineNum));
                    parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Float, parent.lineNum));
                */
                    case "byte":
                    case "short":
                    case "ushort":
                    case "int":
                    case "uint":
                    case "float":
                    case "unknown":
                    case "unused":
                        con = new DataValues(
                            parent.name,
                            null,
                            parent.chunkoffset,
                            (IFPIO.ObjectEnum)
                            Enum.Parse(typeof(IFPIO.ObjectEnum), ((dataTypeStruct)comboBox1.SelectedItem).name, true),
                            parent.lineNum);
                        break;
                    case "char_enum":
                    case "enum":
                    case "long_enum":
                        options = new IFPIO.Option[((dataTypeStruct)comboBox1.SelectedItem).size << 3];

                        // Size * 8 bits
                        for (int x = 0; x < options.Length; x++)
                        {
                            options[x] = new IFPIO.Option("Bit " + x, x.ToString(), parent.lineNum);
                        }

                        if (parent.splitContainer1.Panel1.Controls[0] is Bitmask)
                        {
                            Bitmask b = (Bitmask)parent.splitContainer1.Panel1.Controls[0];
                            foreach (IFPIO.Option o in b.Options)
                            {
                                if (o.value < options.Length)
                                {
                                    options[o.value].name = o.name;
                                }
                            }
                        }

                        ;
                        if (parent.splitContainer1.Panel1.Controls[0] is Enums)
                        {
                            Enums en = (Enums)parent.splitContainer1.Panel1.Controls[0];
                            foreach (IFPIO.Option o in en.Options)
                            {
                                if (o.value < options.Length)
                                {
                                    options[o.value].name = o.name;
                                }
                            }
                        }

                        ;
                        con = new Enums(parent.name, null, parent.chunkoffset, options.Length, options, parent.lineNum);
                        break;
                    case "byte_flags":
                    case "word_flags":
                    case "long_flags":
                        options = new IFPIO.Option[((dataTypeStruct)comboBox1.SelectedItem).size << 3];

                        // Size * 8 bits
                        for (int x = 0; x < options.Length; x++)
                        {
                            options[x] = new IFPIO.Option("Bit " + x, x.ToString(), parent.lineNum);
                        }

                        if (parent.splitContainer1.Panel1.Controls[0] is Bitmask)
                        {
                            Bitmask b = (Bitmask)parent.splitContainer1.Panel1.Controls[0];
                            foreach (IFPIO.Option o in b.Options)
                            {
                                options[o.value].name = o.name;
                            }
                        }

                        ;
                        if (parent.splitContainer1.Panel1.Controls[0] is Enums)
                        {
                            Enums en = (Enums)parent.splitContainer1.Panel1.Controls[0];
                            foreach (IFPIO.Option o in en.Options)
                            {
                                options[o.value].name = o.name;
                            }
                        }

                        ;
                        con = new Bitmask(
                            parent.name, null, parent.chunkoffset, options.Length, options, parent.lineNum);
                        break;
                    case "stringid":
                        con = new SID(parent.name, null, parent.chunkoffset, parent.lineNum);
                        break;
                    case "string":
                        con = new EntStrings(
                            parent.name,
                            null,
                            parent.chunkoffset,
                            ((dataTypeStruct)comboBox1.SelectedItem).size,
                            false,
                            parent.lineNum);
                        break;
                    case "unicodestring":
                        con = new EntStrings(
                            parent.name,
                            null,
                            parent.chunkoffset,
                            ((dataTypeStruct)comboBox1.SelectedItem).size,
                            true,
                            parent.lineNum);
                        break;
                    case "block":
                        con = new TagBlock(parent.name, null, parent.chunkoffset, parent.lineNum);
                        break;
                    case "ident":
                        con = new Ident(parent.name, null, parent.chunkoffset, true, parent.lineNum);
                        break;
                    case "struct":

                        // Unhandled
                        //int ifkdn = 0;
                        break;
                    default:
                        {
                            return;
                        }
                }

                Button but = new Button();
                but.Dock = DockStyle.Right;
                but.Size = new Size(30, 30);
                but.Text = "-";
                but.Click += but_Click;

                if (con != null)
                {
                    con.Controls.Add(but);

                    // con.Enabled = false;
                    con.Dock = DockStyle.Top;
                    Point loc = con.Controls[con.Controls.Count - 2].Location;
                    loc.X -= 50;
                    con.Controls[con.Controls.Count - 2].Location = loc;

                    // con.TabIndex--;
                    parent.splitContainer1.Panel2.Controls.Add(con);
                    con.BringToFront();
                    ((ControlSwapper)this.TopLevelControl).newControlSize +=
                        ((ControlSwapper)this.TopLevelControl).getSizeOf(((dataTypeStruct)comboBox1.SelectedItem).name);
                    if (((ControlSwapper)this.TopLevelControl).label1.Text.Contains(" :: "))
                    {
                        ((ControlSwapper)this.TopLevelControl).label1.Text =
                            ((ControlSwapper)this.TopLevelControl).label1.Text.Remove(
                                ((ControlSwapper)this.TopLevelControl).label1.Text.IndexOf(" :: "));
                    }

                    ((ControlSwapper)this.TopLevelControl).label1.Text += " :: New Control Size : " +
                                                                          ((ControlSwapper)this.TopLevelControl).
                                                                              newControlSize;
                }

                parent.splitContainer1.Panel2.Controls[parent.splitContainer1.Panel2.Controls.IndexOf(this)].
                    BringToFront();
                parent.splitContainer1.Panel2.Controls[parent.splitContainer1.Panel2.Controls.IndexOf(this)].TabIndex++;
            }
예제 #2
0
        /// <summary>
        /// The load ent controls.
        /// </summary>
        /// <param name="entArray">The ent array.</param>
        /// <remarks></remarks>
        private void LoadENTControls(object[] entArray)
        {
            this.selectedTagType = map.SelectedMeta.type;

            this.toolStripTagType.Text = "[" + this.selectedTagType + "]";
            this.toolStripTagName.Text = map.SelectedMeta.name;

            // this.Padding = new Padding(10);
            int colorSpaceCount = 4;

            // Custom Plugins access
            //ra = new RegistryAccess(
            //    Registry.CurrentUser,
            //    RegistryAccess.RegPaths.Halo2CustomPlugins + pluginName + "\\" + this.selectedTagType);
            //if (pluginName == null)
            //{
            //    ra.CloseReg();
            //}

            if (entArray != null)
                foreach (object o in entArray)
                {
                    IFPIO.BaseObject tempbase = (IFPIO.BaseObject)o;
                    if (tempbase.visible == false)
                    {
                        if (ShowInvisibles == false)
                        {
                            continue;
                        }
                    }

                    // skip hidden custom plugins variables (mark reflexives to be removed if empty)
                    bool skipEmptyReflex = false;
                    //if (ra.isOpen && ra.getValue(tempbase.offset.ToString()) == bool.FalseString)
                    //{
                    //    if (tempbase.ObjectType == IFPIO.ObjectEnum.Struct)
                    //    {
                    //        skipEmptyReflex = true;
                    //    }
                    //    else
                    //    {
                    //        continue;
                    //    }
                    //}

                    switch (tempbase.ObjectType)
                    {
                        case IFPIO.ObjectEnum.Struct:
                            {
                                if (ShowReflexives == false)
                                {
                                    break;
                                }

                                // tempLabel is a blank space located above reflexives
                                Label tempLabel = new Label();
                                tempLabel.AutoSize = true;
                                tempLabel.Location = new Point(0, 0);
                                tempLabel.Name = "label1";
                                tempLabel.Dock = DockStyle.Top;
                                tempLabel.Size = new Size(35, 13);
                                tempLabel.TabIndex = tabIndex;

                                // tempReflexive is the reflexive and all data (incl other reflexives) within it
                                ReflexiveControl tempReflexive = new ReflexiveControl(
                                    map,
                                    map.SelectedMeta.offset,
                                    ((IFPIO.Reflexive)tempbase).HasCount,
                                    tempbase.lineNumber,
                                    this);

                                // tempReflexive.Location = new System.Drawing.Point(10, 0);
                                tempReflexive.Name = "reflexive";
                                tempReflexive.TabIndex = tabIndex;
                                tempReflexive.LoadENTControls(
                                    (IFPIO.Reflexive)tempbase,
                                    ((IFPIO.Reflexive)tempbase).items,
                                    true,
                                    0,
                                    ref tabIndex,
                                    tempbase.offset.ToString());

                                // Label, Combobox & Button are always added ( = 3)
                                if (!(tempReflexive.Controls.Count <= 2 && skipEmptyReflex))
                                {
                                    this.Controls[0].Controls.Add(tempLabel);
                                    tempLabel.BringToFront();
                                    this.Controls[0].Controls.Add(tempReflexive);
                                    tempReflexive.BringToFront();
                                }

                                break;
                            }

                        case IFPIO.ObjectEnum.Ident:
                            {
                                if (ShowIdents == false)
                                {
                                    break;
                                }

                                Ident tempident = new Ident(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    ((IFPIO.Ident)tempbase).hasTagType,
                                    tempbase.lineNumber);
                                tempident.Name = "ident";
                                tempident.TabIndex = tabIndex;
                                tempident.Populate(map.SelectedMeta.offset);
                                tempident.Tag = "[" + tempident.Controls[2].Text + "] " + tempident.Controls[1].Text;
                                tempident.Controls[1].ContextMenuStrip = identContext;
                                this.Controls[0].Controls.Add(tempident);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.StringID:
                            {
                                if (ShowSIDs == false)
                                {
                                    break;
                                }

                                SID tempSID = new SID(tempbase.name, map, tempbase.offset, tempbase.lineNumber);
                                tempSID.Name = "sid";
                                tempSID.TabIndex = tabIndex;
                                tempSID.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempSID);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.Float:
                            {
                                if (ShowFloats == false)
                                {
                                    break;
                                }

                                DataValues tempFloat = new DataValues(
                                    tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Float, tempbase.lineNumber);
                                tempFloat.TabIndex = tabIndex;
                                tempFloat.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempFloat);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.String32:
                            {
                                if (ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32)
                                {
                                    break;
                                }

                                EntStrings tempstring = new EntStrings(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    ((IFPIO.IFPString)tempbase).size,
                                    ((IFPIO.IFPString)tempbase).type,
                                    tempbase.lineNumber);
                                tempstring.Name = "string";
                                tempstring.TabIndex = tabIndex;
                                tempstring.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempstring);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.UnicodeString256:
                            {
                                if (ShowUnicodeString256s == false)
                                {
                                    break;
                                }

                                goto case IFPIO.ObjectEnum.String32;
                            }

                        case IFPIO.ObjectEnum.String256:
                            {
                                if (ShowString256s == false)
                                {
                                    break;
                                }

                                goto case IFPIO.ObjectEnum.String32;
                            }

                        case IFPIO.ObjectEnum.UnicodeString64:
                            {
                                if (ShowUnicodeString64s == false)
                                {
                                    break;
                                }

                                goto case IFPIO.ObjectEnum.String32;
                            }

                        case IFPIO.ObjectEnum.String:
                            {
                                if (ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32)
                                {
                                    break;
                                }

                                EntStrings tempstring = new EntStrings(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    ((IFPIO.IFPString)tempbase).size,
                                    ((IFPIO.IFPString)tempbase).type,
                                    tempbase.lineNumber);
                                tempstring.Name = "string";
                                tempstring.TabIndex = tabIndex;
                                tempstring.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempstring);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.Int:
                            {
                                if (((IFPIO.IFPInt)tempbase).entIndex.nulled)
                                {
                                    if ((ShowInts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Int) ||
                                        (ShowShorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Short) ||
                                        (ShowUshorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.UShort) ||
                                        (ShowUints == false && tempbase.ObjectType == IFPIO.ObjectEnum.UInt))
                                    {
                                        break;
                                    }

                                    DataValues tempdatavalues = new DataValues(
                                        tempbase.name, map, tempbase.offset, tempbase.ObjectType, tempbase.lineNumber);
                                    tempdatavalues.TabIndex = tabIndex;
                                    tempdatavalues.Populate(map.SelectedMeta.offset);
                                    this.Controls[0].Controls.Add(tempdatavalues);
                                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                }
                                else
                                {
                                    if ((ShowBlockIndex32s == false &&
                                         (tempbase.ObjectType == IFPIO.ObjectEnum.Int |
                                          tempbase.ObjectType == IFPIO.ObjectEnum.UInt)) ||
                                        (ShowBlockIndex16s == false &&
                                         (tempbase.ObjectType == IFPIO.ObjectEnum.Short |
                                          tempbase.ObjectType == IFPIO.ObjectEnum.UShort)) ||
                                        (ShowBlockIndex8s == false && tempbase.ObjectType == IFPIO.ObjectEnum.Byte))
                                    {
                                        break;
                                    }

                                    Indices tempdatavalues = new Indices(
                                        tempbase.name,
                                        map,
                                        tempbase.offset,
                                        tempbase.ObjectType,
                                        ((IFPIO.IFPInt)tempbase).entIndex);
                                    tempdatavalues.TabIndex = tabIndex;
                                    this.Controls[0].Controls.Add(tempdatavalues);
                                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                }

                                break;
                            }

                        case IFPIO.ObjectEnum.Short:
                            {
                                goto case IFPIO.ObjectEnum.Int;
                            }

                        case IFPIO.ObjectEnum.UShort:
                            {
                                goto case IFPIO.ObjectEnum.Int;
                            }

                        case IFPIO.ObjectEnum.UInt:
                            {
                                goto case IFPIO.ObjectEnum.Int;
                            }

                        case IFPIO.ObjectEnum.Unknown:
                            {
                                if (ShowUndefineds == false)
                                {
                                    break;
                                }

                                DataValues tempUnknown = new DataValues(
                                    tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Unknown, tempbase.lineNumber);
                                tempUnknown.TabIndex = tabIndex;
                                tempUnknown.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempUnknown);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.Byte_Flags:
                            {
                                if (ShowBitmask8s == false)
                                {
                                    break;
                                }

                                Bitmask tempbitmask = new Bitmask(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    ((IFPIO.Bitmask)tempbase).bitmaskSize,
                                    ((IFPIO.Bitmask)tempbase).options,
                                    tempbase.lineNumber);
                                tempbitmask.TabIndex = tabIndex;
                                tempbitmask.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempbitmask);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.Word_Flags:
                            {
                                if (ShowBitmask16s == false)
                                {
                                    break;
                                }

                                Bitmask tempbitmask = new Bitmask(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    ((IFPIO.Bitmask)tempbase).bitmaskSize,
                                    ((IFPIO.Bitmask)tempbase).options,
                                    tempbase.lineNumber);
                                tempbitmask.TabIndex = tabIndex;
                                tempbitmask.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempbitmask);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.Long_Flags:
                            {
                                if (ShowBitmask32s == false)
                                {
                                    break;
                                }

                                Bitmask tempbitmask = new Bitmask(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    ((IFPIO.Bitmask)tempbase).bitmaskSize,
                                    ((IFPIO.Bitmask)tempbase).options,
                                    tempbase.lineNumber);
                                tempbitmask.TabIndex = tabIndex;
                                tempbitmask.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempbitmask);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.Char_Enum:
                            {
                                if (ShowEnum8s == false)
                                {
                                    break;
                                }

                                Enums tempenum = new Enums(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    ((IFPIO.IFPEnum)tempbase).enumSize,
                                    ((IFPIO.IFPEnum)tempbase).options,
                                    tempbase.lineNumber);
                                tempenum.TabIndex = tabIndex;
                                tempenum.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempenum);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.Enum:
                            {
                                if (ShowEnum16s == false)
                                {
                                    break;
                                }

                                Enums tempenum = new Enums(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    ((IFPIO.IFPEnum)tempbase).enumSize,
                                    ((IFPIO.IFPEnum)tempbase).options,
                                    tempbase.lineNumber);
                                tempenum.TabIndex = tabIndex;
                                tempenum.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempenum);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.Long_Enum:
                            {
                                if (ShowEnum32s == false)
                                {
                                    break;
                                }

                                Enums tempenum = new Enums(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    ((IFPIO.IFPEnum)tempbase).enumSize,
                                    ((IFPIO.IFPEnum)tempbase).options,
                                    tempbase.lineNumber);
                                tempenum.TabIndex = tabIndex;
                                tempenum.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempenum);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.Byte:
                            {
                                if (((IFPIO.IFPByte)tempbase).entIndex.nulled)
                                {
                                    if (ShowBytes == false)
                                    {
                                        break;
                                    }

                                    DataValues tempByte = new DataValues(
                                        tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Byte, tempbase.lineNumber);
                                    tempByte.TabIndex = tabIndex;
                                    this.Controls[0].Controls.Add(tempByte);
                                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                }
                                else
                                {
                                    if (ShowBlockIndex8s == false)
                                    {
                                        break;
                                    }

                                    Indices tempdatavalues = new Indices(
                                        tempbase.name,
                                        map,
                                        tempbase.offset,
                                        tempbase.ObjectType,
                                        ((IFPIO.IFPByte)tempbase).entIndex);
                                    tempdatavalues.TabIndex = tabIndex;
                                    this.Controls[0].Controls.Add(tempdatavalues);
                                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                }

                                break;
                            }

                        case IFPIO.ObjectEnum.Unused:
                            {
                                DataValues tempUnknown = new DataValues(
                                    tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Unused, tempbase.lineNumber);
                                tempUnknown.TabIndex = tabIndex;
                                tempUnknown.Populate(map.SelectedMeta.offset);
                                this.Controls[0].Controls.Add(tempUnknown);
                                this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                                break;
                            }

                        case IFPIO.ObjectEnum.TagType:
                            continue;
                    }

                    if (!(tempbase is IFPIO.Reflexive))
                    {
                        ToolTip1.SetToolTip(this.Controls[0].Controls[0].Controls[0], "offset: " + tempbase.offset);
                    }

                    if (this.Controls[0].Controls.Count > 0 && this.Controls[0].Controls[0] is DataValues)
                    {
                        // if (((tempbase.name.ToLower().Contains(" a") & tempbase.name[tempbase.name.ToLower().IndexOf(" a")]) ||
                        // tempbase.name.ToLower().Contains("alpha"))& alphaControl == null)
                        if (ColorWheel.checkForColor(tempbase.name, alphaControl, " a", "alpha"))
                        {
                            alphaControl = (DataValues)this.Controls[0].Controls[0];
                            colorSpaceCount = 0;
                        }

                            // if (tempbase.name.ToLower().Contains(" r") & redControl == null)
                        else if (ColorWheel.checkForColor(tempbase.name, redControl, " r", "red"))
                        {
                            redControl = (DataValues)this.Controls[0].Controls[0];
                            colorSpaceCount = 0;
                        }

                            // if (tempbase.name.ToLower().Contains(" g") & greenControl == null)
                        else if (ColorWheel.checkForColor(tempbase.name, greenControl, " g", "green"))
                        {
                            greenControl = (DataValues)this.Controls[0].Controls[0];
                            colorSpaceCount = 0;
                        }

                            // if (tempbase.name.ToLower().Contains(" b") & blueControl == null)
                        else if (ColorWheel.checkForColor(tempbase.name, blueControl, " b", "blue"))
                        {
                            blueControl = (DataValues)this.Controls[0].Controls[0];
                            colorSpaceCount = 0;
                        }
                        else
                        {
                            colorSpaceCount++;
                            if (colorSpaceCount == 1)
                            {
                                alphaControl = null;
                                redControl = null;
                                greenControl = null;
                                blueControl = null;
                            }
                        }

                        if (redControl != null & greenControl != null & blueControl != null)
                        {
                            // Create the new ColorWheel class, indicating
                            // the locations of the color wheel itself, the
                            // brightness area, and the position of the selected color.
                            ColorWheel cw = new ColorWheel();

                            if (alphaControl != null)
                            {
                                cw.setTextBox(alphaControl.textBox1, Color.White);
                            }

                            cw.setTextBox(redControl.textBox1, Color.Red);
                            cw.setTextBox(greenControl.textBox1, Color.Green);
                            cw.setTextBox(blueControl.textBox1, Color.Blue);

                            // p.I.AddRange(new Rectangle[] { SelectedColorRectangle });
                            cw.Dock = DockStyle.Top;
                            this.Controls[0].Controls.Add(cw);
                            this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();

                            // Reset for next batch
                            colorSpaceCount++;
                            alphaControl = null;
                            redControl = null;
                            greenControl = null;
                            blueControl = null;
                        }
                    }
                    else
                    {
                        colorSpaceCount++;
                    }

                    tabIndex++;
                }

            //ra.CloseReg();
        }
예제 #3
0
            /// <summary>
            /// The button 1_ click.
            /// </summary>
            /// <param name="sender">The sender.</param>
            /// <param name="e">The e.</param>
            /// <remarks></remarks>
            private void button1_Click(object sender, EventArgs e)
            {
                ControlSwapper parent = (ControlSwapper)this.Parent.Parent.Parent;

                // Add selected control
                IFPIO.Option[] options = null;
                //int strLength = 0;
                Control con = null;

                switch (((dataTypeStruct)comboBox1.SelectedItem).name.ToLower())
                {
                /*
                 * parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Byte, parent.lineNum));
                 * parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Short, parent.lineNum));
                 * parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Int, parent.lineNum));
                 * parent.splitContainer1.Panel2.Controls.Add(new DataValues(parent.name, null, parent.chunkoffset, IFPIO.ObjectEnum.Float, parent.lineNum));
                 */
                case "byte":
                case "short":
                case "ushort":
                case "int":
                case "uint":
                case "float":
                case "unknown":
                case "unused":
                    con = new DataValues(
                        parent.name,
                        null,
                        parent.chunkoffset,
                        (IFPIO.ObjectEnum)
                        Enum.Parse(typeof(IFPIO.ObjectEnum), ((dataTypeStruct)comboBox1.SelectedItem).name, true),
                        parent.lineNum);
                    break;

                case "char_enum":
                case "enum":
                case "long_enum":
                    options = new IFPIO.Option[((dataTypeStruct)comboBox1.SelectedItem).size << 3];

                    // Size * 8 bits
                    for (int x = 0; x < options.Length; x++)
                    {
                        options[x] = new IFPIO.Option("Bit " + x, x.ToString(), parent.lineNum);
                    }

                    if (parent.splitContainer1.Panel1.Controls[0] is Bitmask)
                    {
                        Bitmask b = (Bitmask)parent.splitContainer1.Panel1.Controls[0];
                        foreach (IFPIO.Option o in b.Options)
                        {
                            if (o.value < options.Length)
                            {
                                options[o.value].name = o.name;
                            }
                        }
                    }

                    ;
                    if (parent.splitContainer1.Panel1.Controls[0] is Enums)
                    {
                        Enums en = (Enums)parent.splitContainer1.Panel1.Controls[0];
                        foreach (IFPIO.Option o in en.Options)
                        {
                            if (o.value < options.Length)
                            {
                                options[o.value].name = o.name;
                            }
                        }
                    }

                    ;
                    con = new Enums(parent.name, null, parent.chunkoffset, options.Length, options, parent.lineNum);
                    break;

                case "byte_flags":
                case "word_flags":
                case "long_flags":
                    options = new IFPIO.Option[((dataTypeStruct)comboBox1.SelectedItem).size << 3];

                    // Size * 8 bits
                    for (int x = 0; x < options.Length; x++)
                    {
                        options[x] = new IFPIO.Option("Bit " + x, x.ToString(), parent.lineNum);
                    }

                    if (parent.splitContainer1.Panel1.Controls[0] is Bitmask)
                    {
                        Bitmask b = (Bitmask)parent.splitContainer1.Panel1.Controls[0];
                        foreach (IFPIO.Option o in b.Options)
                        {
                            options[o.value].name = o.name;
                        }
                    }

                    ;
                    if (parent.splitContainer1.Panel1.Controls[0] is Enums)
                    {
                        Enums en = (Enums)parent.splitContainer1.Panel1.Controls[0];
                        foreach (IFPIO.Option o in en.Options)
                        {
                            options[o.value].name = o.name;
                        }
                    }

                    ;
                    con = new Bitmask(
                        parent.name, null, parent.chunkoffset, options.Length, options, parent.lineNum);
                    break;

                case "stringid":
                    con = new SID(parent.name, null, parent.chunkoffset, parent.lineNum);
                    break;

                case "string":
                    con = new EntStrings(
                        parent.name,
                        null,
                        parent.chunkoffset,
                        ((dataTypeStruct)comboBox1.SelectedItem).size,
                        false,
                        parent.lineNum);
                    break;

                case "unicodestring":
                    con = new EntStrings(
                        parent.name,
                        null,
                        parent.chunkoffset,
                        ((dataTypeStruct)comboBox1.SelectedItem).size,
                        true,
                        parent.lineNum);
                    break;

                case "block":
                    con = new TagBlock(parent.name, null, parent.chunkoffset, parent.lineNum);
                    break;

                case "ident":
                    con = new Ident(parent.name, null, parent.chunkoffset, true, parent.lineNum);
                    break;

                case "struct":

                    // Unhandled
                    //int ifkdn = 0;
                    break;

                default:
                {
                    return;
                }
                }

                Button but = new Button();

                but.Dock   = DockStyle.Right;
                but.Size   = new Size(30, 30);
                but.Text   = "-";
                but.Click += but_Click;

                if (con != null)
                {
                    con.Controls.Add(but);

                    // con.Enabled = false;
                    con.Dock = DockStyle.Top;
                    Point loc = con.Controls[con.Controls.Count - 2].Location;
                    loc.X -= 50;
                    con.Controls[con.Controls.Count - 2].Location = loc;

                    // con.TabIndex--;
                    parent.splitContainer1.Panel2.Controls.Add(con);
                    con.BringToFront();
                    ((ControlSwapper)this.TopLevelControl).newControlSize +=
                        ((ControlSwapper)this.TopLevelControl).getSizeOf(((dataTypeStruct)comboBox1.SelectedItem).name);
                    if (((ControlSwapper)this.TopLevelControl).label1.Text.Contains(" :: "))
                    {
                        ((ControlSwapper)this.TopLevelControl).label1.Text =
                            ((ControlSwapper)this.TopLevelControl).label1.Text.Remove(
                                ((ControlSwapper)this.TopLevelControl).label1.Text.IndexOf(" :: "));
                    }

                    ((ControlSwapper)this.TopLevelControl).label1.Text += " :: New Control Size : " +
                                                                          ((ControlSwapper)this.TopLevelControl).
                                                                          newControlSize;
                }

                parent.splitContainer1.Panel2.Controls[parent.splitContainer1.Panel2.Controls.IndexOf(this)].
                BringToFront();
                parent.splitContainer1.Panel2.Controls[parent.splitContainer1.Panel2.Controls.IndexOf(this)].TabIndex++;
            }
예제 #4
0
        private void LoadENTControls(object[] entArray)
        {
            this.selectedTagType = Maps.map[mapIndex].SelectedMeta.type;

            this.toolStripTagType.Text = "[" + this.selectedTagType.ToString() + "]";
            this.toolStripTagName.Text = Maps.map[mapIndex].SelectedMeta.name;
            //this.Padding = new Padding(10);
            int colorSpaceCount = 4;

            // Custom Plugins access
            ra = new RegistryAccess(Microsoft.Win32.Registry.CurrentUser, RegistryAccess.RegPaths.Halo2CustomPlugins + pluginName + "\\" + this.selectedTagType);
            if (pluginName == null)
            {
                ra.CloseReg();
            }

            foreach (object o in entArray)
            {
                IFPIO.BaseObject tempbase = (IFPIO.BaseObject)o;
                if (tempbase.visible == false)
                {
                    if (Meta_Editor.MetaEditor.ShowInvisibles == false)
                    {
                        continue;
                    }
                }

                // skip hidden custom plugins variables (mark reflexives to be removed if empty)
                bool skipEmptyReflex = false;
                if (ra.isOpen && ra.getValue(tempbase.offset.ToString()) == bool.FalseString)
                {
                    if (tempbase.ObjectType == IFPIO.ObjectEnum.Struct)
                    {
                        skipEmptyReflex = true;
                    }
                    else
                    {
                        continue;
                    }
                }


                switch (tempbase.ObjectType)
                {
                case IFPIO.ObjectEnum.Struct:
                {
                    if (Meta_Editor.MetaEditor.ShowReflexives == false)
                    {
                        break;
                    }
                    // tempLabel is a blank space located above reflexives
                    Label tempLabel = new Label();
                    tempLabel.AutoSize = true;
                    tempLabel.Location = new System.Drawing.Point(0, 0);
                    tempLabel.Name     = "label1";
                    tempLabel.Dock     = DockStyle.Top;
                    tempLabel.Size     = new System.Drawing.Size(35, 13);
                    tempLabel.TabIndex = tabIndex;

                    // tempReflexive is the reflexive and all data (incl other reflexives) within it
                    ReflexiveControl tempReflexive = new ReflexiveControl(mapIndex, Maps.map[mapIndex].SelectedMeta.offset, ((IFPIO.Reflexive)tempbase).HasCount, tempbase.lineNumber, this);
                    //tempReflexive.Location = new System.Drawing.Point(10, 0);
                    tempReflexive.Name     = "reflexive";
                    tempReflexive.TabIndex = tabIndex;
                    tempReflexive.LoadENTControls((IFPIO.Reflexive)tempbase, ((IFPIO.Reflexive)tempbase).items,
                                                  true, 0, ref tabIndex, tempbase.offset.ToString());

                    // Label, Combobox & Button are always added ( = 3)
                    if (!(tempReflexive.Controls.Count <= 2 && skipEmptyReflex))
                    {
                        this.Controls[0].Controls.Add(tempLabel);
                        this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                        this.Controls[0].Controls.Add(tempReflexive);
                        this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    }
                    break;
                }

                case IFPIO.ObjectEnum.Ident:
                {
                    if (Meta_Editor.MetaEditor.ShowIdents == false)
                    {
                        break;
                    }
                    Ident tempident = new Ident(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.Ident)tempbase).hasTagType, tempbase.lineNumber);
                    tempident.Name     = "ident";
                    tempident.TabIndex = tabIndex;
                    tempident.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    tempident.Tag = "[" + tempident.Controls[2].Text + "] "
                                    + tempident.Controls[1].Text;
                    tempident.Controls[1].ContextMenuStrip = identContext;
                    this.Controls[0].Controls.Add(tempident);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.StringID:
                {
                    if (Meta_Editor.MetaEditor.ShowSIDs == false)
                    {
                        break;
                    }
                    SID tempSID = new SID(tempbase.name, mapIndex, tempbase.offset, tempbase.lineNumber);
                    tempSID.Name     = "sid";
                    tempSID.TabIndex = tabIndex;
                    tempSID.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempSID);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.Float:
                {
                    if (Meta_Editor.MetaEditor.ShowFloats == false)
                    {
                        break;
                    }
                    DataValues tempFloat = new DataValues(tempbase.name, mapIndex, tempbase.offset, IFPIO.ObjectEnum.Float, tempbase.lineNumber);
                    tempFloat.TabIndex = tabIndex;
                    tempFloat.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempFloat);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.String32:
                {
                    if (Meta_Editor.MetaEditor.ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32)
                    {
                        break;
                    }
                    EntStrings tempstring = new EntStrings(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPString)tempbase).size, ((IFPIO.IFPString)tempbase).type, tempbase.lineNumber);
                    tempstring.Name     = "string";
                    tempstring.TabIndex = tabIndex;
                    tempstring.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempstring);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.UnicodeString256:
                {
                    if (Meta_Editor.MetaEditor.ShowUnicodeString256s == false)
                    {
                        break;
                    }
                    goto case IFPIO.ObjectEnum.String32;
                }

                case IFPIO.ObjectEnum.String256:
                {
                    if (Meta_Editor.MetaEditor.ShowString256s == false)
                    {
                        break;
                    }
                    goto case IFPIO.ObjectEnum.String32;
                }

                case IFPIO.ObjectEnum.UnicodeString64:
                {
                    if (Meta_Editor.MetaEditor.ShowUnicodeString64s == false)
                    {
                        break;
                    }
                    goto case IFPIO.ObjectEnum.String32;
                }

                case IFPIO.ObjectEnum.String:
                {
                    if (Meta_Editor.MetaEditor.ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32)
                    {
                        break;
                    }
                    EntStrings tempstring = new EntStrings(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPString)tempbase).size, ((IFPIO.IFPString)tempbase).type, tempbase.lineNumber);
                    tempstring.Name     = "string";
                    tempstring.TabIndex = tabIndex;
                    tempstring.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempstring);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.Int:
                {
                    if (((IFPIO.IFPInt)tempbase).entIndex.nulled == true)
                    {
                        if ((Meta_Editor.MetaEditor.ShowInts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Int) ||
                            (Meta_Editor.MetaEditor.ShowShorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Short) ||
                            (Meta_Editor.MetaEditor.ShowUshorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.UShort) ||
                            (Meta_Editor.MetaEditor.ShowUints == false && tempbase.ObjectType == IFPIO.ObjectEnum.UInt))
                        {
                            break;
                        }
                        DataValues tempdatavalues = new DataValues(tempbase.name, mapIndex, tempbase.offset, tempbase.ObjectType, tempbase.lineNumber);
                        tempdatavalues.TabIndex = tabIndex;
                        tempdatavalues.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                        this.Controls[0].Controls.Add(tempdatavalues);
                        this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    }
                    else
                    {
                        if ((Meta_Editor.MetaEditor.ShowBlockIndex32s == false && (tempbase.ObjectType == IFPIO.ObjectEnum.Int | tempbase.ObjectType == IFPIO.ObjectEnum.UInt)) ||
                            (Meta_Editor.MetaEditor.ShowBlockIndex16s == false && (tempbase.ObjectType == IFPIO.ObjectEnum.Short | tempbase.ObjectType == IFPIO.ObjectEnum.UShort)) ||
                            (Meta_Editor.MetaEditor.ShowBlockIndex8s == false && tempbase.ObjectType == IFPIO.ObjectEnum.Byte))
                        {
                            break;
                        }
                        Indices tempdatavalues = new Indices(tempbase.name, mapIndex, tempbase.offset, tempbase.ObjectType, ((IFPIO.IFPInt)tempbase).entIndex);
                        tempdatavalues.TabIndex = tabIndex;
                        this.Controls[0].Controls.Add(tempdatavalues);
                        this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    }
                    break;
                }

                case IFPIO.ObjectEnum.Short:
                {
                    goto case IFPIO.ObjectEnum.Int;
                }

                case IFPIO.ObjectEnum.UShort:
                {
                    goto case IFPIO.ObjectEnum.Int;
                }

                case IFPIO.ObjectEnum.UInt:
                {
                    goto case IFPIO.ObjectEnum.Int;
                }

                case IFPIO.ObjectEnum.Unknown:
                {
                    if (Meta_Editor.MetaEditor.ShowUndefineds == false)
                    {
                        break;
                    }
                    DataValues tempUnknown = new DataValues(tempbase.name, mapIndex, tempbase.offset, IFPIO.ObjectEnum.Unknown, tempbase.lineNumber);
                    tempUnknown.TabIndex = tabIndex;
                    tempUnknown.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempUnknown);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.Byte_Flags:
                {
                    if (Meta_Editor.MetaEditor.ShowBitmask8s == false)
                    {
                        break;
                    }
                    Bitmask tempbitmask = new Bitmask(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber);
                    tempbitmask.TabIndex = tabIndex;
                    tempbitmask.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempbitmask);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.Word_Flags:
                {
                    if (Meta_Editor.MetaEditor.ShowBitmask16s == false)
                    {
                        break;
                    }
                    Bitmask tempbitmask = new Bitmask(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber);
                    tempbitmask.TabIndex = tabIndex;
                    tempbitmask.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempbitmask);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.Long_Flags:
                {
                    if (Meta_Editor.MetaEditor.ShowBitmask32s == false)
                    {
                        break;
                    }
                    Bitmask tempbitmask = new Bitmask(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber);
                    tempbitmask.TabIndex = tabIndex;
                    tempbitmask.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempbitmask);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.Char_Enum:
                {
                    if (Meta_Editor.MetaEditor.ShowEnum8s == false)
                    {
                        break;
                    }
                    Enums tempenum = new Enums(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber);
                    tempenum.TabIndex = tabIndex;
                    tempenum.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempenum);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.Enum:
                {
                    if (Meta_Editor.MetaEditor.ShowEnum16s == false)
                    {
                        break;
                    }
                    Enums tempenum = new Enums(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber);
                    tempenum.TabIndex = tabIndex;
                    tempenum.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempenum);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.Long_Enum:
                {
                    if (Meta_Editor.MetaEditor.ShowEnum32s == false)
                    {
                        break;
                    }
                    Enums tempenum = new Enums(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber);
                    tempenum.TabIndex = tabIndex;
                    tempenum.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempenum);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.Byte:
                {
                    if (((IFPIO.IFPByte)tempbase).entIndex.nulled == true)
                    {
                        if (Meta_Editor.MetaEditor.ShowBytes == false)
                        {
                            break;
                        }
                        DataValues tempByte = new DataValues(tempbase.name, mapIndex, tempbase.offset, IFPIO.ObjectEnum.Byte, tempbase.lineNumber);
                        tempByte.TabIndex = tabIndex;
                        this.Controls[0].Controls.Add(tempByte);
                        this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    }
                    else
                    {
                        if (Meta_Editor.MetaEditor.ShowBlockIndex8s == false)
                        {
                            break;
                        }
                        Indices tempdatavalues = new Indices(tempbase.name, mapIndex, tempbase.offset, tempbase.ObjectType, ((IFPIO.IFPByte)tempbase).entIndex);
                        tempdatavalues.TabIndex = tabIndex;
                        this.Controls[0].Controls.Add(tempdatavalues);
                        this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    }
                    break;
                }

                case IFPIO.ObjectEnum.Unused:
                {
                    DataValues tempUnknown = new DataValues(tempbase.name, mapIndex, tempbase.offset, IFPIO.ObjectEnum.Unused, tempbase.lineNumber);
                    tempUnknown.TabIndex = tabIndex;
                    tempUnknown.Populate(Maps.map[mapIndex].SelectedMeta.offset);
                    this.Controls[0].Controls.Add(tempUnknown);
                    this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                    break;
                }

                case IFPIO.ObjectEnum.TagType:
                    continue;
                    break;
                }

                if (!(tempbase is IFPIO.Reflexive))
                {
                    ToolTip1.SetToolTip(this.Controls[0].Controls[0].Controls[0], "offset: " + tempbase.offset.ToString());
                }

                if (this.Controls[0].Controls.Count > 0 && this.Controls[0].Controls[0] is DataValues)
                {
                    //if (((tempbase.name.ToLower().Contains(" a") & tempbase.name[tempbase.name.ToLower().IndexOf(" a")]) ||
                    //     tempbase.name.ToLower().Contains("alpha"))& alphaControl == null)
                    if (ColorWheel.checkForColor(tempbase.name, alphaControl, " a", "alpha"))
                    {
                        alphaControl    = (DataValues)this.Controls[0].Controls[0];
                        colorSpaceCount = 0;
                    }
                    //if (tempbase.name.ToLower().Contains(" r") & redControl == null)
                    else if (ColorWheel.checkForColor(tempbase.name, redControl, " r", "red"))
                    {
                        redControl      = (DataValues)this.Controls[0].Controls[0];
                        colorSpaceCount = 0;
                    }
                    //if (tempbase.name.ToLower().Contains(" g") & greenControl == null)
                    else if (ColorWheel.checkForColor(tempbase.name, greenControl, " g", "green"))
                    {
                        greenControl    = (DataValues)this.Controls[0].Controls[0];
                        colorSpaceCount = 0;
                    }
                    //if (tempbase.name.ToLower().Contains(" b") & blueControl == null)
                    else if (ColorWheel.checkForColor(tempbase.name, blueControl, " b", "blue"))
                    {
                        blueControl     = (DataValues)this.Controls[0].Controls[0];
                        colorSpaceCount = 0;
                    }
                    else
                    {
                        colorSpaceCount++;
                        if (colorSpaceCount == 1)
                        {
                            alphaControl = null;
                            redControl   = null;
                            greenControl = null;
                            blueControl  = null;
                        }
                    }
                    if (redControl != null & greenControl != null & blueControl != null)
                    {
                        // Create the new ColorWheel class, indicating
                        // the locations of the color wheel itself, the
                        // brightness area, and the position of the selected color.
                        ColorWheel cw = new ColorWheel();

                        if (alphaControl != null)
                        {
                            cw.setTextBox(alphaControl.textBox1, Color.White);
                        }
                        cw.setTextBox(redControl.textBox1, Color.Red);
                        cw.setTextBox(greenControl.textBox1, Color.Green);
                        cw.setTextBox(blueControl.textBox1, Color.Blue);

                        //p.I.AddRange(new Rectangle[] { SelectedColorRectangle });
                        cw.Dock = DockStyle.Top;
                        this.Controls[0].Controls.Add(cw);
                        this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront();
                        // Reset for next batch
                        colorSpaceCount++;
                        alphaControl = null;
                        redControl   = null;
                        greenControl = null;
                        blueControl  = null;
                    }
                }
                else
                {
                    colorSpaceCount++;
                }
                tabIndex++;
            }
            ra.CloseReg();
        }