Beispiel #1
0
        private ClrInterface GetInterface(MetaDataImport import, int mdIFace)
        {
            ClrInterface result = null;

            if (!import.GetTypeDefProperties(mdIFace, out string name, out TypeAttributes attrs, out int extends))
            {
                name = import.GetTypeRefName(mdIFace);
            }

            // TODO:  Handle typespec case.
            if (name != null && !DesktopHeap.Interfaces.TryGetValue(name, out result))
            {
                ClrInterface type = null;
                if (extends != 0 && extends != 0x01000000)
                {
                    type = GetInterface(import, extends);
                }

                result = new DesktopHeapInterface(name, type);
                DesktopHeap.Interfaces[name] = result;
            }

            return(result);
        }
Beispiel #2
0
        private ClrInterface GetInterface(ICorDebug.IMetadataImport import, int mdIFace)
        {
            StringBuilder builder = new StringBuilder(1024);
            int extends, cnt;
            System.Reflection.TypeAttributes attr;
            int res = import.GetTypeDefProps(mdIFace, builder, builder.Capacity, out cnt, out attr, out extends);
            int scope;

            string name = null;
            ClrInterface result = null;
            if (res == 0)
            {
                name = builder.ToString();
            }
            else if (res == 1)
            {
                res = import.GetTypeRefProps(mdIFace, out scope, builder, builder.Capacity, out cnt);
                if (res == 0)
                {
                    name = builder.ToString();
                }
                else if (res == 1)
                {
                }
            }

            // TODO:  Handle typespec case.

            if (name != null && !DesktopHeap.Interfaces.TryGetValue(name, out result))
            {
                ClrInterface type = null;
                if (extends != 0 && extends != 0x01000000)
                    type = GetInterface(import, extends);

                result = new DesktopHeapInterface(name, type);
                DesktopHeap.Interfaces[name] = result;
            }

            return result;
        }
Beispiel #3
0
        ClrInterface GetInterface(IMetadata import, int mdIFace)
        {
            StringBuilder builder = new StringBuilder(1024);
            int extends, cnt;
            System.Reflection.TypeAttributes attr;
            int res = import.GetTypeDefProps(mdIFace, builder, builder.Capacity, out cnt, out attr, out extends);
            int scope;

            string name = null;
            ClrInterface result = null;
            if (res == 0)
            {
                name = builder.ToString();
            }
            else if (res == 1)
            {
                res = import.GetTypeRefProps(mdIFace, out scope, builder, builder.Capacity, out cnt);
                if (res == 0)
                    name = builder.ToString();
            }

            if (!m_heap.m_interfaces.TryGetValue(name, out result))
            {
                ClrInterface type = null;
                if (extends != 0 && extends != 0x01000000)
                    type = GetInterface(import, extends);

                result = new DesktopHeapInterface(name, type);
                m_heap.m_interfaces[name] = result;
            }

            return result;
        }