/// <summary> /// Decompiles the specified context. /// </summary> /// <param name="context">The context.</param> /// <param name="method">The method.</param> /// <returns></returns> public IPapyrusDecompilerResult Decompile(IDecompilerContext context, PapyrusMethodDefinition method) { context.SetTargetMethod(method); flowAnalyzer.FindVarTypes(); flowAnalyzer.CreateFlowBlocks(); flowAnalyzer.MapLongLivedTempVariables(); flowAnalyzer.AssignLongLivedTempVariables(); flowAnalyzer.RebuildExpressionsInBlocks(); flowAnalyzer.RebuildBooleanOperators(0, method.Body.Instructions.Count); var tree = flowAnalyzer.RebuildControlFlow(0, method.Body.Instructions.Count); tree = flowAnalyzer.Finalize(tree); var result = codeGenerator.Generate(tree); var sourceCode = codeGenerator.GetMethodSourceCode(result, method); return(new PapyrusDecompilerResult(sourceCode, null)); }
/// <summary> /// Gets the current context or creates a new one if none exists. /// </summary> /// <returns></returns> public IDecompilerContext CreateContext() { if (decompilerContext == null) { decompilerContext = new DecompilerContext(this, flowAnalyzer, asm); decompilerContext.BuildTempStringTable(); } return(decompilerContext); }
/// <summary> /// Decompiles the papyrus assembly available in the context. /// </summary> /// <param name="context">The context.</param> /// <returns></returns> public IPapyrusDecompilerResult Decompile(IDecompilerContext context) { throw new NotImplementedException(); }