public ComTypeInfo(ComTypeLibrary comTypeLibrary, ITypeInfo typeInfo, IntPtr pTypeAttr) { _comTypeLibrary = comTypeLibrary; _typeInfo = typeInfo; _pTypeAttr = pTypeAttr; _typeAttr = _pTypeAttr.ToStructure <System.Runtime.InteropServices.ComTypes.TYPEATTR>(); _typeInfo.GetDocumentation(-1, out _name, out _description, out _helpContext, out _helpFile); }
public ComTypeLibrary LoadRegTypeLib(Guid guid, Version version) { ComTypeLibrary comTypeLibrary = null; try { ITypeLib typeLib = NativeMethods.LoadRegTypeLib(guid, (short)version.Major, (short)version.Minor); comTypeLibrary = GetComTypeLibrary(typeLib); } catch { GlobalExceptionHandler.HandleException(); } return(comTypeLibrary); }
public bool HasComType(string fullName) { string[] tokens = fullName.Split(new char[] { '.' }); if (tokens.Length == 2) { ComTypeLibrary comTypeLibrary = _typeLibraries.Where(x => x.Name.Equals(tokens[0])).FirstOrDefault(); if (comTypeLibrary != null) { ComTypeInfo comTypeInfo = comTypeLibrary.ComTypeInfos.Where(x => x.Name.Equals(tokens[1])).FirstOrDefault(); if (comTypeInfo != null) { return(true); } } } return(false); }
private ComTypeLibrary GetComTypeLibrary(ITypeLib typeLib) { Guid typeLibGuid = typeLib.GetGuid(); Version typeLibVersion = typeLib.GetVersion(); ComTypeLibrary comTypeLibrary = _typeLibraries.Where( x => x.Guid.Equals(typeLibGuid)).Where( x => x.Version.Equals(typeLibVersion) ).FirstOrDefault(); if (comTypeLibrary == null) { comTypeLibrary = new ComTypeLibrary(typeLib); _typeLibraries.Add(comTypeLibrary); _typeLibraries.Sort(delegate(ComTypeLibrary a, ComTypeLibrary b) { return(a.Name.CompareTo(b.Name)); }); } return(comTypeLibrary); }
public ComTypeInfo FromITypeInfo(ITypeInfo typeInfo) { if (typeInfo == null) { return(null); } ITypeLib typeLib = null; int index = 0; typeInfo.GetContainingTypeLib(out typeLib, out index); ComTypeLibrary comTypeLibrary = GetComTypeLibrary(typeLib); string typeName = Marshal.GetTypeInfoName(typeInfo); if (comTypeLibrary != null) { return(comTypeLibrary.ComTypeInfos.Where( x => x.Name.Equals(typeName)).FirstOrDefault()); } return(null); }
public void LookupAndSelect(string name) { if (String.IsNullOrWhiteSpace(name)) { return; } string[] tokens = name.Split(new char[] { '.' }); ComTypeLibrary comTypeLibrary = null; ComTypeInfo comTypeInfo = null; if (tokens.Length == 1) { comTypeLibrary = _typeLibraries.Where(x => x.Name.Equals(tokens[0])).FirstOrDefault(); if (comTypeLibrary != null) { if (ComTypeLibrarySelected != null) { ComTypeLibrarySelected(this, comTypeLibrary); } } } else if (tokens.Length == 2) { comTypeLibrary = _typeLibraries.Where(x => x.Name.Equals(tokens[0])).FirstOrDefault(); if (comTypeLibrary != null) { comTypeInfo = comTypeLibrary.ComTypeInfos.Where(x => x.Name.Equals(tokens[1])).FirstOrDefault(); if ((comTypeInfo != null) && (ComTypeInfoSelected != null)) { ComTypeInfoSelected(this, comTypeInfo); } } } }
public ComUnionInfo(ComTypeLibrary parent, ITypeInfo typeInfo, IntPtr pTypeAttr) : base(parent, typeInfo, pTypeAttr) { }
public ComDispatchInfo(ComTypeLibrary parent, ITypeInfo typeInfo, IntPtr pTypeAttr) : base(parent, typeInfo, pTypeAttr) { }