예제 #1
0
        void LoadTypelibs(RegistryKey rootKey)
        {
            Dictionary <Guid, COMTypeLibEntry> typelibs = new Dictionary <Guid, COMTypeLibEntry>();

            using (RegistryKey key = rootKey.OpenSubKey("TypeLib"))
            {
                if (key != null)
                {
                    string[] subkeys = key.GetSubKeyNames();
                    foreach (string s in subkeys)
                    {
                        Guid g;

                        if (Guid.TryParse(s, out g))
                        {
                            using (RegistryKey subKey = key.OpenSubKey(s))
                            {
                                if (subKey != null)
                                {
                                    COMTypeLibEntry typelib = new COMTypeLibEntry(g, subKey);

                                    typelibs[g] = typelib;
                                }
                            }
                        }
                    }
                }
            }

            m_typelibs = new SortedDictionary <Guid, COMTypeLibEntry>(typelibs);
        }
예제 #2
0
        public COMTypeLibVersionEntry GetTypeLibVersionEntry(Guid typelib, string version)
        {
            if (!m_typelibs.ContainsKey(typelib))
            {
                return(null);
            }

            COMTypeLibEntry entry = m_typelibs[typelib];

            foreach (var ver in entry.Versions)
            {
                if (version == null || ver.Version == version)
                {
                    return(ver);
                }
            }

            return(null);
        }
예제 #3
0
        void LoadTypelibs(RegistryKey rootKey, ActivationContext actctx)
        {
            Dictionary <Guid, COMTypeLibEntry> typelibs = new Dictionary <Guid, COMTypeLibEntry>();

            if (actctx != null)
            {
                foreach (var typelib in actctx.ComTypeLibs)
                {
                    typelibs[typelib.TypeLibraryId] = new COMTypeLibEntry(this, typelib);
                }
            }

            using (RegistryKey key = rootKey.OpenSubKey("TypeLib"))
            {
                if (key != null)
                {
                    string[] subkeys = key.GetSubKeyNames();
                    foreach (string s in subkeys)
                    {
                        Guid g;

                        if (Guid.TryParse(s, out g))
                        {
                            using (RegistryKey subKey = key.OpenSubKey(s))
                            {
                                if (subKey != null)
                                {
                                    COMTypeLibEntry typelib = new COMTypeLibEntry(this, g, subKey);

                                    typelibs[g] = typelib;
                                }
                            }
                        }
                    }
                }
            }

            m_typelibs = new SortedDictionary <Guid, COMTypeLibEntry>(typelibs);
        }