Exemplo n.º 1
0
        private ITypeInfo2 GetReferencedTypeInfo(ITypeInfo2 typeInfo, uint reference)
        {
            ITypeInfo refTypeInfo;

            typeInfo.GetRefTypeInfo(reference, out refTypeInfo);
            comObjects.Add(refTypeInfo);
            ITypeInfo2 result = (ITypeInfo2)refTypeInfo;

            referencedTypes.Add(result);
            return(result);
        }
Exemplo n.º 2
0
 public TypeInfo(ITypeInfo typeinfo)
 {
     m_typeInfo = typeinfo;
     m_typeInfo2 = m_typeInfo as ITypeInfo2;
 }
Exemplo n.º 3
0
        public TypeDesc(ITypeInfo2 typeInfo, Func<ITypeInfo2, uint, TypeDesc> typeFactory, Func<ITypeInfo2, uint, ITypeInfo2> typeInfoFactory)
        {
            this.typeInfo = typeInfo;
            this.typeFactory = typeFactory;

            char* name = null;
            char* docString = null;
            char* helpFile = null;
            try
            {
                uint i1;
                typeInfo.GetDocumentation(NativeConstants.MEMBERID_NIL, out name, out docString, out i1, out helpFile);
                Name = new string(name);
                Name = EscapeTypeName(Name);
            }
            finally
            {
                if (name != null)
                    NativeMethods.SysFreeString(name);
                if (docString != null)
                    NativeMethods.SysFreeString(docString);
                if (helpFile != null)
                    NativeMethods.SysFreeString(helpFile);
            }

            InitTypeAttr();

            if (this.typeAttr.typekind == TYPEKIND.TKIND_ALIAS)
            {
                switch (this.typeAttr.tdescAlias.vt & VARENUM.VT_TYPEMASK)
                {
                    case VARENUM.VT_SAFEARRAY:
                    case VARENUM.VT_VARIANT:
                        kind = TypeKind.Struct;
                        break;
                    case VARENUM.VT_UNKNOWN:
                    case VARENUM.VT_DISPATCH:
                        kind = TypeKind.Interface;
                        break;
                    case VARENUM.VT_ERROR:
                    case VARENUM.VT_HRESULT:
                    case VARENUM.VT_LPSTR:
                    case VARENUM.VT_BSTR:
                    case VARENUM.VT_LPWSTR:
                    case VARENUM.VT_NULL:
                    case VARENUM.VT_BOOL:
                    case VARENUM.VT_I1:
                    case VARENUM.VT_I2:
                    case VARENUM.VT_I4:
                    case VARENUM.VT_INT:
                    case VARENUM.VT_I8:
                    case VARENUM.VT_FILETIME:
                    case VARENUM.VT_CY:
                    case VARENUM.VT_UI1:
                    case VARENUM.VT_UI2:
                    case VARENUM.VT_UI4:
                    case VARENUM.VT_UINT:
                    case VARENUM.VT_UI8:
                    case VARENUM.VT_R4:
                    case VARENUM.VT_R8:
                    case VARENUM.VT_DATE:
                    case VARENUM.VT_DECIMAL:
                    case VARENUM.VT_VOID:
                    case VARENUM.VT_INT_PTR:
                    case VARENUM.VT_UINT_PTR:
                        kind = TypeKind.System;
                        break;
                    case VARENUM.VT_USERDEFINED:
                        this.typeInfo = typeInfoFactory(typeInfo, this.typeAttr.tdescAlias.__union1.hreftype);
                        InitTypeAttr();
                        break;
                    default:
                        throw new Exception("Variant type " + this.typeAttr.tdescAlias.vt + " is not supported");
                }
            }
        }
Exemplo n.º 4
0
 private ITypeInfo2 GetReferencedTypeInfo(ITypeInfo2 typeInfo, uint reference)
 {
     ITypeInfo refTypeInfo;
     typeInfo.GetRefTypeInfo(reference, out refTypeInfo);
     comObjects.Add(refTypeInfo);
     ITypeInfo2 result = (ITypeInfo2)refTypeInfo;
     referencedTypes.Add(result);
     return result;
 }
Exemplo n.º 5
0
 private TypeDesc GetReferencedType(ITypeInfo2 typeInfo, uint reference)
 {
     return new TypeDesc(GetReferencedTypeInfo(typeInfo, reference), GetReferencedType, GetReferencedTypeInfo);
 }
Exemplo n.º 6
0
 private TypeDesc GetReferencedType(ITypeInfo2 typeInfo, uint reference)
 {
     return(new TypeDesc(GetReferencedTypeInfo(typeInfo, reference), GetReferencedType, GetReferencedTypeInfo));
 }
Exemplo n.º 7
0
        public TypeDesc(ITypeInfo2 typeInfo, Func <ITypeInfo2, uint, TypeDesc> typeFactory, Func <ITypeInfo2, uint, ITypeInfo2> typeInfoFactory)
        {
            this.typeInfo    = typeInfo;
            this.typeFactory = typeFactory;

            char *name      = null;
            char *docString = null;
            char *helpFile  = null;

            try
            {
                uint i1;
                typeInfo.GetDocumentation(NativeConstants.MEMBERID_NIL, out name, out docString, out i1, out helpFile);
                Name = new string(name);
                Name = EscapeTypeName(Name);
            }
            finally
            {
                if (name != null)
                {
                    NativeMethods.SysFreeString(name);
                }
                if (docString != null)
                {
                    NativeMethods.SysFreeString(docString);
                }
                if (helpFile != null)
                {
                    NativeMethods.SysFreeString(helpFile);
                }
            }

            InitTypeAttr();

            if (this.typeAttr.typekind == TYPEKIND.TKIND_ALIAS)
            {
                switch (this.typeAttr.tdescAlias.vt & VARENUM.VT_TYPEMASK)
                {
                case VARENUM.VT_SAFEARRAY:
                case VARENUM.VT_VARIANT:
                    kind = TypeKind.Struct;
                    break;

                case VARENUM.VT_UNKNOWN:
                case VARENUM.VT_DISPATCH:
                    kind = TypeKind.Interface;
                    break;

                case VARENUM.VT_ERROR:
                case VARENUM.VT_HRESULT:
                case VARENUM.VT_LPSTR:
                case VARENUM.VT_BSTR:
                case VARENUM.VT_LPWSTR:
                case VARENUM.VT_NULL:
                case VARENUM.VT_BOOL:
                case VARENUM.VT_I1:
                case VARENUM.VT_I2:
                case VARENUM.VT_I4:
                case VARENUM.VT_INT:
                case VARENUM.VT_I8:
                case VARENUM.VT_FILETIME:
                case VARENUM.VT_CY:
                case VARENUM.VT_UI1:
                case VARENUM.VT_UI2:
                case VARENUM.VT_UI4:
                case VARENUM.VT_UINT:
                case VARENUM.VT_UI8:
                case VARENUM.VT_R4:
                case VARENUM.VT_R8:
                case VARENUM.VT_DATE:
                case VARENUM.VT_DECIMAL:
                case VARENUM.VT_VOID:
                case VARENUM.VT_INT_PTR:
                case VARENUM.VT_UINT_PTR:
                    kind = TypeKind.System;
                    break;

                case VARENUM.VT_USERDEFINED:
                    this.typeInfo = typeInfoFactory(typeInfo, this.typeAttr.tdescAlias.__union1.hreftype);
                    InitTypeAttr();
                    break;

                default:
                    throw new Exception("Variant type " + this.typeAttr.tdescAlias.vt + " is not supported");
                }
            }
        }