Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 7
0
 public ComUnionInfo(ComTypeLibrary parent, ITypeInfo typeInfo, IntPtr pTypeAttr)
     : base(parent, typeInfo, pTypeAttr)
 {
 }
Ejemplo n.º 8
0
 public ComDispatchInfo(ComTypeLibrary parent, ITypeInfo typeInfo, IntPtr pTypeAttr)
     : base(parent, typeInfo, pTypeAttr)
 {
 }