コード例 #1
0
        /// <summary>
        /// Creates the .NET metadata chunks (constants, method bodies, .NET resources,
        /// the metadata, and Win32 resources)
        /// </summary>
        /// <param name="module"></param>
        protected void CreateMetaDataChunks(ModuleDef module)
        {
            constants    = new UniqueChunkList <ByteArrayChunk>();
            methodBodies = new MethodBodyChunks(TheOptions.ShareMethodBodies);
            netResources = new NetResources(DEFAULT_NETRESOURCES_ALIGNMENT);

            metaData          = MetaData.Create(module, constants, methodBodies, netResources, TheOptions.MetaDataOptions);
            metaData.Logger   = TheOptions.MetaDataLogger ?? this;
            metaData.Listener = this;

            // StrongNamePublicKey is used if the user wants to override the assembly's
            // public key or when enhanced strong naming the assembly.
            var pk = TheOptions.StrongNamePublicKey;

            if (pk != null)
            {
                metaData.AssemblyPublicKey = pk.CreatePublicKey();
            }
            else if (TheOptions.StrongNameKey != null)
            {
                metaData.AssemblyPublicKey = TheOptions.StrongNameKey.PublicKey;
            }

            var w32Resources = GetWin32Resources();

            if (w32Resources != null)
            {
                win32Resources = new Win32ResourcesChunk(w32Resources);
            }
        }
コード例 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="module">Module</param>
 /// <param name="constants">Constants list</param>
 /// <param name="methodBodies">Method bodies list</param>
 /// <param name="netResources">.NET resources list</param>
 /// <param name="options">Options</param>
 public NormalMetaData(ModuleDef module, UniqueChunkList <ByteArrayChunk> constants, MethodBodyChunks methodBodies, NetResources netResources, MetaDataOptions options)
     : base(module, constants, methodBodies, netResources, options)
 {
 }