public void Build(IList <AssemblyDefinition> list)
        {
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }

            EngineEventArgs e = new EngineEventArgs(this);

            foreach (AssemblyDefinition assembly in list)
            {
                Build(assembly, e);

                foreach (ModuleDefinition module in assembly.Modules)
                {
                    Build(module, e);

                    foreach (TypeDefinition type in module.GetAllTypes())
                    {
                        Build(type, e);

                        if (type.HasMethods)
                        {
                            foreach (MethodDefinition method in type.Methods)
                            {
                                Build(method, e);
                            }
                        }
                    }
                }
            }
        }
 private void BuildCustomAttributes(ICustomAttributeProvider custom, EngineEventArgs e)
 {
     if (custom.HasCustomAttributes)
     {
         EventHandler <EngineEventArgs> handler = BuildingCustomAttributes;
         if (handler != null)
         {
             handler(custom, e);
         }
     }
 }
        private void Build(AssemblyDefinition assembly, EngineEventArgs e)
        {
            e.CurrentAssembly = assembly;

            EventHandler <EngineEventArgs> handler = BuildingAssembly;

            if (handler != null)
            {
                handler(assembly, e);
            }

            BuildCustomAttributes(assembly, e);
        }
        private void Build(ModuleDefinition module, EngineEventArgs e)
        {
            e.CurrentModule = module;

            EventHandler <EngineEventArgs> handler = BuildingModule;

            if (handler != null)
            {
                handler(module, e);
            }

            BuildCustomAttributes(module, e);
        }
        private void Build(TypeDefinition type, EngineEventArgs e)
        {
            e.CurrentType = type;

            EventHandler <EngineEventArgs> handler = BuildingType;

            if (handler != null)
            {
                handler(type, e);
            }

            BuildCustomAttributes(type, e);

            if (type.HasEvents)
            {
                // TODO: incomplete - only covers custom attributes
                foreach (EventDefinition evnt in type.Events)
                {
                    BuildCustomAttributes(evnt, e);
                }
            }

            if (type.HasFields)
            {
                // TODO: incomplete - only covers custom attributes
                foreach (FieldDefinition field in type.Fields)
                {
                    BuildCustomAttributes(field, e);
                }
            }

            if (type.HasGenericParameters)
            {
                // TODO: incomplete - only covers custom attributes
                foreach (GenericParameter gp in type.GenericParameters)
                {
                    BuildCustomAttributes(gp, e);
                }
            }

            if (type.HasProperties)
            {
                // TODO: incomplete - only covers custom attributes
                foreach (PropertyDefinition prop in type.Properties)
                {
                    BuildCustomAttributes(prop, e);
                }
            }
        }
        private void Build(MethodDefinition method, EngineEventArgs e)
        {
            e.CurrentMethod = method;

            BuildCustomAttributes(method, e);

            if (method.HasGenericParameters)
            {
                // TODO: incomplete - only covers custom attributes
                foreach (GenericParameter gp in method.GenericParameters)
                {
                    BuildCustomAttributes(gp, e);
                }
            }

            if (method.HasParameters)
            {
                // TODO: incomplete - only covers custom attributes
                foreach (ParameterDefinition parameter in method.Parameters)
                {
                    BuildCustomAttributes(parameter, e);
                }
            }

            // TODO: incomplete - only covers custom attributes
            BuildCustomAttributes(method.MethodReturnType, e);

            if (method.HasBody)
            {
                EventHandler <EngineEventArgs> handler = BuildingMethodBody;
                if (handler != null)
                {
                    handler(method.Body, e);
                }
            }
        }
Пример #7
0
		public void Build (IList<AssemblyDefinition> list)
		{
			if (list == null)
				throw new ArgumentNullException ("list");

			EngineEventArgs e = new EngineEventArgs (this);

			foreach (AssemblyDefinition assembly in list) {
				Build (assembly, e);

				foreach (ModuleDefinition module in assembly.Modules) {
					Build (module, e);

					foreach (TypeDefinition type in module.GetAllTypes ()) {
						Build (type, e);

						if (type.HasMethods) {
							foreach (MethodDefinition method in type.Methods)
								Build (method, e);
						}
					}
				}
			}
		}
Пример #8
0
		private void Build (AssemblyDefinition assembly, EngineEventArgs e)
		{
			e.CurrentAssembly = assembly;

			EventHandler<EngineEventArgs> handler = BuildingAssembly;
			if (handler != null)
				handler (assembly, e);

			BuildCustomAttributes (assembly, e);
		}
Пример #9
0
		private void Build (ModuleDefinition module, EngineEventArgs e)
		{
			e.CurrentModule = module;

			EventHandler<EngineEventArgs> handler = BuildingModule;
			if (handler != null)
				handler (module, e);

			BuildCustomAttributes (module, e);
		}
Пример #10
0
		private void Build (TypeDefinition type, EngineEventArgs e)
		{
			e.CurrentType = type;

			EventHandler<EngineEventArgs> handler = BuildingType;
			if (handler != null)
				handler (type, e);

			BuildCustomAttributes (type, e);

			if (type.HasEvents) {
				// TODO: incomplete - only covers custom attributes
				foreach (EventDefinition evnt in type.Events)
					BuildCustomAttributes (evnt, e);
			}

			if (type.HasFields) {
				// TODO: incomplete - only covers custom attributes
				foreach (FieldDefinition field in type.Fields)
					BuildCustomAttributes (field, e);
			}

			if (type.HasGenericParameters) {
				// TODO: incomplete - only covers custom attributes
				foreach (GenericParameter gp in type.GenericParameters)
					BuildCustomAttributes (gp, e);
			}

			if (type.HasProperties) {
				// TODO: incomplete - only covers custom attributes
				foreach (PropertyDefinition prop in type.Properties)
					BuildCustomAttributes (prop, e);
			}
		}
Пример #11
0
		private void Build (MethodDefinition method, EngineEventArgs e)
		{
			e.CurrentMethod = method;

			BuildCustomAttributes (method, e);

			if (method.HasGenericParameters) {
				// TODO: incomplete - only covers custom attributes
				foreach (GenericParameter gp in method.GenericParameters)
					BuildCustomAttributes (gp, e);
			}

			if (method.HasParameters) {
				// TODO: incomplete - only covers custom attributes
				foreach (ParameterDefinition parameter in method.Parameters)
					BuildCustomAttributes (parameter, e);
			}

			// TODO: incomplete - only covers custom attributes
			BuildCustomAttributes (method.MethodReturnType, e);

			if (method.HasBody) {
				EventHandler<EngineEventArgs> handler = BuildingMethodBody;
				if (handler != null)
					handler (method.Body, e);
			}
		}
Пример #12
0
		private void BuildCustomAttributes (ICustomAttributeProvider custom, EngineEventArgs e)
		{
			if (custom.HasCustomAttributes) {
				EventHandler<EngineEventArgs> handler = BuildingCustomAttributes;
				if (handler != null)
					handler (custom, e);
			}
		}