Example #1
0
        public string DumpArray(ME3Package pcc, byte[] raw, int pos, int depth)
        {
            string res = "";
            List <PropertyReader.Property> p = PropertyReader.ReadProp(pcc, raw, pos);

            for (int i = 0; i < p.Count; i++)
            {
                if (p[i].TypeVal == PropertyType.StringRefProperty)
                {
                    for (int j = 0; j < depth; j++)
                    {
                        res += "\t";
                    }
                    res += i + " : " + PropertyReader.PropertyToText(p[i], pcc) + "\n";
                }
                if (p[i].TypeVal == PropertyType.ArrayProperty)
                {
                    //for (int j = 0; j < depth; j++)
                    //    res += "\t";
                    //res += "in Property #" + i + " : " + PropertyReader.PropertyToText(p[i], pcc) + "\n";
                    res += DumpArray(pcc, raw, p[i].offsetval + 4, depth + 1);
                }
                if (p[i].TypeVal == PropertyType.StructProperty)
                {
                    //for (int j = 0; j < depth; j++)
                    //    res += "\t";
                    //res += "in Property #" + i + " : " + PropertyReader.PropertyToText(p[i], pcc) + "\n";
                    res += DumpArray(pcc, raw, p[i].offsetval + 8, depth + 1);
                }
            }
            return(res);
        }
Example #2
0
        public void LetsDump()
        {
            pb1.Minimum = 0;
            pb1.Maximum = pcc.Exports.Count;
            rtb1.Text   = "";
            int    count = 0;
            string t     = "";

            for (int i = 0; i < pcc.Exports.Count; i++)
            {
                PCCObject.ExportEntry e = pcc.Exports[i];
                string s = "Properties for Object #" + i + " \"" + e.ObjectName + "\" :\n\n";
                List <PropertyReader.Property> p = PropertyReader.getPropList(pcc, e.Data);
                foreach (PropertyReader.Property prop in p)
                {
                    s += PropertyReader.PropertyToText(prop, pcc) + "\n";
                }
                s += "\n";
                t += s;
                if (count++ > 100)
                {
                    count       = 0;
                    pb1.Value   = i;
                    Status.Text = "State : " + i + " / " + pcc.Exports.Count;
                    Application.DoEvents();
                }
            }
            Status.Text          = "State : Done";
            rtb1.Text            = t;
            rtb1.SelectionStart  = rtb1.TextLength;
            rtb1.SelectionLength = 0;
            rtb1.ScrollToCaret();
            pb1.Value = 0;
        }
Example #3
0
 public void LetsDump(string path)
 {
     using (ME3Package pcc = MEPackageHandler.OpenME3Package(path))
     {
         pb1.Minimum = 0;
         IReadOnlyList <IExportEntry> Exports = pcc.Exports;
         pb1.Maximum = Exports.Count;
         rtb1.Text   = "";
         int    count = 0;
         string t     = "";
         for (int i = 0; i < Exports.Count; i++)
         {
             IExportEntry e = Exports[i];
             string       s = "Properties for Object #" + i + " \"" + e.ObjectName + "\" :\n\n";
             List <PropertyReader.Property> p = PropertyReader.getPropList(e);
             foreach (PropertyReader.Property prop in p)
             {
                 s += PropertyReader.PropertyToText(prop, pcc) + "\n";
             }
             s += "\n";
             t += s;
             if (count++ > 100)
             {
                 count       = 0;
                 pb1.Value   = i;
                 Status.Text = "State : " + i + " / " + Exports.Count;
                 Application.DoEvents();
             }
         }
         Status.Text          = "State : Done";
         rtb1.Text            = t;
         rtb1.SelectionStart  = rtb1.TextLength;
         rtb1.SelectionLength = 0;
         rtb1.ScrollToCaret();
         pb1.Value = 0;
     }
 }
Example #4
0
        private void makeDialogDumpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ME3Directory.cookedPath))
            {
                MessageBox.Show("This functionality requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3");
                return;
            }
            string path = ME3Directory.cookedPath;

            string[] files = Directory.GetFiles(path);
            pb1.Minimum = 0;
            rtb1.Text   = "";
            int    count  = 0;
            int    count2 = 0;
            string t      = "";

            pauseToolStripMenuItem.Visible = true;
            pb2.Value   = 0;
            pb2.Maximum = files.Length;
            for (int i = 0; i < files.Length; i++)
            {
                try
                {
                    if (files[i].ToLower().EndsWith(".pcc"))
                    {
                        while (pause)
                        {
                            Application.DoEvents();
                        }
                        using (ME3Package pcc = MEPackageHandler.OpenME3Package(files[i]))
                        {
                            IReadOnlyList <IExportEntry> Exports = pcc.Exports;
                            pb1.Maximum = Exports.Count;
                            pb2.Value   = i;
                            string s = "String references for file " + files[i] + "\n";
                            for (int j = 0; j < Exports.Count; j++)
                            {
                                IExportEntry ent = Exports[j];
                                List <PropertyReader.Property> p = PropertyReader.getPropList(ent);

                                for (int k = 0; k < p.Count; k++)
                                {
                                    PropertyReader.Property prop = p[k];
                                    if (prop.TypeVal == PropertyType.StringRefProperty)
                                    {
                                        s += "Object #" + j + " : " + PropertyReader.PropertyToText(prop, pcc) + "\n";
                                    }
                                    if (prop.TypeVal == PropertyType.ArrayProperty)
                                    {
                                        string tt = DumpArray(pcc, ent.Data, prop.offsetval + 4, 1);
                                        if (tt.Length != 0)
                                        {
                                            s += "Object #" + j + " in : " + PropertyReader.PropertyToText(prop, pcc) + "\n";
                                            s += tt;
                                        }
                                    }
                                    if (prop.TypeVal == PropertyType.StructProperty)
                                    {
                                        string tt = DumpArray(pcc, ent.Data, prop.offsetval + 8, 1);
                                        if (tt.Length != 0)
                                        {
                                            s += "Object #" + j + " in : " + PropertyReader.PropertyToText(prop, pcc) + "\n";
                                            s += tt;
                                        }
                                    }
                                }
                                if (count++ > 500)
                                {
                                    count       = 0;
                                    pb1.Value   = j;
                                    Status.Text = "State : " + j + " / " + Exports.Count;
                                    if (count2++ > 10)
                                    {
                                        count2              = 0;
                                        rtb1.Text           = t;
                                        rtb1.SelectionStart = rtb1.TextLength;
                                        rtb1.ScrollToCaret();
                                        rtb1.Visible = true;
                                    }
                                    Application.DoEvents();
                                }
                            }
                            t += s + "\n";
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error:\n" + ex.Message);
                }
            }
            Status.Text         = "State : Done";
            rtb1.Text           = t;
            rtb1.SelectionStart = rtb1.TextLength;
            rtb1.ScrollToCaret();
            pb1.Value = 0;
            pauseToolStripMenuItem.Visible = false;
        }