Ejemplo n.º 1
0
        internal MetadataInfo(InternalMetadataInfo metadataInfo)
        {
            if (metadataInfo is null)
            {
                throw new ArgumentNullException(nameof(metadataInfo));
            }

            IntPtr moduleHandle;

            moduleHandle = Marshal.GetHINSTANCE(metadataInfo.Module);
            if (!(metadataInfo.TableStream is null))
            {
                _tableStream = new MetadataStreamInfo(metadataInfo.TableStream, moduleHandle);
            }
            if (!(metadataInfo.StringHeap is null))
            {
                _stringHeap = new MetadataStreamInfo(metadataInfo.StringHeap, moduleHandle);
            }
            if (!(metadataInfo.UserStringHeap is null))
            {
                _userStringHeap = new MetadataStreamInfo(metadataInfo.UserStringHeap, moduleHandle);
            }
            if (!(metadataInfo.GuidHeap is null))
            {
                _guidHeap = new MetadataStreamInfo(metadataInfo.GuidHeap, moduleHandle);
            }
            if (!(metadataInfo.BlobHeap is null))
            {
                _blobHeap = new MetadataStreamInfo(metadataInfo.BlobHeap, moduleHandle);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get metadata info
        /// </summary>
        /// <param name="moduleHandle"></param>
        /// <returns></returns>
        public string GetMetadataInfo(IntPtr moduleHandle)
        {
            Module       module;
            MetadataInfo metadataInfo;

            module       = GetModuleFromNativeModuleHandle(moduleHandle);
            metadataInfo = new MetadataInfo(InternalMetadataInfo.GetMetadataInfo(module));
            return(XmlSerializer.Serialize(metadataInfo));
        }