private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Title = "Select Binary File"; if (fileDialog.ShowDialog() == DialogResult.OK) { if (!File.Exists(fileDialog.FileName)) { return; } var luaF = new LuaCFile(File.ReadAllBytes(fileDialog.FileName)); LuaDecoder d = new LuaDecoder(luaF); LuaDecompiler writer = new LuaDecompiler(d); activeGraph = new frmGraph(writer); activeGraph.Show(); lstFuncs.Items.Clear(); foreach (var f in activeGraph.Writer.LuaFunctions) { lstFuncs.Items.Add(f.ToString()); } txtLuaCode.Text = activeGraph.Writer.LuaScript; } }
// NOTE: read the LuaCFILE and create stuff public LuaDecoder(LuaCFile file) { this.File = file; this.Index = 0; if (ReadHeader()) { this.File.Function = DecodeFunctionblock(); // init the Lua stuff } }
private List <byte> Buffer; // temp storage // NOTE: turns a Decoded Lua file back to its bytecode public LuaEncoder(LuaCFile file) { this.File = file; this.Buffer = new List <byte>(); }