internal ComStructInfo(TypeLibrary typeLib,
                               TYPEKIND typeKind,
                               int index) :
            base(typeLib, typeKind, index)
        {
            switch (typeKind)
            {
            case TYPEKIND.TKIND_ENUM:
                _infoType = "Enum";
                break;

            case TYPEKIND.TKIND_MODULE:
                _infoType = "Module";
                break;

            case TYPEKIND.TKIND_RECORD:
                _infoType = "Struct";
                break;

            case TYPEKIND.TKIND_UNION:
                _infoType = "Union";
                break;
            }

            TYPEATTR typeAttr;
            IntPtr   typeAttrPtr;

            _typeInfo.GetTypeAttr(out typeAttrPtr);
            typeAttr =
                (TYPEATTR)Marshal.PtrToStructure(typeAttrPtr,
                                                 typeof(TYPEATTR));

            for (int i = 0; i < typeAttr.cVars; i++)
            {
                ComVariableInfo mi = new ComVariableInfo(this,
                                                         _typeKind,
                                                         _typeInfo,
                                                         i);
                _members.Add(mi);
            }

            _typeInfo.ReleaseTypeAttr(typeAttrPtr);

            if (TraceUtil.If(this, TraceLevel.Verbose))
            {
                Trace.WriteLine("Struct: " + _name);
            }
        }
Ejemplo n.º 2
0
		internal ComStructInfo(TypeLibrary typeLib, 
							   TYPEKIND typeKind,
							   int index) : 
				base(typeLib, typeKind, index)
		{
			switch (typeKind)
			{
			case TYPEKIND.TKIND_ENUM:
				_infoType = "Enum";
				break;
			case TYPEKIND.TKIND_MODULE:
				_infoType = "Module";
				break;
			case TYPEKIND.TKIND_RECORD:
				_infoType = "Struct";
				break;
			case TYPEKIND.TKIND_UNION:
				_infoType = "Union";
				break;
			}

			TYPEATTR typeAttr;
			IntPtr typeAttrPtr;
			_typeInfo.GetTypeAttr(out typeAttrPtr);
			typeAttr = 
				(TYPEATTR)Marshal.PtrToStructure(typeAttrPtr, 
												 typeof(TYPEATTR));

			for (int i = 0; i < typeAttr.cVars; i++)
			{
				ComVariableInfo mi = new ComVariableInfo(this,
														 _typeKind,
														 _typeInfo,
														 i);
				_members.Add(mi);
			}

			_typeInfo.ReleaseTypeAttr(typeAttrPtr);

			if (TraceUtil.If(this, TraceLevel.Verbose))
				Trace.WriteLine("Struct: " + _name);
		}