Ejemplo n.º 1
0
        protected COMSearchResult FindComponent(string applicationName, string componentName)
        {
            COMSearchResult searchResult = null;
            ICatalogCollection appCatalog = (ICatalogCollection)ComAdminCatalog.GetCollection(COMConstants.APPLICATIONS_CATALOG_NAME);
            appCatalog.Populate();
            foreach (COMAdminCatalogObject application in appCatalog)
            {
                if (!application.Name.Equals(applicationName)) continue;

                ICatalogCollection componentCatalog = (ICatalogCollection)appCatalog.GetCollection(COMConstants.COMPONENTS_CATALOG_NAME, application.Key);
                componentCatalog.Populate();
                int index = 0;
                foreach (COMAdminCatalogObject comComp in componentCatalog)
                {
                    if (((string)comComp.Name).Equals(componentName, StringComparison.InvariantCultureIgnoreCase))
                    {
                        searchResult = new COMSearchResult(componentCatalog, comComp, index);
                    }
                }
                ++index;

                Marshal.ReleaseComObject(appCatalog);
                if (searchResult != null)
                {
                    return searchResult;
                }
                else
                {
                    return new COMSearchResult(componentCatalog, true);
                }
            }

            return new COMSearchResult(appCatalog, true);
        }
Ejemplo n.º 2
0
        protected COMSearchResult FindApplication(string name)
        {
            COMSearchResult searchResult = null;
            ICatalogCollection appCatalog = (ICatalogCollection)ComAdminCatalog.GetCollection(COMConstants.APPLICATIONS_CATALOG_NAME);
            appCatalog.Populate();
            int index = 0;
            foreach (COMAdminCatalogObject application in appCatalog)
            {
                if (application.Name.Equals(name))
                {
                    searchResult = new COMSearchResult(appCatalog, application, index);
                }
                ++index;
            }

            if (searchResult != null)
            {
                return searchResult;
            }
            else
            {
                return new COMSearchResult(appCatalog, true);
            }
        }