示例#1
0
        private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            int m = listBox2.SelectedIndex;

            if (m == -1)
            {
                return;
            }
            UPropertyReader.Property p = UPR.Definitions[n].props[m];
            string s   = "";
            int    pos = 0;

            for (int i = 0; i < p.Meta.Count; i++)
            {
                s += pos.ToString("X") + "\t";
                switch (p.Meta[i].size)
                {
                case 1:
                    s += " 8 bit 1 byte :";
                    break;

                case 2:
                    s += "16 bit 2 byte :";
                    break;

                case 4:
                    s += "32 bit 4 byte :";
                    break;
                }
                pos += p.Meta[i].size;
                switch (p.Meta[i].type)
                {
                case 0:
                    s += "Integer\n";
                    break;

                case 1:
                    s += "Float\n";
                    break;

                case 2:
                    s += "Name\n";
                    break;

                case 3:
                    s += "Ignore\n";
                    break;
                }
            }
            rtb1.Text = s;
        }
示例#2
0
        private void addPropertyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            string propname = Microsoft.VisualBasic.Interaction.InputBox("Please enter the name of the new Property", "ME3 Explorer", "", 0, 0);

            if (propname == "")
            {
                return;
            }
            string counts = Microsoft.VisualBasic.Interaction.InputBox("Please enter the count of Elemets it will contain", "ME3 Explorer", "0", 0, 0);

            if (counts == "")
            {
                return;
            }
            int count = Convert.ToInt32(counts);
            List <UPropertyReader.PropertyMeta> tMeta = new List <UPropertyReader.PropertyMeta>();

            if (count < 0 || count > 100)
            {
                return;
            }
            for (int i = 0; i < count; i++)
            {
                UPropertyReader.PropertyMeta t = new UPropertyReader.PropertyMeta();
                string sizes = Microsoft.VisualBasic.Interaction.InputBox("What size has element #" + i + "? (1,2 or 4 bytes)", "ME3 Explorer", "4", 0, 0);
                if (sizes == "")
                {
                    return;
                }
                int size = Convert.ToInt32(sizes);
                if (size != 1 && size != 2 && size != 4)
                {
                    return;
                }
                t.size = size;
                string types = Microsoft.VisualBasic.Interaction.InputBox("What type has element #" + i + "? \n(0=Value, 1=Float, 2=Name, 3=Ignore)", "ME3 Explorer", "", 0, 0);
                if (types == "")
                {
                    return;
                }
                int type = Convert.ToInt32(types);
                if (type < 0 || type > 3)
                {
                    return;
                }
                t.type = type;
                if (type == 1 && size == 1)
                {
                    return;
                }
                tMeta.Add(t);
            }
            UPropertyReader.Property p = new UPropertyReader.Property();
            p.name = propname;
            p.Meta = tMeta;
            UPR.AddProp(UPR.Definitions[n].name, p);
            MessageBox.Show("Done.");
            RefreshView(n);
        }