Beispiel #1
0
        internal virtual void Setup(TypeLibrary typeLib,
                                    TYPEKIND typeKind,
                                    int index,
                                    UCOMITypeInfo typeInfo,
                                    Guid guid)
        {
            _typeLib  = typeLib;
            _iTypeLib = typeLib.ITypeLib;
            if (typeInfo != null)
            {
                _typeInfo = typeInfo;
            }
            else
            {
                _iTypeLib.GetTypeInfo(index, out _typeInfo);
            }
            if (!guid.Equals(Guid.Empty))
            {
                InitGuid(guid);
            }
            else
            {
                InitGuid(GuidFromTypeInfo(_typeInfo));
            }

            _typeKind = typeKind;
            _presInfo = PresentationMap.GetInfo(_typeKind);
            GetDocumentation(index);
            if (TraceUtil.If(this, TraceLevel.Info))
            {
                Trace.WriteLine(this, "Basic: " + typeKind + " " + this);
            }
        }
        // Constructor when reading from the registry "classes" section
        internal ComInterfaceInfo(RegistryKey classKey,
                                  String guidStr) :
            base(classKey, guidStr)
        {
            Init();
            Name      = (String)classKey.GetValue(null);
            _typeKind = TYPEKIND.TKIND_INTERFACE;
            _presInfo = PresentationMap.GetInfo(_typeKind);
            // See if there is type lib information (note this
            // is different than the way TypeLibs work in the class node)
            RegistryKey key = _regKey.OpenSubKey("TypeLib");

            if (key != null)
            {
                _typeLibString  = (String)key.GetValue(null);
                _typeLibVersion = (String)key.GetValue("Version");
            }
        }
            public int Compare(Object o1, Object o2)
            {
                MemberInfo       m1  = (MemberInfo)o1;
                MemberInfo       m2  = (MemberInfo)o2;
                PresentationInfo mt1 = PresentationMap.GetInfo(m1.MemberType);
                PresentationInfo mt2 = PresentationMap.GetInfo(m2.MemberType);

                if (mt1._sortOrder > mt2._sortOrder)
                {
                    return(1);
                }
                if (mt1._sortOrder < mt2._sortOrder)
                {
                    return(-1);
                }

                return(m1.Name.CompareTo(m2.Name));
            }
        internal ObjectTypeTreeNode(bool comNode,
                                    ObjectInfo objInfo,
                                    MemberInfo member,
                                    bool useIntermediates) : this(comNode, objInfo)
        {
            PresentationInfo pi = PresentationMap.GetInfo(member.MemberType);


            // Needs an intermediate node for the base class type
            if (useIntermediates &&
                ComponentInspectorProperties.ShowBaseCategories &&
                !_objInfo.ObjParentType.Equals(member.DeclaringType))
            {
                PresentationInfo basePi = PresentationMap.GetInfo(PresentationMap.BASE_CLASS);
                _intermediateNodeTypes = new ArrayList();
                _intermediateNodeTypes.Add(basePi._intermediateNodeType);
            }
            else if (ComponentInspectorProperties.ShowObjectAsBaseClass &&
                     (ReflectionHelper.TypeEqualsObject(member.DeclaringType) ||
                      ReflectionHelper.TypeEqualsMarshalByRef(member.DeclaringType) ||
                      NoGoop.Win32.ActiveX.TypeEqualsComRoot(member.DeclaringType)))
            {
                PresentationInfo basePi = PresentationMap.GetInfo(PresentationMap.BASE_CLASS);
                _intermediateNodeTypes = new ArrayList();
                _intermediateNodeTypes.Add(basePi._intermediateNodeType);
            }

            if (useIntermediates && ComponentInspectorProperties.ShowMemberCategories)
            {
                if (_intermediateNodeTypes == null)
                {
                    _intermediateNodeTypes = new ArrayList();
                }
                _intermediateNodeTypes.Add(pi._intermediateNodeType);
            }

            // We can cast a member which can be permanently remembered
            _castInfo = CastInfo.GetCastInfo(member);

            ImageIndex         = pi._iconIndex;
            SelectedImageIndex = ImageIndex;
            _nodeOrder         = pi._sortOrder;
        }
        internal ComMemberInfo(BasicInfo parent,
                               TYPEKIND typeKind,
                               UCOMITypeInfo typeInfo,
                               int index,
                               bool dispatch,
                               FUNCDESC funcDesc) :
            base(typeInfo)
        {
            int actLen;

            String[] memberNames = new String[100];
            _typeInfo.GetNames(funcDesc.memid, memberNames,
                               memberNames.Length,
                               out actLen);

            _memberId = funcDesc.memid;
            // the high order part of the memberId is flags
            // for a dispatch interface
            if (dispatch)
            {
                _memberId &= 0xffff;
                // Make sure we get a 16 bit integer so that negative
                // DISPIDs show up correctly
                _memberId = (Int16)_memberId;
            }
            String docString;

            // Note, use the original unmasked memberId
            _typeInfo.GetDocumentation(funcDesc.memid, out _name,
                                       out docString, out _helpContext,
                                       out _helpFile);
            // Set using property so that nulls are checked
            DocString   = docString;
            _parameters = new ArrayList();
            _typeLib    = parent.TypeLib;
            _index      = index;
            _container  = parent;
            _printName  = _name;
            _nameKey    = (String)_name;
            // Add the DISPID to the dispatch interfaces
            if (dispatch)
            {
                _dispatch   = true;
                _printName += " - " + _memberId;
            }
            if (TraceUtil.If(this, TraceLevel.Verbose))
            {
                Trace.WriteLine("MemberInfo: " + _name);
            }
            _type = TypeLibUtil.TYPEDESCToString
                        (_typeLib,
                        _typeInfo,
                        funcDesc.elemdescFunc.tdesc,
                        TypeLibUtil.COMTYPE);
            if (funcDesc.invkind == INVOKEKIND.INVOKE_FUNC)
            {
                _infoType = "Function";
                _property = false;
                if (funcDesc.cParams > 0)
                {
                    AddParams(funcDesc, memberNames, funcDesc.cParams);
                }
            }
            else
            {
                if (funcDesc.invkind == INVOKEKIND.INVOKE_PROPERTYGET)
                {
                    _printName += " (get)";
                    _nameKey   += NAMEKEY_GET;
                }
                else if (funcDesc.invkind == INVOKEKIND.INVOKE_PROPERTYPUT)
                {
                    _printName += " (put)";
                    _nameKey   += NAMEKEY_SET;
                }
                else if (funcDesc.invkind == INVOKEKIND.INVOKE_PROPERTYPUTREF)
                {
                    _printName += " (put ref)";
                    _nameKey   += NAMEKEY_SETREF;
                }
                _infoType = "Property";
                _property = true;
            }
            _flagsString = FlagsString((FUNCFLAGS)funcDesc.wFuncFlags);
            if (_property)
            {
                _presInfo = PresentationMap.
                            GetInfo(PresentationMap.COM_PROPERTY);
            }
            else
            {
                _presInfo = PresentationMap.
                            GetInfo(PresentationMap.COM_METHOD);
            }
        }
Beispiel #6
0
 protected void Init()
 {
     _infoType = "CoClass";
     _progIds  = new ArrayList();
     _presInfo = PresentationMap.GetInfo(TYPEKIND.TKIND_COCLASS);
 }
Beispiel #7
0
        internal ComVariableInfo(BasicInfo parent,
                                 TYPEKIND typeKind,
                                 UCOMITypeInfo typeInfo,
                                 int index) : base(typeInfo)
        {
            IntPtr          varDescPtr;
            CORRECT_VARDESC varDesc;

            _typeKind  = typeKind;
            _typeLib   = parent.TypeLib;
            _container = parent;
            _index     = index;

            _typeInfo.GetVarDesc(_index, out varDescPtr);
            varDesc = (CORRECT_VARDESC)
                      Marshal.PtrToStructure(varDescPtr,
                                             typeof(CORRECT_VARDESC));

            int actLen;

            String[] memberNames = new String[100];
            _typeInfo.GetNames(varDesc.memid, memberNames,
                               memberNames.Length,
                               out actLen);

            Name = memberNames[0];

            if (TraceUtil.If(this, TraceLevel.Verbose))
            {
                Trace.WriteLine("VariableInfo: " + _name);
            }
            if (_typeKind == TYPEKIND.TKIND_ENUM)
            {
                _infoType = "Constant";
                try
                {
                    Object value = Marshal.GetObjectForNativeVariant
                                       (varDesc.u.lpvarValue);
                    _enumValue = value.ToString();
                }
                catch (Exception ex)
                {
                    _enumValue = "Unknown variant: 0x"
                                 + varDesc.u.lpvarValue.ToInt32().ToString("X");
                    TraceUtil.WriteLineWarning(this,
                                               "Exception reading enum value: " + ex);
                }
            }
            else
            {
                _infoType = "Variable";
            }

            TYPEDESC typeDesc = varDesc.elemdescVar.tdesc;

            _varType = TypeLibUtil.TYPEDESCToString
                           (_typeLib,
                           _typeInfo,
                           typeDesc,
                           TypeLibUtil.COMTYPE);

            _typeInfo.ReleaseVarDesc(varDescPtr);

            _presInfo = PresentationMap.
                        GetInfo(PresentationMap.COM_VARIABLE);
        }
Beispiel #8
0
 internal void SetPresInfo(Object infoObj)
 {
     SetPresInfo(PresentationMap.GetInfo(infoObj));
 }
Beispiel #9
0
 public override Presentation GetPresentationMaps()
 {
     return(new Presentation(PresentationMap.DefaultSonosSearch()));
 }