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));
 }
Beispiel #2
0
        private static BlockStatement DecompileStateMachine(this MethodBody body, DecompilationContext enclosingContext,
            BaseStateMachineRemoverStep removeStateMachineStep, Func<DecompilationContext, IStateMachineData> stateMachineDataSelector,
            out DecompilationContext decompilationContext)
        {
            DecompilationPipeline thePipeline = GetStateMachineRemovalPipeline(removeStateMachineStep, stateMachineDataSelector);
            decompilationContext = thePipeline.Run(body, enclosingContext.Language);

            enclosingContext.MethodContext.Variables.AddRange(decompilationContext.MethodContext.Variables);
            enclosingContext.MethodContext.VariableDefinitionToNameMap.AddRange(decompilationContext.MethodContext.VariableDefinitionToNameMap);
            enclosingContext.MethodContext.AddInnerMethodParametersToContext(decompilationContext.MethodContext);
            enclosingContext.MethodContext.VariableAssignmentData.AddRange(decompilationContext.MethodContext.VariableAssignmentData);
            enclosingContext.MethodContext.GotoLabels.AddRange(decompilationContext.MethodContext.GotoLabels);
            enclosingContext.MethodContext.GotoStatements.AddRange(decompilationContext.MethodContext.GotoStatements);
            BlockStatement theBlockStatement = thePipeline.Body;
            return theBlockStatement;
        }
Beispiel #3
0
        private static DecompilationPipeline GetStateMachineRemovalPipeline(BaseStateMachineRemoverStep removeStateMachineStep,
            Func<DecompilationContext, IStateMachineData> stateMachineDataSelector)
        {
            DecompilationPipeline intermediatePipeline = BaseLanguage.IntermediateRepresenationPipeline;
            List<IDecompilationStep> newSteps = new List<IDecompilationStep>();

            newSteps.Add(removeStateMachineStep);
            foreach (IDecompilationStep step in intermediatePipeline.Steps)
            {
                newSteps.Add(step);
                if (step is VariableAssignmentAnalysisStep)
                {
                    newSteps.Add(new FieldAssignmentAnalysisStep(stateMachineDataSelector));
                }
            }

            return new DecompilationPipeline(newSteps);
        }
 private static BlockStatement DecompileStateMachine(this MethodBody body, DecompilationContext enclosingContext, BaseStateMachineRemoverStep removeStateMachineStep, Func <DecompilationContext, IStateMachineData> stateMachineDataSelector, out DecompilationContext decompilationContext)
 {
     V_0 = Extensions.GetStateMachineRemovalPipeline(removeStateMachineStep, stateMachineDataSelector);
     decompilationContext = V_0.Run(body, enclosingContext.get_Language());
     enclosingContext.get_MethodContext().get_Variables().AddRange(decompilationContext.get_MethodContext().get_Variables());
     enclosingContext.get_MethodContext().get_VariableDefinitionToNameMap().AddRange <VariableDefinition, string>(decompilationContext.get_MethodContext().get_VariableDefinitionToNameMap());
     enclosingContext.get_MethodContext().AddInnerMethodParametersToContext(decompilationContext.get_MethodContext());
     enclosingContext.get_MethodContext().get_VariableAssignmentData().AddRange <VariableDefinition, AssignmentType>(decompilationContext.get_MethodContext().get_VariableAssignmentData());
     enclosingContext.get_MethodContext().get_GotoLabels().AddRange <string, Statement>(decompilationContext.get_MethodContext().get_GotoLabels());
     enclosingContext.get_MethodContext().get_GotoStatements().AddRange(decompilationContext.get_MethodContext().get_GotoStatements());
     return(V_0.get_Body());
 }