Opc.Ua.Configuration.ConfigUtils.GetImplementedCategories C# (CSharp) Method

GetImplementedCategories() public static method

Returns the implemented categories for the class.
public static GetImplementedCategories ( System.Guid clsid ) : List
clsid System.Guid
return List
        public static List<Guid> GetImplementedCategories(Guid clsid)
        {
            List<Guid> categories = new List<Guid>();

			string categoriesKey = String.Format(@"CLSID\{{{0}}}\Implemented Categories", clsid);
			
			RegistryKey key = Registry.ClassesRoot.OpenSubKey(categoriesKey);

			if (key != null)
			{
                try
                {
				    foreach (string catid in key.GetSubKeyNames())
				    {
                        try
                        {
                            Guid guid = new Guid(catid.Substring(1, catid.Length-2));
                            categories.Add(guid);
                        }
                        catch (Exception)
                        {
                            // ignore invalid keys.
                        }
				    }
                }
                finally
                {
                    key.Close();
                }
			}

            return categories;
        }

Usage Example

コード例 #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);
        }
All Usage Examples Of Opc.Ua.Configuration.ConfigUtils::GetImplementedCategories