private BlockStatement DecompileMethod(MethodBody body, out MethodSpecificContext methodContext) { methodContext = null; try { stackVariable3 = new MethodSpecificContext(body); stackVariable5 = this.typeContext; if (stackVariable5 == null) { dummyVar0 = stackVariable5; stackVariable5 = new TypeSpecificContext(body.get_Method().get_DeclaringType()); } V_1 = new DecompilationContext(stackVariable3, stackVariable5, this.language); V_2 = this.language.CreatePipeline(V_1); methodContext = V_2.Run(body, this.language).get_MethodContext(); V_0 = V_2.get_Body(); } catch (Exception exception_0) { V_3 = exception_0; this.get_ExceptionsWhileDecompiling().Add(body.get_Method()); methodContext = new MethodSpecificContext(body); V_0 = new BlockStatement(); V_0.AddStatement(new ExceptionStatement(V_3, body.get_Method())); this.OnExceptionThrown(V_3); } return(V_0); }
private DecompilationContext GetNewContext(MethodBody body) { MethodSpecificContext methodSpecificContext = new MethodSpecificContext(body); TypeSpecificContext typeSpecificContext = new TypeSpecificContext(body.Method.DeclaringType); return(new DecompilationContext(methodSpecificContext, typeSpecificContext)); }
public WriterContext(AssemblySpecificContext assemblyContext, ModuleSpecificContext moduleContext, TypeSpecificContext typeContext, Dictionary<string, MethodSpecificContext> methodContexts, Dictionary<string, Statement> decompiledStatements) { this.AssemblyContext = assemblyContext; this.ModuleContext = moduleContext; this.TypeContext = typeContext; this.MethodContexts = methodContexts; this.DecompiledStatements = decompiledStatements; }
public DecompilationContext(MethodSpecificContext methodContext, TypeSpecificContext typeContext, ModuleSpecificContext moduleContext, AssemblySpecificContext assemblyContext, ILanguage language) { this.MethodContext = methodContext; this.TypeContext = typeContext; this.ModuleContext = moduleContext; this.AssemblyContext = assemblyContext; this.Language = language; this.IsStopped = false; }
public DecompilationContext(MethodSpecificContext methodContext, TypeSpecificContext typeContext, ModuleSpecificContext moduleContext, AssemblySpecificContext assemblyContext, ILanguage language) { base(); this.set_MethodContext(methodContext); this.set_TypeContext(typeContext); this.set_ModuleContext(moduleContext); this.set_AssemblyContext(assemblyContext); this.set_Language(language); this.set_IsStopped(false); return; }
public PropertyDecompiler(PropertyDefinition property, ILanguage language, bool renameInvalidMembers, IDecompilationCacheService cacheService, TypeSpecificContext typeContext = null) { this.propertyDef = property; this.language = language; this.renameInvalidMembers = renameInvalidMembers; this.cacheService = cacheService; this.typeContext = typeContext; this.propertyFieldDef = null; this.ExceptionsWhileDecompiling = new List <MethodDefinition>(); }
public PropertyDecompiler(PropertyDefinition property, ILanguage language, bool renameInvalidMembers, IDecompilationCacheService cacheService, TypeSpecificContext typeContext = null) { this.propertyDef = property; this.language = language; this.renameInvalidMembers = renameInvalidMembers; this.cacheService = cacheService; this.typeContext = typeContext; this.propertyFieldDef = null; this.ExceptionsWhileDecompiling = new List<MethodDefinition>(); }
public virtual BlockStatement Process(DecompilationContext context, BlockStatement block) { this.methodContext = context.MethodContext; this.typeContext = context.TypeContext; //this.suggestedNames.UnionWith(methodContext.UsedNames); //this.suggestedNames.UnionWith(context.VariableNames); Preprocess(); VisitBlockStatement(block); ReplaceDeclarations(block); //this.methodContext.UsedNames.UnionWith(suggestedNames); CollectVariableNames(); return block; }
public TypeSpecificContext ShallowPartialClone() { stackVariable0 = new TypeSpecificContext(); stackVariable0.set_CurrentType(this.get_CurrentType()); stackVariable0.set_MethodDefinitionToNameMap(this.get_MethodDefinitionToNameMap()); stackVariable0.set_BackingFieldToNameMap(this.get_BackingFieldToNameMap()); stackVariable0.set_UsedNamespaces(this.get_UsedNamespaces()); stackVariable0.set_VisibleMembersNames(this.get_VisibleMembersNames()); stackVariable0.fieldToEventMap = this.fieldToEventMap; stackVariable0.methodToPropertyMap = this.get_MethodToPropertyMap(); stackVariable0.set_IsWinRTImplementation(this.get_IsWinRTImplementation()); stackVariable0.fieldToPropertyMap = this.fieldToPropertyMap; stackVariable0.set_GeneratedFilterMethods(this.get_GeneratedFilterMethods()); stackVariable0.set_GeneratedMethodDefinitionToNameMap(this.get_GeneratedMethodDefinitionToNameMap()); stackVariable0.set_AssignmentData(new Dictionary <string, InitializationAssignment>()); stackVariable0.set_BaseCtorInvocators(new HashSet <MethodDefinition>()); stackVariable0.set_FieldInitializationFailed(false); return(stackVariable0); }
public TypeSpecificContext ShallowPartialClone() { TypeSpecificContext partialClone = new TypeSpecificContext(); partialClone.CurrentType = this.CurrentType; partialClone.MethodDefinitionToNameMap = this.MethodDefinitionToNameMap; partialClone.BackingFieldToNameMap = this.BackingFieldToNameMap; partialClone.UsedNamespaces = this.UsedNamespaces; partialClone.VisibleMembersNames = this.VisibleMembersNames; partialClone.fieldToEventMap = this.FieldToEventMap; partialClone.methodToPropertyMap = this.MethodToPropertyMap; partialClone.IsWinRTImplementation = this.IsWinRTImplementation; partialClone.FieldAssignmentData = new Dictionary <string, FieldInitializationAssignment>(); partialClone.BaseCtorInvocators = new HashSet <MethodDefinition>(); partialClone.FieldInitializationFailed = false; return(partialClone); }
private BlockStatement DecompileMethodPartially(MethodBody body, out DecompilationContext context, bool needDecompiledMember = false) { context = null; if (this.get_IsCachingEnabled() && this.cacheService.IsDecompiledMemberInCache(body.get_Method(), this.language, this.renameInvalidMembers)) { return(this.cacheService.GetDecompiledMemberFromCache(body.get_Method(), this.language, this.renameInvalidMembers).get_Member().get_Statement() as BlockStatement); } if ((int)(new ControlFlowGraphBuilder(body.get_Method())).CreateGraph().get_Blocks().Length > 2) { return(null); } try { stackVariable13 = new MethodSpecificContext(body); stackVariable15 = this.typeContext; if (stackVariable15 == null) { dummyVar0 = stackVariable15; stackVariable15 = new TypeSpecificContext(body.get_Method().get_DeclaringType()); } V_2 = new DecompilationContext(stackVariable13, stackVariable15, this.language); if (!needDecompiledMember) { V_2.get_MethodContext().set_EnableEventAnalysis(false); } V_1 = new DecompilationPipeline(BaseLanguage.get_IntermediateRepresenationPipeline().get_Steps(), V_2); context = V_1.Run(body, this.language); V_0 = V_1.get_Body(); } catch (Exception exception_0) { V_3 = exception_0; this.get_ExceptionsWhileDecompiling().Add(body.get_Method()); V_0 = new BlockStatement(); V_0.AddStatement(new ExceptionStatement(V_3, body.get_Method())); this.OnExceptionThrown(V_3); } return(V_0); }
public PropertyDecompiler(PropertyDefinition property, ILanguage language, TypeSpecificContext typeContext = null) : this(property, language, false, null, typeContext) { }
public DecompiledType(TypeDefinition type) { this.Type = type; this.DecompiledMembers = new Dictionary <string, DecompiledMember>(); this.TypeContext = new TypeSpecificContext(type); }
private DecompilationContext GetNewContext(MethodBody body, ILanguage language) { stackVariable1 = new MethodSpecificContext(body); V_0 = new TypeSpecificContext(body.get_Method().get_DeclaringType()); return(new DecompilationContext(stackVariable1, V_0, language)); }
public DecompilationContext(MethodSpecificContext methodContext, TypeSpecificContext typeContext, ILanguage language) { this(methodContext, typeContext, new ModuleSpecificContext(), new AssemblySpecificContext(), language); return; }
public DecompiledType(TypeDefinition type) { this.Type = type; this.DecompiledMembers = new Dictionary<string, DecompiledMember>(); this.TypeContext = new TypeSpecificContext(type); }
public WriterContext(AssemblySpecificContext assemblyContext, ModuleSpecificContext moduleContext, TypeSpecificContext typeContext, Dictionary <string, MethodSpecificContext> methodContexts, Dictionary <string, Statement> decompiledStatements) { base(); this.set_AssemblyContext(assemblyContext); this.set_ModuleContext(moduleContext); this.set_TypeContext(typeContext); this.set_MethodContexts(methodContexts); this.set_DecompiledStatements(decompiledStatements); return; }
public PropertyRecognizer(TypeSystem typeSystem, TypeSpecificContext typeContext, ILanguage language) { this.typeSystem = typeSystem; this.typeContext = typeContext; this.language = language; }
public InitializationPattern(CodePatternsContext patternsContext, DecompilationContext context) : base(patternsContext, context.MethodContext.Method.Module.TypeSystem) { this.typeContext = context.TypeContext; this.method = context.MethodContext.Method; }
public static BlockStatement Decompile(this MethodBody body, ILanguage language, TypeSpecificContext typeContext = null) { DecompilationContext dc; return(body.Decompile(language, out dc, typeContext)); }
public TypeSpecificContext ShallowPartialClone() { TypeSpecificContext partialClone = new TypeSpecificContext(); partialClone.CurrentType = this.CurrentType; partialClone.MethodDefinitionToNameMap = this.MethodDefinitionToNameMap; partialClone.BackingFieldToNameMap = this.BackingFieldToNameMap; partialClone.UsedNamespaces = this.UsedNamespaces; partialClone.VisibleMembersNames = this.VisibleMembersNames; partialClone.fieldToEventMap = this.FieldToEventMap; partialClone.methodToPropertyMap = this.MethodToPropertyMap; partialClone.IsWinRTImplementation = this.IsWinRTImplementation; partialClone.fieldToPropertyMap = this.fieldToPropertyMap; partialClone.GeneratedFilterMethods = this.GeneratedFilterMethods; partialClone.GeneratedMethodDefinitionToNameMap = this.GeneratedMethodDefinitionToNameMap; partialClone.AssignmentData = new Dictionary<string, InitializationAssignment>(); partialClone.BaseCtorInvocators = new HashSet<MethodDefinition>(); partialClone.FieldInitializationFailed = false; return partialClone; }
private DecompilationContext GetNewContext(MethodBody body, ILanguage language) { MethodSpecificContext methodSpecificContext = new MethodSpecificContext(body); TypeSpecificContext typeSpecificContext = new TypeSpecificContext(body.Method.DeclaringType); return new DecompilationContext(methodSpecificContext, typeSpecificContext, language); }
public PropertyRecognizer(TypeSystem typeSystem, TypeSpecificContext typeContext) { this.typeSystem = typeSystem; this.typeContext = typeContext; }
public static BlockStatement Decompile(this MethodBody body, ILanguage language, out DecompilationContext context, TypeSpecificContext typeContext = null) { if (typeContext == null) { V_0 = language.CreatePipeline(); } else { V_0 = language.CreatePipeline(new DecompilationContext(new MethodSpecificContext(body), typeContext, language)); } return(Extensions.RunPipeline(V_0, language, body, out context)); }
public static BlockStatement Decompile(this MethodBody body, ILanguage language, out DecompilationContext context, TypeSpecificContext typeContext = null) { MethodDefinition method = null; if (body != null) { method = body.Method; } DecompilationPipeline pipeline; if (typeContext != null) { pipeline = language.CreatePipeline(method, new DecompilationContext(new MethodSpecificContext(body), typeContext)); } else { pipeline = language.CreatePipeline(method); } return(RunPipeline(pipeline, language, body, out context)); }
public WriterContext(AssemblySpecificContext assemblyContext, ModuleSpecificContext moduleContext, TypeSpecificContext typeContext, Dictionary <string, MethodSpecificContext> methodContexts, Dictionary <string, Statement> decompiledStatements) { this.AssemblyContext = assemblyContext; this.ModuleContext = moduleContext; this.TypeContext = typeContext; this.MethodContexts = methodContexts; this.DecompiledStatements = decompiledStatements; }
public static DecompiledMember TryGetDecompiledMember(MethodDefinition method, TypeSpecificContext typeContext, ILanguage language) { if (method.Body == null) { return(new DecompiledMember(GetMemberUniqueName(method), null, null)); } DecompilationContext innerContext = null; BlockStatement statement = method.Body.Decompile(language, out innerContext, typeContext); return(new DecompiledMember(GetMemberUniqueName(method), statement, innerContext.MethodContext)); }
public static BlockStatement Decompile(this MethodBody body, ILanguage language, out DecompilationContext context, TypeSpecificContext typeContext = null) { DecompilationPipeline pipeline; if (typeContext != null) { pipeline = language.CreatePipeline(new DecompilationContext(new MethodSpecificContext(body), typeContext, language)); } else { pipeline = language.CreatePipeline(); } return RunPipeline(pipeline, language, body, out context); }