public static ModuleDefinition CreateModule(string name, ModuleParameters parameters) { Mixin.CheckName(name); Mixin.CheckParameters(parameters); var module = new ModuleDefinition { Name = name, kind = parameters.Kind, Runtime = parameters.Runtime, architecture = parameters.Architecture, mvid = Guid.NewGuid(), Attributes = ModuleAttributes.ILOnly, Characteristics = (ModuleCharacteristics)0x8540, }; if (parameters.AssemblyResolver != null) { module.assembly_resolver = parameters.AssemblyResolver; } if (parameters.MetadataResolver != null) { module.metadata_resolver = parameters.MetadataResolver; } if (parameters.Kind != ModuleKind.NetModule) { var assembly = new AssemblyDefinition(); module.assembly = assembly; module.assembly.Name = CreateAssemblyName(name); assembly.main_module = module; } module.Types.Add(new TypeDefinition(string.Empty, "<Module>", TypeAttributes.NotPublic)); return(module); }
public ByReferenceType(TypeReference type) : base(type) { Mixin.CheckType(type); this.etype = MD.ElementType.ByRef; }
public CustomAttributeNamedArgument(string name, CustomAttributeArgument argument) { Mixin.CheckName(name); this.name = name; this.argument = argument; }
public CustomAttributeArgument(TypeReference type, object value) { Mixin.CheckType(type); this.type = type; this.value = value; }
public ArrayType(TypeReference type) : base(type) { Mixin.CheckType(type); this.etype = MD.ElementType.Array; }
public SentinelType(TypeReference type) : base(type) { Mixin.CheckType(type); this.etype = MD.ElementType.Sentinel; }
public PinnedType(TypeReference type) : base(type) { Mixin.CheckType(type); this.etype = MD.ElementType.Pinned; }
public PointerType(TypeReference type) : base(type) { Mixin.CheckType(type); this.etype = MD.ElementType.Ptr; }
public TypeDefinition GetType(string @namespace, string name) { Mixin.CheckName(name); return(((TypeDefinitionCollection)this.Types).GetType(@namespace ?? string.Empty, name)); }