public OWTypeDef(ITlibNode parent, ITypeInfo ti, TypeAttr ta) { Parent = parent; _ta = ta; _ti = ti; string prefix = string.Empty; if (VarEnum.VT_PTR == ((VarEnum)_ta.tdescAlias.vt & VarEnum.VT_PTR)) { var otd = _ta.tdescAlias.lptdsec; _ti.GetRefTypeInfo(otd.hreftype, out _oti); prefix = _oti.GetName() + " "; } else if (VarEnum.VT_ARRAY == ((VarEnum)_ta.tdescAlias.vt & VarEnum.VT_ARRAY)) { var oad = ta.tdescAlias.lpadesc; _ti.GetRefTypeInfo(oad.tdescElem.hreftype, out _oti); prefix = _oti.GetName() + " "; } else { _ti.GetRefTypeInfo(_ta.tdescAlias.hreftype, out _oti); prefix = _oti.GetName() + " "; } _name = prefix + ti.GetName(); _data = new IDLData(this); }
public OWEnum(ITlibNode parent, ITypeInfo ti, TypeAttr ta) { Parent = parent; _name = ti.GetName(); _ta = ta; _ti = ti; }
public OWTypeDef(ITlibNode parent, ITypeInfo ti, TypeAttr ta) { Parent = parent; _ta = ta; _ti = ti; string prefix = string.Empty; if (VarEnum.VT_ARRAY == ((VarEnum)_ta.tdescAlias.vt & VarEnum.VT_ARRAY)) { var oad = ta.tdescAlias.lpadesc; _ti.GetRefTypeInfo(oad.tdescElem.hreftype, out _oti); prefix = _oti.GetName() + " "; } else { TmpIdlFormatter tmp = new TmpIdlFormatter(); _ta.tdescAlias.ComTypeNameAsString(ti, tmp); prefix = tmp.data + " "; if (VarEnum.VT_USERDEFINED == (VarEnum)_ta.tdescAlias.vt) { _ti.GetRefTypeInfo(_ta.tdescAlias.hreftype, out _oti); } } _name = prefix + ti.GetName(); _data = new IDLData(this); }
public OWRecord(ITlibNode parent, ITypeInfo ti, TypeAttr ta) { Parent = parent; _ti = ti; _ta = ta; _name = _ti.GetName(); }
public OWModule(ITlibNode parent, ITypeInfo ti, TypeAttr ta) { Parent = parent; _ti = ti; _ta = ta; _name = _ti.GetName(); if (_ta.cVars <= 0 && _ta.cFuncs <= 0) { return; } var tix = new olewoo_interop.ITypeInfoXtra(); if (_ta.cFuncs > 0) { var fd = new FuncDesc(_ti, 0); var invkind = fd.invkind; var memid = fd.memid; _dllname = tix.GetDllEntry(ti, invkind, memid); } else { _dllname = null; } _data = new IDLData(this); }
public OWInterface(ITlibNode parent, ITypeInfo ti, TypeAttr ta, bool topLevel) { Parent = parent; _name = ti.GetName(); _ta = ta; _ti = ti; _topLevel = topLevel; }
public OWEnum(ITlibNode parent, ITypeInfo ti, TypeAttr ta) { Parent = parent; _name = ti.GetName(); _ta = ta; _ti = ti; _data = new IDLData(this); }
public OWTypeDef(ITlibNode parent, ITypeInfo ti, TypeAttr ta) { Parent = parent; _ta = ta; _ti = ti; _ti.GetRefTypeInfo(_ta.tdescAlias.hreftype, out var oti); _name = oti.GetName() + " " + ti.GetName(); }
public OWCoClassInterface(ITlibNode parent, ITypeInfo ti, IMPLTYPEFLAGS impltypeflags) { Parent = parent; Listeners = parent.Listeners; _ti = ti; _flags = impltypeflags; _name = _ti.GetName(); _data = new IDLData(this); }
public OWDispInterface(ITlibNode parent, ITypeInfo ti, TypeAttr ta, bool topLevel) { Parent = parent; _name = ti.GetName(); _ta = ta; _ti = ti; _methodChildren = new OWIDispatchMethods(this); _propChildren = new OWIDispatchProperties(this); _topLevel = topLevel; _data = new IDLData(this); }
public static Guid GetOrCreateGuid(this ITypeInfo typeInfo) { var guid = typeInfo.GetGuid(); if (guid != Guid.Empty) { return(guid); } var guidBytes = typeInfo.GetContainingTypeLib().GetGuid().ToByteArray(); var nameBytes = BitConverter.GetBytes(typeInfo.GetName().GetDigestAsUInt64()); for (var index = 0; index < guidBytes.Length; index++) { guidBytes[index] ^= nameBytes[index % nameBytes.Length]; } return(new Guid(guidBytes)); }
public static IPropertyBag GetTypeLibEnums(this ITypeInfo typeInfo) { var typeLib = typeInfo.GetContainingTypeLib(); var typeLibName = typeLib.GetName(); var rootNode = new PropertyBag(true); var typeInfoCount = typeLib.GetTypeInfoCount(); for (var typeInfoIndex = 0; typeInfoIndex < typeInfoCount; typeInfoIndex++) { typeLib.GetTypeInfo(typeInfoIndex, out typeInfo); var typeInfoName = typeInfo.GetName(); var typeAttr = typeInfo.GetTypeAttr(); if (typeAttr.typekind == TYPEKIND.TKIND_ALIAS) { ITypeInfo refTypeInfo; typeInfo.GetRefTypeInfo(unchecked ((int)(long)typeAttr.tdescAlias.lpValue), out refTypeInfo); typeInfo = refTypeInfo; typeAttr = typeInfo.GetTypeAttr(); } if (typeAttr.typekind == TYPEKIND.TKIND_ENUM) { var varCount = typeAttr.cVars; for (var varIndex = 0; varIndex < varCount; varIndex++) { IntPtr pVarDesc; typeInfo.GetVarDesc(varIndex, out pVarDesc); try { var varDesc = (VARDESC)Marshal.PtrToStructure(pVarDesc, typeof(VARDESC)); if (varDesc.varkind == VARKIND.VAR_CONST) { var varName = typeInfo.GetMemberName(varDesc.memid); object typeLibNodeObj; if (!rootNode.TryGetValue(typeLibName, out typeLibNodeObj) || !(typeLibNodeObj is PropertyBag)) { typeLibNodeObj = new PropertyBag(true); rootNode.SetPropertyNoCheck(typeLibName, typeLibNodeObj); } object typeInfoNodeObj; var typeLibNode = (PropertyBag)typeLibNodeObj; if (!typeLibNode.TryGetValue(typeInfoName, out typeInfoNodeObj) || !(typeInfoNodeObj is PropertyBag)) { typeInfoNodeObj = new PropertyBag(true); typeLibNode.SetPropertyNoCheck(typeInfoName, typeInfoNodeObj); } var typeInfoNode = (PropertyBag)typeInfoNodeObj; typeInfoNode.SetPropertyNoCheck(varName, Marshal.GetObjectForNativeVariant(varDesc.desc.lpvarValue)); } } finally { typeInfo.ReleaseVarDesc(pVarDesc); } } } } return(rootNode); }