예제 #1
0
        /// <summary>
        /// Sets the locale used in any error messages or results returned to the client.
        /// </summary>
        /// <param name="locale">The locale name in the format "[languagecode]-[country/regioncode]".</param>
        /// <returns>A locale that the server supports and is the best match for the requested locale.</returns>
        public virtual string SetLocale(string locale)
        {
            if (m_server == null)
            {
                throw new NotConnectedException();
            }

            try
            {
                // set the requested locale on the server.
                m_locale = m_server.SetLocale(locale);
            }
            catch
            {
                // find a best match and check if the server supports it.
                string revisedLocale = Server.FindBestLocale(locale, m_supportedLocales);

                if (revisedLocale != locale)
                {
                    m_server.SetLocale(revisedLocale);
                }

                // cache the revised locale.
                m_locale = revisedLocale;
            }

            // return actual local used.
            return(m_locale);
        }
예제 #2
0
파일: Server.cs 프로젝트: ZSYMAX/OpcNetApi
 // Token: 0x06000028 RID: 40 RVA: 0x00002CF0 File Offset: 0x00001CF0
 public virtual string SetLocale(string locale)
 {
     if (this.m_server == null)
     {
         throw new NotConnectedException();
     }
     try
     {
         this.m_locale = this.m_server.SetLocale(locale);
     }
     catch
     {
         string text = Server.FindBestLocale(locale, this.m_supportedLocales);
         if (text != locale)
         {
             this.m_server.SetLocale(text);
         }
         this.m_locale = text;
     }
     return(this.m_locale);
 }