/// <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(); }