private void startScanToolStripMenuItem_Click(object sender, EventArgs e) { string path = ME3Directory.cookedPath; string[] files = Directory.GetFiles(path, "*.pcc"); pb1.Maximum = files.Length; DebugOutput.Clear(); database = new List<DBEntry>(); int count = 0; foreach (string file in files) { pb1.Value = count++; DebugOutput.PrintLn("Scanning file : " + Path.GetFileName(file) + " ..."); PCCObject pcc = new PCCObject(file); DBEntry ent = new DBEntry(); ent.filename = Path.GetFileName(file); ent.Objects = new List<ObjInf>(); for (int i = 0; i < pcc.Exports.Count; i++) { PCCObject.ExportEntry ex = pcc.Exports[i]; ObjInf obj; switch (ex.ClassName) { case "StaticMesh": obj = new ObjInf(); obj.Index = i; obj.Type = 0; obj.name = ex.ObjectName; ent.Objects.Add(obj); break; case "SkeletalMesh": obj = new ObjInf(); obj.Index = i; obj.Type = 1; obj.name = ex.ObjectName; ent.Objects.Add(obj); break; } } if (ent.Objects.Count != 0) { DebugOutput.PrintLn("Found " + ent.Objects.Count + " Objects:", false); //foreach (ObjInf o in ent.Objects) // DebugOutput.PrintLn("\t" + o.Index + " : " + o.name + " (" + TypeToString(o.Type) + ")", false); //DebugOutput.Update(); database.Add(ent); } else { DebugOutput.PrintLn("Nothing...", false); } } RefreshLists(); pb1.Value = 0; }
private void loadDBToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.Filter = "*.db|*.db"; if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { FileStream fs = new FileStream(d.FileName, FileMode.Open, FileAccess.Read); int magic = ReadInt32(fs); if (magic != 0x12345678) { MessageBox.Show("Not a database!"); fs.Close(); return; } int count = ReadInt32(fs); database = new List <DBEntry>(); for (int i = 0; i < count; i++) { DBEntry en = new DBEntry(); en.filename = ReadString(fs); en.Objects = new List <ObjInf>(); int count2 = ReadInt32(fs); for (int j = 0; j < count2; j++) { ObjInf o = new ObjInf(); o.Index = ReadInt32(fs); o.Type = ReadInt32(fs); o.name = ReadString(fs); en.Objects.Add(o); } database.Add(en); } fs.Close(); RefreshLists(); MessageBox.Show("Done"); } }
private void startScanToolStripMenuItem_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, "*.pcc"); pb1.Maximum = files.Length; DebugOutput.Clear(); database = new List<DBEntry>(); int count = 0; foreach (string file in files) { pb1.Value = count++; DebugOutput.PrintLn("Scanning file : " + Path.GetFileName(file) + " ..."); try { using (ME3Package pcc = MEPackageHandler.OpenME3Package(file)) { DBEntry ent = new DBEntry(); ent.filename = Path.GetFileName(file); ent.Objects = new List<ObjInf>(); IReadOnlyList<IExportEntry> Exports = pcc.Exports; for (int i = 0; i < Exports.Count; i++) { IExportEntry ex = Exports[i]; ObjInf obj; switch (ex.ClassName) { case "StaticMesh": obj = new ObjInf(); obj.Index = i; obj.Type = 0; obj.name = ex.ObjectName; ent.Objects.Add(obj); break; case "SkeletalMesh": obj = new ObjInf(); obj.Index = i; obj.Type = 1; obj.name = ex.ObjectName; ent.Objects.Add(obj); break; } } if (ent.Objects.Count != 0) { DebugOutput.PrintLn("Found " + ent.Objects.Count + " Objects:", false); //foreach (ObjInf o in ent.Objects) // DebugOutput.PrintLn("\t" + o.Index + " : " + o.name + " (" + TypeToString(o.Type) + ")", false); //DebugOutput.Update(); database.Add(ent); } else { DebugOutput.PrintLn("Nothing...", false); } } } catch (Exception ex) { MessageBox.Show("Error:\n" + ex.Message); DebugOutput.PrintLn("Could not open file : " + Path.GetFileName(file)); } } RefreshLists(); pb1.Value = 0; }
private void loadDBToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.Filter = "*.db|*.db"; if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { FileStream fs = new FileStream(d.FileName, FileMode.Open, FileAccess.Read); int magic = ReadInt32(fs); if (magic != 0x12345678) { MessageBox.Show("Not a database!"); fs.Close(); return; } int count = ReadInt32(fs); database = new List<DBEntry>(); for (int i = 0; i < count; i++) { DBEntry en = new DBEntry(); en.filename = ReadString(fs); en.Objects = new List<ObjInf>(); int count2 = ReadInt32(fs); for (int j = 0; j < count2; j++) { ObjInf o = new ObjInf(); o.Index = ReadInt32(fs); o.Type = ReadInt32(fs); o.name = ReadString(fs); en.Objects.Add(o); } database.Add(en); } fs.Close(); RefreshLists(); MessageBox.Show("Done"); } }
private void startScanToolStripMenuItem_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, "*.pcc"); pb1.Maximum = files.Length; DebugOutput.Clear(); database = new List <DBEntry>(); int count = 0; foreach (string file in files) { pb1.Value = count++; DebugOutput.PrintLn("Scanning file : " + Path.GetFileName(file) + " ..."); try { using (ME3Package pcc = MEPackageHandler.OpenME3Package(file)) { DBEntry ent = new DBEntry(); ent.filename = Path.GetFileName(file); ent.Objects = new List <ObjInf>(); IReadOnlyList <IExportEntry> Exports = pcc.Exports; for (int i = 0; i < Exports.Count; i++) { IExportEntry ex = Exports[i]; ObjInf obj; switch (ex.ClassName) { case "StaticMesh": obj = new ObjInf(); obj.Index = i; obj.Type = 0; obj.name = ex.ObjectName; ent.Objects.Add(obj); break; case "SkeletalMesh": obj = new ObjInf(); obj.Index = i; obj.Type = 1; obj.name = ex.ObjectName; ent.Objects.Add(obj); break; } } if (ent.Objects.Count != 0) { DebugOutput.PrintLn("Found " + ent.Objects.Count + " Objects:", false); //foreach (ObjInf o in ent.Objects) // DebugOutput.PrintLn("\t" + o.Index + " : " + o.name + " (" + TypeToString(o.Type) + ")", false); //DebugOutput.Update(); database.Add(ent); } else { DebugOutput.PrintLn("Nothing...", false); } } } catch (Exception ex) { MessageBox.Show("Error:\n" + ex.Message); DebugOutput.PrintLn("Could not open file : " + Path.GetFileName(file)); } } RefreshLists(); pb1.Value = 0; }