private void startScanToolStripMenuItem_Click(object sender, EventArgs e) { string pathcook = ME3Directory.cookedPath; DebugOutput.StartDebugger("ScriptDB"); string[] files = Directory.GetFiles(pathcook, "*.pcc"); int count = 1; database = new List<ScriptEntry>(); foreach (string file in files) { DebugOutput.PrintLn(count + "\\" + files.Length + " : Scanning " + Path.GetFileName(file) + " ..."); PCCObject pcc = new PCCObject(file); int count2 = 0; foreach (PCCObject.ExportEntry ent in pcc.Exports) { if (ent.ClassName == "Function") { Function f = new Function(ent.Data, pcc); ScriptEntry n = new ScriptEntry(); n.file = Path.GetFileName(file); n.name = ent.PackageFullName + "." + ent.ObjectName; n.script = f.ToRawText(false); database.Add(n); DebugOutput.PrintLn("\tFound \"" + n.name + "\"",false); } count2++; } { pb1.Maximum = files.Length; pb1.Value = count; } count++; } RefreshList(); }
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 pathcook = ME3Directory.cookedPath; DebugOutput.StartDebugger("ScriptDB"); string[] files = Directory.GetFiles(pathcook, "*.pcc"); int count = 1; database = new List<ScriptEntry>(); foreach (string file in files) { DebugOutput.PrintLn(count + "\\" + files.Length + " : Scanning " + Path.GetFileName(file) + " ..."); try { using (ME3Package pcc = MEPackageHandler.OpenME3Package(file)) { int count2 = 0; foreach (IExportEntry ent in pcc.Exports) { if (ent.ClassName == "Function") { Function f = new Function(ent.Data, pcc); ScriptEntry n = new ScriptEntry(); n.file = Path.GetFileName(file); n.name = ent.PackageFullName + "." + ent.ObjectName; n.script = f.ToRawText(false); database.Add(n); DebugOutput.PrintLn("\tFound \"" + n.name + "\"", false); } count2++; } } } catch (Exception ex) { MessageBox.Show("Error:\n" + ex.Message); DebugOutput.PrintLn("Could not open file: " + Path.GetFileName(file)); } { pb1.Maximum = files.Length; pb1.Value = count; } count++; } RefreshList(); }
public void Preview(bool isRefresh = false) { int n; if (!GetSelected(out n)) { return; } if (CurrentView == View.Imports || CurrentView == View.Exports || CurrentView == View.Tree) { tabControl1_SelectedIndexChanged(null, null); PreviewInfo(n); RefreshMetaData(); //export if (n >= 0) { PreviewProps(n); if (!tabControl1.TabPages.ContainsKey(nameof(propertiesTab))) { tabControl1.TabPages.Insert(0, propertiesTab); } if (!tabControl1.TabPages.ContainsKey(nameof(interpreterTab))) { tabControl1.TabPages.Insert(1, interpreterTab); } IExportEntry exportEntry = pcc.getExport(n); if (exportEntry.ClassName == "Function" && pcc.Game != MEGame.ME2) { if (!tabControl1.TabPages.ContainsKey(nameof(scriptTab))) { tabControl1.TabPages.Add(scriptTab); } if (pcc.Game == MEGame.ME3) { Function func = new Function(exportEntry.Data, pcc as ME3Package); rtb1.Text = func.ToRawText(); } else { ME1Explorer.Unreal.Classes.Function func = new ME1Explorer.Unreal.Classes.Function(exportEntry.Data, pcc as ME1Package); rtb1.Text = func.ToRawText(); } } else if (tabControl1.TabPages.ContainsKey(nameof(scriptTab))) { tabControl1.TabPages.Remove(scriptTab); } hb2.ByteProvider = new DynamicByteProvider(exportEntry.header); if (!isRefresh) { interpreterControl.export = exportEntry; interpreterControl.InitInterpreter(); } UpdateStatusEx(n); } //import else { n = -n - 1; hb2.ByteProvider = new DynamicByteProvider(pcc.getImport(n).header); UpdateStatusIm(n); if (tabControl1.TabPages.ContainsKey(nameof(interpreterTab))) { tabControl1.TabPages.Remove(interpreterTab); } if (tabControl1.TabPages.ContainsKey(nameof(propertiesTab))) { tabControl1.TabPages.Remove(propertiesTab); } if (tabControl1.TabPages.ContainsKey(nameof(scriptTab))) { tabControl1.TabPages.Remove(scriptTab); } } } }
public void PreviewSript() { int n = GetSelected(); if (n == -1 || !(CurrentView == 2 || CurrentView == 3)) return; //propGrid.Visible = false; //hb1.Visible = false; //rtb1.Visible = true; //treeView1.Visible = false; if (pcc.Exports[n].ClassName == "Function") { Function func = new Function(pcc.Exports[n].Data, pcc); rtb1.Text = func.ToRawText(); UpdateStatusEx(n); } else PreviewRaw(); }