Opc.Ua.Configuration.PseudoComServer.Load C# (CSharp) Method

Load() public static method

Loads the endpoint information from the registry.
public static Load ( System.Guid clsid ) : ConfiguredEndpoint
clsid System.Guid
return ConfiguredEndpoint
        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;
        }