コード例 #1
0
        /// <summary>
        /// Finds the child with the specified browse name.
        /// </summary>
        protected override BaseInstanceState FindChild(
            ISystemContext context,
            QualifiedName browseName,
            bool createOrReplace,
            BaseInstanceState replacement)
        {
            if (QualifiedName.IsNull(browseName))
            {
                return null;
            }

            BaseInstanceState instance = null;

            switch (browseName.Name)
            {
                case Opc.Ua.Gds.BrowseNames.ServiceUri:
                {
                    if (createOrReplace)
                    {
                        if (ServiceUri == null)
                        {
                            if (replacement == null)
                            {
                                ServiceUri = new PropertyState<string>(this);
                            }
                            else
                            {
                                ServiceUri = (PropertyState<string>)replacement;
                            }
                        }
                    }

                    instance = ServiceUri;
                    break;
                }

                case Opc.Ua.Gds.BrowseNames.Endpoints:
                {
                    if (createOrReplace)
                    {
                        if (Endpoints == null)
                        {
                            if (replacement == null)
                            {
                                Endpoints = new PropertyState<EndpointDescription[]>(this);
                            }
                            else
                            {
                                Endpoints = (PropertyState<EndpointDescription[]>)replacement;
                            }
                        }
                    }

                    instance = Endpoints;
                    break;
                }

                case Opc.Ua.Gds.BrowseNames.StartCredentialRequest:
                {
                    if (createOrReplace)
                    {
                        if (StartCredentialRequest == null)
                        {
                            if (replacement == null)
                            {
                                StartCredentialRequest = new StartCredentialRequestMethodState(this);
                            }
                            else
                            {
                                StartCredentialRequest = (StartCredentialRequestMethodState)replacement;
                            }
                        }
                    }

                    instance = StartCredentialRequest;
                    break;
                }

                case Opc.Ua.Gds.BrowseNames.FinishCredentialRequest:
                {
                    if (createOrReplace)
                    {
                        if (FinishCredentialRequest == null)
                        {
                            if (replacement == null)
                            {
                                FinishCredentialRequest = new FinishCredentialRequestMethodState(this);
                            }
                            else
                            {
                                FinishCredentialRequest = (FinishCredentialRequestMethodState)replacement;
                            }
                        }
                    }

                    instance = FinishCredentialRequest;
                    break;
                }

                case Opc.Ua.Gds.BrowseNames.RevokeCredential:
                {
                    if (createOrReplace)
                    {
                        if (RevokeCredential == null)
                        {
                            if (replacement == null)
                            {
                                RevokeCredential = new RevokeCredentialMethodState(this);
                            }
                            else
                            {
                                RevokeCredential = (RevokeCredentialMethodState)replacement;
                            }
                        }
                    }

                    instance = RevokeCredential;
                    break;
                }

                case Opc.Ua.Gds.BrowseNames.RequestAccessToken:
                {
                    if (createOrReplace)
                    {
                        if (RequestAccessToken == null)
                        {
                            if (replacement == null)
                            {
                                RequestAccessToken = new RequestAccessTokenMethodState(this);
                            }
                            else
                            {
                                RequestAccessToken = (RequestAccessTokenMethodState)replacement;
                            }
                        }
                    }

                    instance = RequestAccessToken;
                    break;
                }
            }

            if (instance != null)
            {
                return instance;
            }

            return base.FindChild(context, browseName, createOrReplace, replacement);
        }