Exemple #1
0
 /// <summary>
 /// The Indices class
 /// </summary>
 /// <param name="meta">The controls meta data</param>
 /// <param name="iEntName">The identifying name of the meta string</param>
 /// <param name="map">The metas map file</param>
 /// <param name="iOffsetInChunk">The offset to the string in the memory stream</param>
 /// <param name="iValueType">The value type associated with the Indices
 /// <para>Available types are:</para>
 /// <para>��Byte, Short, UShort, Int, UInt, Float, Unknown</para></param>
 /// <param name="iIndex">The type of data that the value points to
 /// <para>Available types are:</para>
 /// <para>��Ident, StringID, Float, Short, UShort, Int, UInt, String32, UnicodeString64, String256, UnicodeString256</para></param>
 public Indices(Meta meta, string iEntName, Map map, int iOffsetInChunk, IFPIO.ObjectEnum iValueType, IFPIO.Index iIndex)
 {
     this.meta = meta;
     this.LineNumber = iIndex.lineNumber;
     this.Dock = DockStyle.Top;
     this.map = map;
     switch (iValueType)
     {
         case IFPIO.ObjectEnum.Byte:
             this.size = 1;
             break;
         case IFPIO.ObjectEnum.Short:
         case IFPIO.ObjectEnum.UShort:
             this.size = 2;
             break;
         case IFPIO.ObjectEnum.Int:
         case IFPIO.ObjectEnum.UInt:
         case IFPIO.ObjectEnum.Float:
         case IFPIO.ObjectEnum.Unknown:
             this.size = 4;
             break;
     }
     this.chunkOffset = iOffsetInChunk;
     this.EntName = iEntName;
     this._EntIndex = iIndex;
     this._IndicesList = new List<string>(0);
     #region Set Block Indice Reference Type
     switch (this._EntIndex.ItemType.ToLower())
     {
         case "ident":
             {
                 this._ItemType = IFPIO.ObjectEnum.Ident; // entity.MetaEditor.DataValues.ENTType.ident;
                 break;
             }
         case "stringid":
             {
                 this._ItemType = IFPIO.ObjectEnum.StringID; // entity.MetaEditor.DataValues.ENTType.sid;
                 break;
             }
         case "float":
             {
                 this._ItemType = IFPIO.ObjectEnum.Float; // entity.MetaEditor.DataValues.ENTType.Float;
                 break;
             }
         case "short":
             {
                 this._ItemType = IFPIO.ObjectEnum.Short; // entity.MetaEditor.DataValues.ENTType.Int16;
                 break;
             }
         case "ushort":
             {
                 this._ItemType = IFPIO.ObjectEnum.UShort; // entity.MetaEditor.DataValues.ENTType.Uint16;
                 break;
             }
         case "int":
             {
                 this._ItemType = IFPIO.ObjectEnum.Int; // entity.MetaEditor.DataValues.ENTType.Int32;
                 break;
             }
         case "uint":
             {
                 this._ItemType = IFPIO.ObjectEnum.UInt; // entity.MetaEditor.DataValues.ENTType.UInt32;
                 break;
             }
         case "string32":
             {
                 this._ItemType = IFPIO.ObjectEnum.String32; // entity.MetaEditor.DataValues.ENTType.string32;
                 break;
             }
         case "unicodestring64":
             {
                 this._ItemType = IFPIO.ObjectEnum.UnicodeString64; // entity.MetaEditor.DataValues.ENTType.unicodestring64;
                 break;
             }
         case "string256":
             {
                 this._ItemType = IFPIO.ObjectEnum.String256; // entity.MetaEditor.DataValues.ENTType.string256;
                 break;
             }
         case "unicodestring256":
             {
                 this._ItemType = IFPIO.ObjectEnum.UnicodeString256; // entity.MetaEditor.DataValues.ENTType.unicodestring64;
                 break;
             }
         default:
             {
                 this._ItemType = IFPIO.ObjectEnum.Unknown; // entity.MetaEditor.DataValues.ENTType.nothing;
                 break;
             }
     }
     #endregion
     InitializeComponent();
     switch (iValueType)
     {
         case IFPIO.ObjectEnum.Short:
             {
                 this.label1.Text = "Int16 Block Index";
                 this._ValueType = IFPIO.ObjectEnum.Short;
                 break;
             }
         case IFPIO.ObjectEnum.Int:
             {
                 this.label1.Text = "Int32 Block Index";
                 this._ValueType = IFPIO.ObjectEnum.Int;
                 break;
             }
         case IFPIO.ObjectEnum.UShort:
             {
                 this.label1.Text = "Uint16 Block Index";
                 this._ValueType = IFPIO.ObjectEnum.UShort;
                 break;
             }
         case IFPIO.ObjectEnum.UInt:
             {
                 this.label1.Text = "Uint32 Block Index";
                 this._ValueType = IFPIO.ObjectEnum.UInt;
                 break;
             }
         case IFPIO.ObjectEnum.Byte:
             {
                 this.label1.Text = "Byte Block Index";
                 this._ValueType = IFPIO.ObjectEnum.Byte;
                 break;
             }
     }
     this.label2.Text = this.EntName;
     if (this._EntIndex.reflexiveTagType + this._EntIndex.reflexiveTagName != string.Empty)
     {
         System.Windows.Forms.ToolTip toolTip1 = new ToolTip();
         toolTip1.IsBalloon = true;
         toolTip1.AutoPopDelay = 10000;
         toolTip1.SetToolTip(
             this.comboBox1,
             "Label located in [" + this._EntIndex.reflexiveTagType + "] " + this._EntIndex.reflexiveTagName);
     }
 }
Exemple #2
0
        // Not right yet, but getting there
        /// <summary>
        /// The comb type_ selection change committed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <remarks></remarks>
        private void combType_SelectionChangeCommitted(object sender, EventArgs e)
        {
            // ((IFPIO.BaseObject)this.buttGoTo.Tag).ObjectType = (IFPIO.ObjectEnum)System.Enum.Parse(typeof(IFPIO.ObjectEnum), this.combType.Text);
            int tempIndexer = (Int32)Enum.Parse(typeof(IFPIO.ObjectEnum), this.combType.Text);
            string name = ((IFPIO.BaseObject)this.buttGoTo.Tag).name;
            int offset = ((IFPIO.BaseObject)this.buttGoTo.Tag).offset;
            int lineNumber = ((IFPIO.BaseObject)this.buttGoTo.Tag).lineNumber;
            bool visible = ((IFPIO.BaseObject)this.buttGoTo.Tag).visible;
            int parent = ((IFPIO.BaseObject)this.buttGoTo.Tag).parent;
            int prevSibling = ((IFPIO.BaseObject)this.buttGoTo.Tag).siblingPrevious;
            this.HideEntControls();

            switch ((IFPIO.ObjectEnum)tempIndexer)
            {

                case IFPIO.ObjectEnum.Struct:
                    {
                        this.buttGoTo.Tag = new IFPIO.Reflexive(
                            lineNumber, offset, visible, name, string.Empty, string.Empty, null, 0, 0, false, parent, prevSibling);
                        this.radbReflexiveHCTrue.Checked = ((IFPIO.Reflexive)this.buttGoTo.Tag).HasCount;
                        this.radbReflexiveHCFalse.Checked = !((IFPIO.Reflexive)this.buttGoTo.Tag).HasCount;
                        this.txtbReflexiveChunkSize.Text = ((IFPIO.Reflexive)this.buttGoTo.Tag).chunkSize.ToString();
                        this.LoadReflexiveLabel(
                            ((IFPIO.Reflexive)this.buttGoTo.Tag).child, ((IFPIO.Reflexive)this.buttGoTo.Tag).label);
                        this.panReflexiveContainer.Show();
                        break;
                    }

                #region Strings

                case IFPIO.ObjectEnum.String32:
                case IFPIO.ObjectEnum.String256:
                case IFPIO.ObjectEnum.UnicodeString64:
                case IFPIO.ObjectEnum.UnicodeString256:
                    {
                        bool unicode = false;
                        int ifpSize = 256;
                        switch ((IFPIO.ObjectEnum)tempIndexer)
                        {
                            case IFPIO.ObjectEnum.String32:
                                {
                                    ifpSize = 32;
                                    break;
                                }

                            case IFPIO.ObjectEnum.String256:
                                {
                                    ifpSize = 256;
                                    break;
                                }

                            case IFPIO.ObjectEnum.UnicodeString64:
                                {
                                    ifpSize = 64;
                                    unicode = true;
                                    break;
                                }

                            case IFPIO.ObjectEnum.UnicodeString256:
                                {
                                    ifpSize = 256;
                                    unicode = true;
                                    break;
                                }
                        }

                        this.buttGoTo.Tag = new IFPIO.IFPString(
                            name, string.Empty, visible, offset, ifpSize, unicode, lineNumber, parent, prevSibling);
                        this.radbStringString.Checked = !((IFPIO.IFPString)this.buttGoTo.Tag).type;
                        this.radbStringUnicode.Checked = ((IFPIO.IFPString)this.buttGoTo.Tag).type;
                        this.combStringSize.Text = ((IFPIO.IFPString)this.buttGoTo.Tag).size.ToString();
                        this.panStringContainer.Show();
                        break;
                    }

                #endregion

                #region Ints and Bytes

                case IFPIO.ObjectEnum.Float:
                    {
                        this.buttGoTo.Tag = new IFPIO.IFPFloat(offset, visible, name, "", lineNumber, parent, prevSibling);
                        break;
                    }

                case IFPIO.ObjectEnum.Byte:
                case IFPIO.ObjectEnum.Short:
                case IFPIO.ObjectEnum.UShort:
                case IFPIO.ObjectEnum.UInt:
                case IFPIO.ObjectEnum.Int:
                    {
                        IFPIO.Index Index = new IFPIO.Index(
                            string.Empty, string.Empty, string.Empty, ((IFPIO.BaseObject)this.buttGoTo.Tag).ObjectType.ToString(), string.Empty, lineNumber);
                        this.buttGoTo.Tag = new IFPIO.IFPInt(
                            offset,
                            (IFPIO.ObjectEnum)tempIndexer,
                            visible,
                            name,
                            string.Empty,
                            Index,
                            lineNumber,
                            parent,
                            prevSibling);
                        this.panIndices.Show();
                        if (((IFPIO.IFPInt)this.buttGoTo.Tag).entIndex.nulled)
                        {
                            this.indicesEnable(false);
                        }
                        else
                        {
                            this.indicesEnable(true);
                            this.LoadIndices(((IFPIO.IFPInt)this.buttGoTo.Tag).entIndex);
                        }

                        break;
                    }

                #endregion

                #region Bitmasks

                case IFPIO.ObjectEnum.Byte_Flags:
                case IFPIO.ObjectEnum.Word_Flags:
                case IFPIO.ObjectEnum.Long_Flags:
                    {
                        this.buttGoTo.Tag = new IFPIO.Bitmask(
                            offset, visible, name, "", null, 0, lineNumber, parent, prevSibling);
                        this.panBitmask.Show();
                        this.BitmaskLoadBitNames();
                        break;
                    }

                #endregion

                #region Enums

                case IFPIO.ObjectEnum.Char_Enum:
                case IFPIO.ObjectEnum.Enum:
                case IFPIO.ObjectEnum.Long_Enum:
                    {
                        this.buttGoTo.Tag = new IFPIO.IFPEnum(
                            offset, visible, name, "", null, 0, lineNumber, parent, prevSibling);
                        this.panEnums.Show();

                        // this.EnumLoadItemNames();
                        break;
                    }

                #endregion
            }
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Indices"/> class.
        /// </summary>
        /// <param name="iEntName">
        /// The i ent name.
        /// </param>
        /// <param name="map">
        /// The map.
        /// </param>
        /// <param name="iOffsetInChunk">
        /// The i offset in chunk.
        /// </param>
        /// <param name="iValueType">
        /// The i value type.
        /// </param>
        /// <param name="iIndex">
        /// The i index.
        /// </param>
        public Indices(string iEntName, Map map, int iOffsetInChunk, IFPIO.ObjectEnum iValueType, IFPIO.Index iIndex)
        {
            this.LineNumber = iIndex.lineNumber;
            this.Dock = DockStyle.Top;
            this.map = map;
            this.chunkOffset = iOffsetInChunk;
            this.EntName = iEntName;
            this.EntIndex = iIndex;
            this.tempvalue = new List<string>(0);

            switch (this.EntIndex.ItemType.ToLower())
            {
                case "ident":
                    {
                        this.ItemType = IFPIO.ObjectEnum.Ident; // Entity.MetaEditor.DataValues.ENTType.ident;
                        break;
                    }

                case "stringid":
                    {
                        this.ItemType = IFPIO.ObjectEnum.StringID; // Entity.MetaEditor.DataValues.ENTType.sid;
                        break;
                    }

                case "float":
                    {
                        this.ItemType = IFPIO.ObjectEnum.Float; // Entity.MetaEditor.DataValues.ENTType.Float;
                        break;
                    }

                case "short":
                    {
                        this.ItemType = IFPIO.ObjectEnum.Short; // Entity.MetaEditor.DataValues.ENTType.Int16;
                        break;
                    }

                case "ushort":
                    {
                        this.ItemType = IFPIO.ObjectEnum.UShort; // Entity.MetaEditor.DataValues.ENTType.Uint16;
                        break;
                    }

                case "int":
                    {
                        this.ItemType = IFPIO.ObjectEnum.Int; // Entity.MetaEditor.DataValues.ENTType.Int32;
                        break;
                    }

                case "uint":
                    {
                        this.ItemType = IFPIO.ObjectEnum.UInt; // Entity.MetaEditor.DataValues.ENTType.UInt32;
                        break;
                    }

                case "string32":
                    {
                        this.ItemType = IFPIO.ObjectEnum.String32;

                        // Entity.MetaEditor.DataValues.ENTType.string32;
                        break;
                    }

                case "unicodestring64":
                    {
                        this.ItemType = IFPIO.ObjectEnum.UnicodeString64;

                        // Entity.MetaEditor.DataValues.ENTType.unicodestring64;
                        break;
                    }

                case "string256":
                    {
                        this.ItemType = IFPIO.ObjectEnum.String256;

                        // Entity.MetaEditor.DataValues.ENTType.string256;
                        break;
                    }

                case "unicodestring256":
                    {
                        goto case "string256";
                    }

                default:
                    {
                        this.ItemType = IFPIO.ObjectEnum.Unknown;

                        // Entity.MetaEditor.DataValues.ENTType.nothing;
                        break;
                    }
            }

            InitializeComponent();
            switch (iValueType)
            {
                case IFPIO.ObjectEnum.Short:
                    {
                        this.label1.Text = "Int16 Block Index";
                        this.ValueType = IFPIO.ObjectEnum.Short;
                        break;
                    }

                case IFPIO.ObjectEnum.Int:
                    {
                        this.label1.Text = "Int32 Block Index";
                        this.ValueType = IFPIO.ObjectEnum.Int;
                        break;
                    }

                case IFPIO.ObjectEnum.UShort:
                    {
                        this.label1.Text = "Uint16 Block Index";
                        this.ValueType = IFPIO.ObjectEnum.UShort;
                        break;
                    }

                case IFPIO.ObjectEnum.UInt:
                    {
                        this.label1.Text = "Uint32 Block Index";
                        this.ValueType = IFPIO.ObjectEnum.UInt;
                        break;
                    }

                case IFPIO.ObjectEnum.Byte:
                    {
                        this.label1.Text = "Byte Block Index";
                        this.ValueType = IFPIO.ObjectEnum.Byte;
                        break;
                    }
            }

            this.label2.Text = this.EntName;
            this.Enter += Indices_Enter;
            this.Leave += Indices_Leave;
        }