コード例 #1
0
ファイル: frmMain.cs プロジェクト: sera619/LuaToolkit
        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;
            }
        }
コード例 #2
0
ファイル: LuaDecoder.cs プロジェクト: xxspokiixx/LuaToolkit
        // 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
            }
        }
コード例 #3
0
        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>();
        }