示例#1
0
        /// <summary>
        /// Called after the node managers have started.
        /// </summary>
        protected override void OnNodeManagerStarted(IServerInternal server)
        {
            // check if wrapped server locales need to be added to the UA server locale list.
            if (m_availableLocales != null && m_availableLocales.Count > 0)
            {
                lock (ServerInstance.DiagnosticsNodeManager.Lock)
                {
                    // get the LocaleIdArray property.
                    BaseVariableState variable = ServerInstance.DiagnosticsNodeManager.Find(Opc.Ua.VariableIds.Server_ServerCapabilities_LocaleIdArray) as BaseVariableState;

                    if (variable != null)
                    {
                        List <string> locales = new List <string>();

                        // preserve any existing locales.
                        string[] existingLocales = variable.Value as string[];

                        if (existingLocales != null)
                        {
                            locales.AddRange(existingLocales);
                        }

                        // add locales from the wrapped servers.
                        foreach (string availableLocale in m_availableLocales)
                        {
                            if (!locales.Contains(availableLocale))
                            {
                                locales.Add(availableLocale);
                            }
                        }

                        // update the locale array.
                        variable.Value = locales.ToArray();
                    }
                }
            }

            m_userNameValidator = new UserNameValidator(Configuration.ApplicationName);

            base.OnNodeManagerStarted(server);
        }
示例#2
0
        /// <summary>
        /// Called after the node managers have started.
        /// </summary>
        protected override void OnNodeManagerStarted(IServerInternal server)
        {
            // check if wrapped server locales need to be added to the UA server locale list.
            if (m_availableLocales != null && m_availableLocales.Count > 0)
            {
                lock (ServerInstance.DiagnosticsNodeManager.Lock)
                {
                    // get the LocaleIdArray property.
                    BaseVariableState variable = ServerInstance.DiagnosticsNodeManager.Find(Opc.Ua.VariableIds.Server_ServerCapabilities_LocaleIdArray) as BaseVariableState;

                    if (variable != null)
                    {
                        List<string> locales = new List<string>();

                        // preserve any existing locales.
                        string[] existingLocales = variable.Value as string[];

                        if (existingLocales != null)
                        {
                            locales.AddRange(existingLocales);
                        }

                        // add locales from the wrapped servers.
                        foreach (string availableLocale in m_availableLocales)
                        {
                            if (!locales.Contains(availableLocale))
                            {
                                locales.Add(availableLocale);
                            }
                        }

                        // update the locale array.
                        variable.Value = locales.ToArray();
                    }
                }
            }

            m_userNameValidator = new UserNameValidator(Configuration.ApplicationName);

            base.OnNodeManagerStarted(server);
        }