예제 #1
0
        public MethodDefinition(string name, MethodAttributes attributes, MethodSignature signature)
            : base(new MetadataToken(MetadataTokenType.Method))
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (signature == null)
            {
                throw new ArgumentNullException("signature");
            }

            _name          = new LazyValue <string>(name);
            Attributes     = attributes;
            ImplAttributes = MethodImplAttributes.IL | MethodImplAttributes.Managed;
            _signature     = new LazyValue <MethodSignature>(signature);
            Parameters     = new DelegatedMemberCollection <MethodDefinition, ParameterDefinition>(this, GetParamOwner, SetParamOwner);
            _methodBody    = new LazyValue <MethodBody>();
            _pinvokeMap    = new LazyValue <ImplementationMap>();

            _declaringType       = new LazyValue <TypeDefinition>();
            CustomAttributes     = new CustomAttributeCollection(this);
            SecurityDeclarations = new SecurityDeclarationCollection(this);
            GenericParameters    = new GenericParameterCollection(this);
        }
예제 #2
0
 public PropertyMap()
     : base(new MetadataToken(MetadataTokenType.PropertyMap))
 {
     _parent    = new LazyValue <TypeDefinition>();
     Properties = new DelegatedMemberCollection <PropertyMap, PropertyDefinition>(
         this,
         GetPropertyOwner,
         SetPropertyOwner);
 }
예제 #3
0
 public ModuleDefinition(string name)
     : base(new MetadataToken(MetadataTokenType.Module))
 {
     _name            = new LazyValue <string>(name);
     _mvid            = new LazyValue <Guid>();
     _encId           = new LazyValue <Guid>();
     _encBaseId       = new LazyValue <Guid>();
     TopLevelTypes    = new DelegatedMemberCollection <ModuleDefinition, TypeDefinition>(this, GetTypeOwner, SetTypeOwner);
     CustomAttributes = new CustomAttributeCollection(this);
 }
예제 #4
0
        public AssemblyReference(IAssemblyDescriptor info)
            : base(new MetadataToken(MetadataTokenType.AssemblyRef))
        {
            _name      = new LazyValue <string>(info.Name);
            Version    = info.Version;
            _culture   = new LazyValue <string>(info.Culture);
            _publicKey = new LazyValue <DataBlobSignature>(info.PublicKeyToken == null ? null : new DataBlobSignature(info.PublicKeyToken));
            _hashValue = new LazyValue <DataBlobSignature>();

            CustomAttributes = new CustomAttributeCollection(this);
            OperatingSystems = new DelegatedMemberCollection <AssemblyReference, AssemblyRefOs>(this, GetOsOwner, SetOsOwner);
            Processors       = new DelegatedMemberCollection <AssemblyReference, AssemblyRefProcessor>(this, GetProcessorOwner, SetProcessorOwner);
        }
예제 #5
0
        public AssemblyReference(string name, Version version, MetadataImage image)
            : base(new MetadataToken(MetadataTokenType.AssemblyRef))
        {
            _name      = new LazyValue <string>(name);
            _version   = version;
            _culture   = new LazyValue <string>();
            _publicKey = new LazyValue <DataBlobSignature>();
            _hashValue = new LazyValue <DataBlobSignature>();

            CustomAttributes = new CustomAttributeCollection(this);
            OperatingSystems = new Collection <AssemblyRefOs>();
            OperatingSystems = new DelegatedMemberCollection <AssemblyReference, AssemblyRefOs>(this, GetOsOwner, SetOsOwner);
            Processors       = new DelegatedMemberCollection <AssemblyReference, AssemblyRefProcessor>(this, GetProcessorOwner, SetProcessorOwner);
        }
예제 #6
0
 public AssemblyDefinition(IAssemblyDescriptor info)
     : base(new MetadataToken(MetadataTokenType.Assembly))
 {
     _name                = new LazyValue <string>(info.Name);
     Version              = info.Version;
     _culture             = new LazyValue <string>(info.Culture);
     _publicKey           = new LazyValue <DataBlobSignature>(info.PublicKeyToken == null ? null : new DataBlobSignature(info.PublicKeyToken));
     Modules              = new DelegatedMemberCollection <AssemblyDefinition, ModuleDefinition>(this, GetModuleOwner, SetModuleOwner);
     AssemblyReferences   = new Collection <AssemblyReference>();
     ModuleReferences     = new Collection <ModuleReference>();
     SecurityDeclarations = new SecurityDeclarationCollection(this);
     Resources            = new Collection <ManifestResource>();
     Files                = new Collection <FileReference>();
     OperatingSystems     = new DelegatedMemberCollection <AssemblyDefinition, AssemblyOs>(this, GetOsOwner, SetOsOwner);
     Processors           = new DelegatedMemberCollection <AssemblyDefinition, AssemblyProcessor>(this, GetProcessorOwner, SetProcessorOwner);
 }
예제 #7
0
 public AssemblyDefinition(string name, Version version)
     : base(new MetadataToken(MetadataTokenType.Assembly))
 {
     _name                = new LazyValue <string>(name);
     _version             = version;
     _culture             = new LazyValue <string>();
     _publicKey           = new LazyValue <DataBlobSignature>();
     Modules              = new DelegatedMemberCollection <AssemblyDefinition, ModuleDefinition>(this, GetModuleOwner, SetModuleOwner);
     AssemblyReferences   = new Collection <AssemblyReference>();
     ModuleReferences     = new Collection <ModuleReference>();
     CustomAttributes     = new CustomAttributeCollection(this);
     SecurityDeclarations = new SecurityDeclarationCollection(this);
     Resources            = new Collection <ManifestResource>();
     Files                = new Collection <FileReference>();
     OperatingSystems     = new DelegatedMemberCollection <AssemblyDefinition, AssemblyOs>(this, GetOsOwner, SetOsOwner);
     Processors           = new DelegatedMemberCollection <AssemblyDefinition, AssemblyProcessor>(this, GetProcessorOwner, SetProcessorOwner);
 }
예제 #8
0
        public TypeDefinition(string @namespace, string name, TypeAttributes attributes, ITypeDefOrRef baseType = null)
            : base(new MetadataToken(MetadataTokenType.TypeDef))
        {
            Attributes = attributes;
            _namespace = new LazyValue <string>(@namespace);
            _name      = new LazyValue <string>(name);
            _baseType  = new LazyValue <ITypeDefOrRef>(baseType);
            Fields     = new DelegatedMemberCollection <TypeDefinition, FieldDefinition>(this, GetFieldOwner, SetFieldOwner);
            Methods    = new DelegatedMemberCollection <TypeDefinition, MethodDefinition>(this, GetMethodOwner, SetMethodOwner);

            _classLayout   = new LazyValue <ClassLayout>();
            _propertyMap   = new LazyValue <PropertyMap>();
            _eventMap      = new LazyValue <EventMap>();
            _declaringType = new LazyValue <TypeDefinition>();

            CustomAttributes      = new CustomAttributeCollection(this);
            SecurityDeclarations  = new SecurityDeclarationCollection(this);
            NestedClasses         = new NestedClassCollection(this);
            GenericParameters     = new GenericParameterCollection(this);
            Interfaces            = new InterfaceImplementationCollection(this);
            MethodImplementations = new MethodImplementationCollection(this);
        }
예제 #9
0
파일: EventMap.cs 프로젝트: xuhaoa/WinPIT
 public EventMap()
     : base(new MetadataToken(MetadataTokenType.EventMap))
 {
     _parent = new LazyValue <TypeDefinition>();
     Events  = new DelegatedMemberCollection <EventMap, EventDefinition>(this, GetEventOwner, SetEventOwner);
 }