Exemplo n.º 1
0
 public IEnumerable <IFeatureInfo> GetFeatures(IExtensionInfo extensionInfo, IManifestInfo manifestInfo)
 {
     V_0 = new List <IFeatureInfo>();
     V_1 = manifestInfo.get_ModuleInfo().get_Features().ToList <FeatureAttribute>();
     if (V_1.get_Count() <= 0)
     {
         V_15            = extensionInfo.get_Id();
         V_16            = manifestInfo.get_Name();
         stackVariable14 = manifestInfo.get_ModuleInfo().get_Dependencies();
         stackVariable15 = FeaturesProvider.u003cu003ec.u003cu003e9__3_1;
         if (stackVariable15 == null)
         {
             dummyVar5       = stackVariable15;
             stackVariable15 = new Func <string, string>(FeaturesProvider.u003cu003ec.u003cu003e9.u003cGetFeaturesu003eb__3_1);
             FeaturesProvider.u003cu003ec.u003cu003e9__3_1 = stackVariable15;
         }
         V_17 = stackVariable14.Select <string, string>(stackVariable15).ToArray <string>();
         if (!int.TryParse(manifestInfo.get_ModuleInfo().get_Priority(), out V_18))
         {
             V_18 = 0;
         }
         V_19            = manifestInfo.get_ModuleInfo().get_Category();
         V_20            = manifestInfo.get_ModuleInfo().get_Description();
         V_21            = manifestInfo.get_ModuleInfo().get_DefaultTenantOnly();
         V_22            = manifestInfo.get_ModuleInfo().get_IsAlwaysEnabled();
         stackVariable35 = new FeatureBuildingContext();
         stackVariable35.set_FeatureId(V_15);
         stackVariable35.set_FeatureName(V_16);
         stackVariable35.set_Category(V_19);
         stackVariable35.set_Description(V_20);
         stackVariable35.set_ExtensionInfo(extensionInfo);
         stackVariable35.set_ManifestInfo(manifestInfo);
         stackVariable35.set_Priority(V_18);
         stackVariable35.set_FeatureDependencyIds(V_17);
         stackVariable35.set_DefaultTenantOnly(V_21);
         stackVariable35.set_IsAlwaysEnabled(V_22);
         V_23 = stackVariable35;
         V_14 = this._featureBuilderEvents.GetEnumerator();
         try
         {
             while (V_14.MoveNext())
             {
                 V_14.get_Current().Building(V_23);
             }
         }
         finally
         {
             if (V_14 != null)
             {
                 V_14.Dispose();
             }
         }
         V_24 = new FeatureInfo(V_23.get_FeatureId(), V_23.get_FeatureName(), V_23.get_Priority(), V_23.get_Category(), V_23.get_Description(), V_23.get_ExtensionInfo(), V_23.get_FeatureDependencyIds(), V_23.get_DefaultTenantOnly(), V_23.get_IsAlwaysEnabled());
         V_14 = this._featureBuilderEvents.GetEnumerator();
         try
         {
             while (V_14.MoveNext())
             {
                 V_14.get_Current().Built(V_24);
             }
         }
         finally
         {
             if (V_14 != null)
             {
                 V_14.Dispose();
             }
         }
         V_0.Add(V_24);
     }
     else
     {
         V_2 = V_1.GetEnumerator();
         try
         {
             while (V_2.MoveNext())
             {
                 V_3 = V_2.get_Current();
                 if (string.IsNullOrWhiteSpace(V_3.get_Id()))
                 {
                     throw new ArgumentException(string.Concat("A feature is missing a mandatory 'Id' property in the Module '", extensionInfo.get_Id(), "'"));
                 }
                 V_4             = V_3.get_Id();
                 stackVariable99 = V_3.get_Name();
                 if (stackVariable99 == null)
                 {
                     dummyVar0       = stackVariable99;
                     stackVariable99 = V_3.get_Id();
                 }
                 V_5 = stackVariable99;
                 stackVariable101 = V_3.get_Dependencies();
                 stackVariable102 = FeaturesProvider.u003cu003ec.u003cu003e9__3_0;
                 if (stackVariable102 == null)
                 {
                     dummyVar1        = stackVariable102;
                     stackVariable102 = new Func <string, string>(FeaturesProvider.u003cu003ec.u003cu003e9.u003cGetFeaturesu003eb__3_0);
                     FeaturesProvider.u003cu003ec.u003cu003e9__3_0 = stackVariable102;
                 }
                 V_6 = stackVariable101.Select <string, string>(stackVariable102).ToArray <string>();
                 stackVariable106 = V_3.get_Priority();
                 if (stackVariable106 == null)
                 {
                     dummyVar2        = stackVariable106;
                     stackVariable106 = manifestInfo.get_ModuleInfo().get_Priority();
                 }
                 if (!int.TryParse(stackVariable106, out V_7))
                 {
                     V_7 = 0;
                 }
                 stackVariable110 = V_3.get_Category();
                 if (stackVariable110 == null)
                 {
                     dummyVar3        = stackVariable110;
                     stackVariable110 = manifestInfo.get_ModuleInfo().get_Category();
                 }
                 V_8 = stackVariable110;
                 stackVariable112 = V_3.get_Description();
                 if (stackVariable112 == null)
                 {
                     dummyVar4        = stackVariable112;
                     stackVariable112 = manifestInfo.get_ModuleInfo().get_Description();
                 }
                 V_9              = stackVariable112;
                 V_10             = V_3.get_DefaultTenantOnly();
                 V_11             = V_3.get_IsAlwaysEnabled();
                 stackVariable117 = new FeatureBuildingContext();
                 stackVariable117.set_FeatureId(V_4);
                 stackVariable117.set_FeatureName(V_5);
                 stackVariable117.set_Category(V_8);
                 stackVariable117.set_Description(V_9);
                 stackVariable117.set_ExtensionInfo(extensionInfo);
                 stackVariable117.set_ManifestInfo(manifestInfo);
                 stackVariable117.set_Priority(V_7);
                 stackVariable117.set_FeatureDependencyIds(V_6);
                 stackVariable117.set_DefaultTenantOnly(V_10);
                 stackVariable117.set_IsAlwaysEnabled(V_11);
                 V_12 = stackVariable117;
                 V_14 = this._featureBuilderEvents.GetEnumerator();
                 try
                 {
                     while (V_14.MoveNext())
                     {
                         V_14.get_Current().Building(V_12);
                     }
                 }
                 finally
                 {
                     if (V_14 != null)
                     {
                         V_14.Dispose();
                     }
                 }
                 V_13 = new FeatureInfo(V_4, V_5, V_7, V_8, V_9, extensionInfo, V_6, V_10, V_11);
                 V_14 = this._featureBuilderEvents.GetEnumerator();
                 try
                 {
                     while (V_14.MoveNext())
                     {
                         V_14.get_Current().Built(V_13);
                     }
                 }
                 finally
                 {
                     if (V_14 != null)
                     {
                         V_14.Dispose();
                     }
                 }
                 V_0.Add(V_13);
             }
         }
         finally
         {
             ((IDisposable)V_2).Dispose();
         }
     }
     return(V_0);
 }
Exemplo n.º 2
0
 internal static CFGBlockLogicalConstruct FindGuardedBlockCFGFollowNode(ExceptionHandlingLogicalConstruct construct, HashSet <CFGBlockLogicalConstruct> outOfconsideration)
 {
     V_0 = new Dictionary <CFGBlockLogicalConstruct, uint>();
     GuardedBlocksFollowNodesFinder.AddSuccessorsToCount(construct.get_Try(), V_0);
     V_1 = 1;
     if (construct as TryCatchFilterLogicalConstruct == null)
     {
         if (construct as TryFaultLogicalConstruct == null)
         {
             if (construct as TryFinallyLogicalConstruct != null)
             {
                 GuardedBlocksFollowNodesFinder.AddSuccessorsToCount((construct as TryFinallyLogicalConstruct).get_Finally(), V_0);
                 V_1 = V_1 + 1;
             }
         }
         else
         {
             GuardedBlocksFollowNodesFinder.AddSuccessorsToCount((construct as TryFaultLogicalConstruct).get_Fault(), V_0);
             V_1 = V_1 + 1;
         }
     }
     else
     {
         V_5 = (construct as TryCatchFilterLogicalConstruct).get_Handlers();
         V_6 = 0;
         while (V_6 < (int)V_5.Length)
         {
             GuardedBlocksFollowNodesFinder.AddSuccessorsToCount(V_5[V_6], V_0);
             V_1 = V_1 + 1;
             V_6 = V_6 + 1;
         }
     }
     V_7 = outOfconsideration.GetEnumerator();
     try
     {
         while (V_7.MoveNext())
         {
             V_8 = V_7.get_Current();
             if (!V_0.ContainsKey(V_8))
             {
                 continue;
             }
             dummyVar0 = V_0.Remove(V_8);
         }
     }
     finally
     {
         ((IDisposable)V_7).Dispose();
     }
     if (V_0.get_Count() == 0)
     {
         return(null);
     }
     V_2       = new HashSet <CFGBlockLogicalConstruct>();
     V_3       = V_0.get_Keys().FirstOrDefault <CFGBlockLogicalConstruct>();
     dummyVar1 = V_2.Add(V_3);
     V_4       = V_0.get_Item(V_3);
     V_9       = V_0.get_Keys().GetEnumerator();
     try
     {
         while (V_9.MoveNext())
         {
             V_10 = V_9.get_Current();
             if (V_0.get_Item(V_10) <= V_4)
             {
                 if (V_0.get_Item(V_10) != V_4)
                 {
                     continue;
                 }
                 dummyVar3 = V_2.Add(V_10);
             }
             else
             {
                 V_4 = V_0.get_Item(V_10);
                 V_2.Clear();
                 dummyVar2 = V_2.Add(V_10);
             }
         }
     }
     finally
     {
         ((IDisposable)V_9).Dispose();
     }
     if (V_2.get_Count() == 1)
     {
         return(V_2.FirstOrDefault <CFGBlockLogicalConstruct>());
     }
     V_11 = new HashSet <CFGBlockLogicalConstruct>();
     V_12 = 0;
     V_7  = V_2.GetEnumerator();
     try
     {
         while (V_7.MoveNext())
         {
             V_14 = V_7.get_Current();
             V_15 = 0;
             V_16 = construct.get_CFGBlocks();
             V_17 = V_14.get_CFGPredecessors().GetEnumerator();
             try
             {
                 while (V_17.MoveNext())
                 {
                     V_18 = V_17.get_Current();
                     if (!V_16.Contains(V_18))
                     {
                         continue;
                     }
                     V_15 = V_15 + 1;
                 }
             }
             finally
             {
                 ((IDisposable)V_17).Dispose();
             }
             if (V_15 < V_12)
             {
                 continue;
             }
             if (V_15 > V_12)
             {
                 V_12 = V_15;
                 V_11.Clear();
             }
             dummyVar4 = V_11.Add(V_14);
         }
     }
     finally
     {
         ((IDisposable)V_7).Dispose();
     }
     V_13 = V_11.FirstOrDefault <CFGBlockLogicalConstruct>();
     if (V_13.get_Index() < construct.get_Entry().get_Index())
     {
         V_19 = null;
         V_7  = V_11.GetEnumerator();
         try
         {
             while (V_7.MoveNext())
             {
                 V_20 = V_7.get_Current();
                 if (V_20.get_Index() <= construct.get_Entry().get_Index() || V_19 != null && V_19.get_Index() < V_20.get_Index())
                 {
                     continue;
                 }
                 V_19 = V_20;
             }
         }
         finally
         {
             ((IDisposable)V_7).Dispose();
         }
         if (V_19 != null)
         {
             V_13 = V_19;
         }
     }
     return(V_13);
 }
Exemplo n.º 3
0
 private void Preprocess()
 {
     V_0 = 0;
     V_1 = new Dictionary <ParameterDefinition, string>();
     V_2 = this.methodContext.get_ParameterDefinitionToNameMap().GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_3 = V_2.get_Current();
             V_4 = V_3.get_Key();
             V_5 = V_3.get_Value();
             V_6 = V_5;
             V_7 = !V_6.IsValidIdentifier();
             while (V_7 || this.HasMethodParameterWithSameName(V_6))
             {
                 V_7             = false;
                 stackVariable22 = V_0;
                 V_0             = stackVariable22 + 1;
                 V_8             = stackVariable22;
                 V_6             = String.Concat("argument", V_8.ToString());
             }
             if (!String.op_Inequality(V_6, V_5))
             {
                 continue;
             }
             V_1.Add(V_4, V_6);
         }
     }
     finally
     {
         ((IDisposable)V_2).Dispose();
     }
     V_2 = V_1.GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_9 = V_2.get_Current();
             this.methodContext.get_ParameterDefinitionToNameMap().set_Item(V_9.get_Key(), V_9.get_Value());
         }
     }
     finally
     {
         ((IDisposable)V_2).Dispose();
     }
     V_10 = this.methodContext.get_Body().get_Method().get_Parameters().GetEnumerator();
     try
     {
         while (V_10.MoveNext())
         {
             V_11 = V_10.get_Current();
             V_12 = V_11.get_Name();
             if (String.IsNullOrEmpty(V_12))
             {
                 V_12 = this.GetNameByType(V_11.get_ParameterType());
             }
             this.methodContext.get_ParameterDefinitionToNameMap().Add(V_11, V_12);
         }
     }
     finally
     {
         V_10.Dispose();
     }
     if (this.methodContext.get_Method().get_IsSetter() && this.methodContext.get_Method().get_Parameters().get_Count() == 1)
     {
         V_13 = this.methodContext.get_Method().get_Parameters().get_Item(0);
         this.methodContext.get_ParameterDefinitionToNameMap().set_Item(V_13, "value");
     }
     V_14 = this.methodContext.get_Body().get_Variables().GetEnumerator();
     try
     {
         while (V_14.MoveNext())
         {
             V_15 = V_14.get_Current();
             if (!this.methodContext.get_ParameterDefinitionToNameMap().ContainsValue(V_15.get_Name()))
             {
                 continue;
             }
             dummyVar0 = this.methodContext.get_VariablesToRename().Add(V_15);
         }
     }
     finally
     {
         V_14.Dispose();
     }
     V_16 = this.methodContext.get_VariableDefinitionToNameMap().GetEnumerator();
     try
     {
         while (V_16.MoveNext())
         {
             V_17 = V_16.get_Current();
             if (!this.methodContext.get_ParameterDefinitionToNameMap().ContainsValue(V_17.get_Value()))
             {
                 continue;
             }
             dummyVar1 = this.methodContext.get_VariablesToRename().Add(V_17.get_Key());
         }
     }
     finally
     {
         ((IDisposable)V_16).Dispose();
     }
     return;
 }
Exemplo n.º 4
0
        private DecompiledType GetDecompiledType(IMemberDefinition member, ILanguage language)
        {
            V_0 = Utilities.GetDeclaringTypeOrSelf(member);
            V_1 = new DecompiledType(V_0);
            V_2 = new Queue <IMemberDefinition>();
            V_2.Enqueue(member);
Label0:
            while (V_2.get_Count() > 0)
            {
                V_3 = V_2.Dequeue();
                if (V_3 as TypeDefinition != null && (object)V_3 == (object)member)
                {
                    V_4 = Utilities.GetTypeMembers(V_3 as TypeDefinition, language, true, null, null, null, V_1.get_TypeContext().GetFieldToPropertyMap(language).get_Keys()).GetEnumerator();
                    try
                    {
                        while (V_4.MoveNext())
                        {
                            V_5 = V_4.get_Current();
                            V_2.Enqueue(V_5);
                        }
                    }
                    finally
                    {
                        ((IDisposable)V_4).Dispose();
                    }
                }
                if (V_3 as MethodDefinition != null)
                {
                    this.DecompileMember(V_3 as MethodDefinition, language, V_1);
                }
                if (V_3 as EventDefinition != null)
                {
                    V_6 = V_3 as EventDefinition;
                    if ((new AutoImplementedEventMatcher(V_6, language)).IsAutoImplemented())
                    {
                        dummyVar0 = V_1.get_TypeContext().get_AutoImplementedEvents().Add(V_6);
                    }
                    if (V_6.get_AddMethod() != null)
                    {
                        this.DecompileMember(V_6.get_AddMethod(), language, V_1);
                    }
                    if (V_6.get_RemoveMethod() != null)
                    {
                        this.DecompileMember(V_6.get_RemoveMethod(), language, V_1);
                    }
                    if (V_6.get_InvokeMethod() != null)
                    {
                        this.DecompileMember(V_6.get_InvokeMethod(), language, V_1);
                    }
                }
                if (V_3 as PropertyDefinition != null)
                {
                    V_7             = V_3 as PropertyDefinition;
                    stackVariable52 = new PropertyDecompiler(V_7, language, this.renameInvalidMembers, this.cacheService, V_1.get_TypeContext());
                    stackVariable52.add_ExceptionThrown(new EventHandler <Exception>(this.OnExceptionThrown));
                    stackVariable52.Decompile(out V_8, out V_9, out V_10);
                    stackVariable52.remove_ExceptionThrown(new EventHandler <Exception>(this.OnExceptionThrown));
                    if (V_10)
                    {
                        dummyVar1 = V_1.get_TypeContext().get_AutoImplementedProperties().Add(V_7);
                    }
                    if (V_8 != null)
                    {
                        this.AddDecompiledMemberToDecompiledType(V_8, V_1);
                    }
                    if (V_9 != null)
                    {
                        this.AddDecompiledMemberToDecompiledType(V_9, V_1);
                    }
                    V_11 = stackVariable52.get_ExceptionsWhileDecompiling().GetEnumerator();
                    try
                    {
                        while (V_11.MoveNext())
                        {
                            V_12 = V_11.get_Current();
                            this.get_ExceptionsWhileDecompiling().Add(V_12);
                        }
                    }
                    finally
                    {
                        if (V_11 != null)
                        {
                            V_11.Dispose();
                        }
                    }
                }
                if (V_3 as FieldDefinition == null)
                {
                    continue;
                }
                V_13 = V_3 as FieldDefinition;
                V_14 = V_3.get_DeclaringType().get_Methods().GetEnumerator();
                try
                {
                    while (V_14.MoveNext())
                    {
                        V_15 = V_14.get_Current();
                        if (!V_15.get_IsConstructor() || V_13.get_IsStatic() != V_15.get_IsStatic())
                        {
                            continue;
                        }
                        this.DecompileConstructorChain(V_15, language, V_1);
                        goto Label0;
                    }
                }
                finally
                {
                    V_14.Dispose();
                }
            }
            V_1.get_TypeContext().set_ExplicitlyImplementedMembers(this.GetExplicitlyImplementedInterfaceMethods(V_0, language));
            this.AddGeneratedFilterMethodsToDecompiledType(V_1, V_1.get_TypeContext(), language);
            return(V_1);
        }
Exemplo n.º 5
0
 public static int CompareToSecurityAttribute(this SecurityAttribute first, SecurityAttribute second, SecurityDeclaration firstDeclaration, SecurityDeclaration secondDeclaration)
 {
     if ((object)first == (object)second)
     {
         return(0);
     }
     V_0 = firstDeclaration.get_Action().ToString();
     V_1 = secondDeclaration.get_Action().ToString();
     if (String.op_Inequality(V_0, V_1))
     {
         return(V_0.CompareTo(V_1));
     }
     V_2 = Math.Max(first.get_Properties().get_Count(), second.get_Properties().get_Count());
     V_5 = 0;
     while (V_5 < V_2)
     {
         if (V_5 >= first.get_Properties().get_Count())
         {
             return(1);
         }
         if (V_5 >= second.get_Properties().get_Count())
         {
             return(-1);
         }
         V_6 = first.get_Properties().get_Item(V_5);
         V_7 = second.get_Properties().get_Item(V_5);
         if (!String.op_Equality(V_6.get_Name(), V_7.get_Name()))
         {
             return(V_6.get_Name().CompareTo(V_7.get_Name()));
         }
         V_10 = V_6.get_Argument();
         V_8  = V_10.get_Value().ToString();
         V_10 = V_7.get_Argument();
         V_9  = V_10.get_Value().ToString();
         if (String.op_Inequality(V_8, V_9))
         {
             return(V_8.CompareTo(V_9));
         }
         V_5 = V_5 + 1;
     }
     V_3  = Math.Max(first.get_Fields().get_Count(), second.get_Fields().get_Count());
     V_11 = 0;
     while (V_11 < V_3)
     {
         if (V_11 >= first.get_Fields().get_Count())
         {
             return(1);
         }
         if (V_11 >= second.get_Fields().get_Count())
         {
             return(-1);
         }
         V_12 = first.get_Fields().get_Item(V_11);
         V_13 = second.get_Fields().get_Item(V_11);
         if (!String.op_Equality(V_12.get_Name(), V_13.get_Name()))
         {
             return(V_12.get_Name().CompareTo(V_13.get_Name()));
         }
         V_10 = V_12.get_Argument();
         V_14 = V_10.get_Value().ToString();
         V_10 = V_13.get_Argument();
         V_15 = V_10.get_Value().ToString();
         if (String.op_Inequality(V_14, V_15))
         {
             return(V_14.CompareTo(V_15));
         }
         V_11 = V_11 + 1;
     }
     return(0);
 }