Ejemplo n.º 1
0
        private void getNameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string result = Microsoft.VisualBasic.Interaction.InputBox("Enter number of name (hex is fine too)", "Get Name", "", 0, 0);

            if (String.IsNullOrEmpty(result))
            {
                return;
            }

            if (result.Length <= 2 || (result[0] != '0' && result[0] != 'x'))
            {
                // regular int
                int val;
                try
                {
                    val = Convert.ToInt32(result);
                }
                catch
                {
                    return;
                }
                if (val < 0 || val > pcc.NameCount)
                {
                    return;
                }

                MessageBox.Show(pcc.GetName(val));
            }
            else
            {
                // hex input
                int val;
                try
                {
                    val = Convert.ToInt32(result.Substring(2), 16);
                }
                catch
                {
                    return;
                }
                if (val < 0 || val > pcc.NameCount)
                {
                    return;
                }
                MessageBox.Show(pcc.GetName(val));
            }
        }
Ejemplo n.º 2
0
        private void openPccToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.pcc|*.pcc";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                pcc         = new PCCObject(d.FileName);
                CurrentView = 2;
                classes     = new List <int>();
                foreach (PCCObject.ExportEntry ent in pcc.Exports)
                {
                    int f = -1;
                    for (int i = 0; i < classes.Count(); i++)
                    {
                        if (classes[i] == ent.ClassNameID)
                        {
                            f = i;
                        }
                    }
                    if (f == -1)
                    {
                        classes.Add(ent.ClassNameID);
                    }
                }
                bool run = true;
                while (run)
                {
                    run = false;
                    for (int i = 0; i < classes.Count() - 1; i++)
                    {
                        if (pcc.GetName(classes[i]).CompareTo(pcc.GetName(classes[i + 1])) > 0)
                        {
                            int t = classes[i];
                            classes[i]     = classes[i + 1];
                            classes[i + 1] = t;
                            run            = true;
                        }
                    }
                }
                RefreshView();
            }
        }
Ejemplo n.º 3
0
 private void openPccToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     OpenFileDialog d = new OpenFileDialog();
     d.Filter = "*.pcc|*.pcc";
     if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         pcc = new PCCObject(d.FileName);
         CurrentView = 2;
         classes = new List<int>();
         foreach (PCCObject.ExportEntry ent in pcc.Exports)
         {
             int f = -1;
             for (int i = 0; i < classes.Count(); i++)
                 if (classes[i] == ent.ClassNameID)
                     f = i;
             if (f == -1)
                 classes.Add(ent.ClassNameID);
         }
         bool run = true;
         while (run)
         {
             run = false;
             for (int i = 0; i < classes.Count() - 1; i++)
                 if (pcc.GetName(classes[i]).CompareTo(pcc.GetName(classes[i + 1])) > 0)
                 {
                     int t = classes[i];
                     classes[i] = classes[i + 1];
                     classes[i + 1] = t;
                     run = true;
                 }
         }
         RefreshView();
     }
 }
Ejemplo n.º 4
0
        private void addObjectsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CurrentObjects == null)
            {
                return;
            }
            string result = Microsoft.VisualBasic.Interaction.InputBox("Please enter object index", "ME2Explorer");

            if (result == "")
            {
                return;
            }
            int i;

            if (int.TryParse(result, out i))
            {
                if (i < pcc.Exports.Count)
                {
                    if (!CurrentObjects.Contains(i))
                    {
                        byte[]      buff     = pcc.Exports[SequenceIndex].Data;
                        List <byte> ListBuff = new List <byte>(buff);
                        BitConverter.IsLittleEndian = true;
                        List <PropertyReader.Property> p = PropertyReader.getPropList(pcc, buff);
                        for (int j = 0; j < p.Count(); j++)
                        {
                            if (pcc.GetName(p[j].Name) == "SequenceObjects")
                            {
                                int    count     = BitConverter.ToInt32(p[j].raw, 24);
                                byte[] sizebuff  = BitConverter.GetBytes(BitConverter.ToInt32(p[j].raw, 16) + 4);
                                byte[] countbuff = BitConverter.GetBytes(count + 1);
                                for (int k = 0; k < 4; k++)
                                {
                                    ListBuff[p[j].offsetval - 8 + k] = sizebuff[k];
                                    ListBuff[p[j].offsetval + k]     = countbuff[k];
                                }
                                ListBuff.InsertRange(p[j].offsetval + 4 + count * 4, BitConverter.GetBytes(i + 1));
                                pcc.Exports[SequenceIndex].Data = ListBuff.ToArray();
                                SaveData s = new SaveData();
                                s.index = i;
                                s.X     = graphEditor.Camera.Bounds.X + graphEditor.Camera.Bounds.Width / 2;
                                s.Y     = graphEditor.Camera.Bounds.Y + graphEditor.Camera.Bounds.Height / 2;
                                List <SaveData> list = new List <SaveData>();
                                list.Add(s);
                                saveView(false, list);
                                LoadSequence(SequenceIndex, false);
                                break;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(i + " is already in the sequence.");
                    }
                }
                else
                {
                    MessageBox.Show(i + " is not in the export list.");
                }
            }
            else
            {
                MessageBox.Show(result + " is not an integer.");
            }
        }