Esempio n. 1
0
 private static DecompilationPipeline GetStateMachineRemovalPipeline(BaseStateMachineRemoverStep removeStateMachineStep, Func <DecompilationContext, IStateMachineData> stateMachineDataSelector)
 {
     stackVariable0 = BaseLanguage.get_IntermediateRepresenationPipeline();
     V_0            = new List <IDecompilationStep>();
     V_0.Add(removeStateMachineStep);
     V_1 = stackVariable0.get_Steps().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             V_0.Add(V_2);
             if (V_2 as VariableAssignmentAnalysisStep == null)
             {
                 continue;
             }
             V_0.Add(new FieldAssignmentAnalysisStep(stateMachineDataSelector));
         }
     }
     finally
     {
         if (V_1 != null)
         {
             V_1.Dispose();
         }
     }
     return(new DecompilationPipeline(V_0));
 }
Esempio n. 2
0
 private bool CheckMethodAndDecompile(MethodDefinition methodDef, out BlockStatement methodBody)
 {
     if (!methodDef.get_HasParameters() || methodDef.get_Parameters().get_Count() != 1)
     {
         methodBody = null;
         return(false);
     }
     V_0        = BaseLanguage.get_IntermediateRepresenationPipeline();
     dummyVar0  = V_0.Run(methodDef.get_Body(), this.language);
     methodBody = V_0.get_Body();
     return(true);
 }
Esempio n. 3
0
 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);
 }