Example #1
0
 /// <summary>
 /// Analyze the current type and save the type generated from it.
 /// </summary>
 public void Execute()
 {
     if (AnalysisUtils.IsTypeADelegate(Element))
     {
         GetUsingsForDelegate(Element);
     }
     else if (!Element.IsEnum)
     {
         AnalyzeParentAndInterfacesType(Element);
         if (Element.HasMethods)
         {
             AddConstructorToUnsupportedMethod();
             HashSet <string> methodsFromInterfaces = GetMethodsInheritedFromInterfaces(Element);
             _unsupportedMethodsInCurrentType.UnionWith(methodsFromInterfaces);
             UpdateUnsupportedMethodsInfo(methodsFromInterfaces);
             _unsupportedMethodsInCurrentType.UnionWith(GetAbstractMethodsThatWouldntBeImlemented(Element));
             GetCustomAttributes(_unsupportedMethodsInCurrentType);
             MethodAnalyzer.SetForType(_unsupportedMethodsInCurrentType, _hasAnIndexer);
             foreach (MethodDefinition method in Element.Methods)
             {
                 MethodAnalyzer.SetForMethod(method);
                 MethodAnalyzer.Run();
             }
         }
     }
     _typeBuilder.SetAndRun(Element, GetAdditionalCodeIfAny(_assemblyName, Element.Name), _implementedInterfaces, _hasAnIndexer, _assemblyName, 0);
     //Used to make sure we don't implement twice the same type. A type could be generated once with a few methods and could be override afterward with less methods defined, but it can't be the other way.
     _alreadyImplementedTypes.Add(_assemblyName + '.' + Element.FullName);
 }