Exemplo n.º 1
0
        public NestedTypes(
            ITypeWithMonoCecil declaringType,
            INestedTypeFactory <TNestedAbstractClass, TNestedClass, TNestedSealedClass, TNestedStaticClass, TNestedDelegate, TNestedEnum, TNestedInterface, TNestedStruct> factory)
        {
            List <TNestedAbstractClass> nestedAbstractClasses = new List <TNestedAbstractClass>();
            List <TNestedClass>         nestedClasses         = new List <TNestedClass>();
            List <TNestedSealedClass>   nestedSealedClasses   = new List <TNestedSealedClass>();
            List <TNestedStaticClass>   nestedStaticClasses   = new List <TNestedStaticClass>();
            List <TNestedDelegate>      nestedDelegates       = new List <TNestedDelegate>();
            List <TNestedEnum>          nestedEnums           = new List <TNestedEnum>();
            List <TNestedInterface>     nestedInterfaces      = new List <TNestedInterface>();
            List <TNestedStruct>        nestedStructs         = new List <TNestedStruct>();

            foreach (TypeDefinition nestedType in declaringType.TypeDefinition.NestedTypes)
            {
                switch (nestedType.TypeClassification())
                {
                case TypeClassification.AbstractClass:
                    nestedAbstractClasses.Add(factory.CreateNestedAbstractClass(declaringType, nestedType));
                    break;

                case TypeClassification.Class:
                    nestedClasses.Add(factory.CreateNestedClass(declaringType, nestedType));
                    break;

                case TypeClassification.SealedClass:
                    nestedSealedClasses.Add(factory.CreateNestedSealedClass(declaringType, nestedType));
                    break;

                case TypeClassification.StaticClass:
                    nestedStaticClasses.Add(factory.CreateNestedStaticClass(declaringType, nestedType));
                    break;

                case TypeClassification.Delegate:
                    nestedDelegates.Add(factory.CreateNestedDelegate(declaringType, nestedType));
                    break;

                case TypeClassification.Enum:
                    nestedEnums.Add(factory.CreateNestedEnum(declaringType, nestedType));
                    break;

                case TypeClassification.Interface:
                    nestedInterfaces.Add(factory.CreateNestedInterface(declaringType, nestedType));
                    break;

                case TypeClassification.Struct:
                    nestedStructs.Add(factory.CreateNestedStruct(declaringType, nestedType));
                    break;
                }
            }

            NestedAbstractClasses = nestedAbstractClasses;
            NestedClasses         = nestedClasses;
            NestedSealedClasses   = nestedSealedClasses;
            NestedStaticClasses   = nestedStaticClasses;
            NestedDelegates       = nestedDelegates;
            NestedEnums           = nestedEnums;
            NestedInterfaces      = nestedInterfaces;
            NestedStructs         = nestedStructs;
        }
 protected override ClassNestedStructWithMonoCecil CreateNestedStruct(ITypeWithMonoCecil declaringType, TypeDefinition type)
 {
     return(new ClassNestedStructWithMonoCecil(declaringType, type));
 }
Exemplo n.º 3
0
 protected abstract TNestedStruct CreateNestedStruct(ITypeWithMonoCecil declaringType, TypeDefinition type);
Exemplo n.º 4
0
 protected abstract TNestedInterface CreateNestedInterface(ITypeWithMonoCecil declaringType, TypeDefinition type);
Exemplo n.º 5
0
 protected abstract TNestedDelegate CreateNestedDelegate(ITypeWithMonoCecil declaringType, TypeDefinition type);
Exemplo n.º 6
0
 protected abstract TNestedClass CreateNestedClass(ITypeWithMonoCecil declaringType, TypeDefinition type);
Exemplo n.º 7
0
 TNestedStruct INestedTypeFactory <TNestedAbstractClass, TNestedClass, TNestedSealedClass, TNestedStaticClass, TNestedDelegate, TNestedEnum, TNestedInterface, TNestedStruct> .CreateNestedStruct(
     ITypeWithMonoCecil declaringType,
     TypeDefinition type)
 {
     return(CreateNestedStruct(declaringType, type));
 }