GetImplementedCategories() public static method

Returns the implemented categories for the class.
public static GetImplementedCategories ( System.Guid clsid ) : List
clsid System.Guid
return List
コード例 #1
0
ファイル: PseudoComServer.cs プロジェクト: fr830/OPCUA.NET
        /// <summary>
        /// Loads the endpoint information from the registry.
        /// </summary>
        public static ConfiguredEndpoint Load(Guid clsid)
        {
            // load the configuration.
            ConfiguredEndpoint endpoint = LoadConfiguredEndpoint(clsid);

            // create a dummy configuration.
            if (endpoint == null)
            {
                ApplicationDescription server = new ApplicationDescription();

                server.ApplicationName = "(Missing Configuration File)";
                server.ApplicationType = ApplicationType.Server;
                server.ApplicationUri  = clsid.ToString();

                endpoint = new ConfiguredEndpoint(server, null);
            }

            // update the COM identity based on what is actually in the registry.
            endpoint.ComIdentity        = new EndpointComIdentity();
            endpoint.ComIdentity.Clsid  = clsid;
            endpoint.ComIdentity.ProgId = ConfigUtils.ProgIDFromCLSID(clsid);

            List <Guid> categories = ConfigUtils.GetImplementedCategories(clsid);

            for (int ii = 0; ii < categories.Count; ii++)
            {
                if (categories[ii] == ConfigUtils.CATID_OPCDAServer20)
                {
                    endpoint.ComIdentity.Specification = ComSpecification.DA;
                    break;
                }

                if (categories[ii] == ConfigUtils.CATID_OPCDAServer30)
                {
                    endpoint.ComIdentity.Specification = ComSpecification.DA;
                    break;
                }

                if (categories[ii] == ConfigUtils.CATID_OPCAEServer10)
                {
                    endpoint.ComIdentity.Specification = ComSpecification.AE;
                    break;
                }

                if (categories[ii] == ConfigUtils.CATID_OPCHDAServer10)
                {
                    endpoint.ComIdentity.Specification = ComSpecification.HDA;
                    break;
                }
            }

            return(endpoint);
        }
コード例 #2
0
        /// <summary>
        /// Gets the available servers.
        /// </summary>
        /// <param name="factory">The factory.</param>
        /// <param name="specification">The specification.</param>
        private void GetAvailableServers(Opc.Ua.Com.ServerFactory factory, Specification specification)
        {
            Uri[] serverUrls = factory.GetAvailableServers(specification);

            for (int ii = 0; ii < serverUrls.Length; ii++)
            {
                ComServerDescription server = factory.ParseUrl(serverUrls[ii]);

                // don't wrap proxies.
                if (ConfigUtils.CLSID_UaComDaProxyServer == server.Clsid)
                {
                    continue;
                }

                if (ConfigUtils.CLSID_UaComAeProxyServer == server.Clsid)
                {
                    continue;
                }

                if (ConfigUtils.CLSID_UaComHdaProxyServer == server.Clsid)
                {
                    continue;
                }

                // don't wrap UA psuedo-servers.
                List <Guid> catids = ConfigUtils.GetImplementedCategories(server.Clsid);

                bool suppress = false;

                for (int jj = 0; jj < catids.Count; jj++)
                {
                    if (catids[jj] == ConfigUtils.CATID_PseudoComServers)
                    {
                        suppress = true;
                        break;
                    }
                }

                if (suppress)
                {
                    continue;
                }

                // assume regular COM server.
                ListViewItem item = new ListViewItem(server.ProgId);
                item.SubItems.Add(server.Description);
                item.SubItems.Add(specification.ToString());
                item.Tag = new Item(specification, server);

                ServersLV.Items.Add(item);
            }
        }