Beispiel #1
0
        private NashaMethodBody DisassembleMethodBody(NashaMethod method)
        {
            var body = new NashaMethodBody(method);

            body.Instructions = InstructionDisassembler.DisassembleAllInstructions(method);
            return(body);
        }
Beispiel #2
0
        public CilMethodBody RecompileCilMethodBody(NashaMethodBody nashaMethodBody)
        {
            var body = new CilMethodBody(nashaMethodBody.NashaMethod.Parent.Method);

            foreach (var instruction in nashaMethodBody.Instructions)
            {
                var cilInstruction = RecompileInstruction(instruction);
                body.Instructions.Add(cilInstruction);
                Context.Logger.Info($"Recompiled Nasha Instruction {instruction} Into Cil Instruction {cilInstruction}");
            }
            //After converting Nasha instruction to cil some instructions will need to be edited after.
            //Ex: Br - 30 =>
            //    Br - (Cil Label of Instruction with index 30)
            ReplaceOperands(body);
            return(body);
        }