GetCultureData() public static method

public static GetCultureData ( string cultureName, bool useUserOverride ) : CultureData
cultureName string
useUserOverride bool
return CultureData
 private void OnDeserialized(StreamingContext ctx)
 {
     if (this.m_name == null)
     {
         this.m_cultureId = IdFromEverettRegionInfoDataItem[this.m_dataItem];
     }
     if (this.m_cultureId == 0)
     {
         this.m_cultureData = CultureData.GetCultureDataForRegion(this.m_name, true);
     }
     else
     {
         this.m_cultureData = CultureData.GetCultureData(this.m_cultureId, true);
     }
     if (this.m_cultureData == null)
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_InvalidCultureName"), new object[] { this.m_name }), "m_name");
     }
     if (this.m_cultureId == 0)
     {
         this.SetName(this.m_name);
     }
     else
     {
         this.m_name = this.m_cultureData.SREGIONNAME;
     }
 }
Example #2
0
        public RegionInfo(int culture)
        {
            // The InvariantCulture has no matching region
            if (culture == CultureInfo.LOCALE_INVARIANT)
            {
                throw new ArgumentException(SR.Argument_NoRegionInvariantCulture);
            }

            if (culture == CultureInfo.LOCALE_NEUTRAL)
            {
                // Not supposed to be neutral
                throw new ArgumentException(SR.Format(SR.Argument_CultureIsNeutral, culture), nameof(culture));
            }

            if (culture == CultureInfo.LOCALE_CUSTOM_DEFAULT)
            {
                // Not supposed to be neutral
                throw new ArgumentException(SR.Format(SR.Argument_CustomCultureCannotBePassedByNumber, culture), nameof(culture));
            }

            _cultureData = CultureData.GetCultureData(culture, true);
            _name        = _cultureData.RegionName;

            if (_cultureData.IsNeutralCulture)
            {
                // Not supposed to be neutral
                throw new ArgumentException(SR.Format(SR.Argument_CultureIsNeutral, culture), nameof(culture));
            }
        }
 public RegionInfo(int culture)
 {
     if (culture == 127)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_NoRegionInvariantCulture"));
     }
     if (culture == 0)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_CultureIsNeutral", new object[]
         {
             culture
         }), "culture");
     }
     if (culture == 3072)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_CustomCultureCannotBePassedByNumber", new object[]
         {
             culture
         }), "culture");
     }
     this.m_cultureData = CultureData.GetCultureData(culture, true);
     this.m_name        = this.m_cultureData.SREGIONNAME;
     if (this.m_cultureData.IsNeutralCulture)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_CultureIsNeutral", new object[]
         {
             culture
         }), "culture");
     }
     this.m_cultureId = culture;
 }
Example #4
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public RegionInfo(int culture)
        {
            if (culture == CultureInfo.LOCALE_INVARIANT) //The InvariantCulture has no matching region
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_NoRegionInvariantCulture"));
            }

            if (culture == CultureInfo.LOCALE_NEUTRAL)
            {
                // Not supposed to be neutral
                throw new ArgumentException(Environment.GetResourceString("Argument_CultureIsNeutral", culture), "culture");
            }

            if (culture == CultureInfo.LOCALE_CUSTOM_DEFAULT)
            {
                // Not supposed to be neutral
                throw new ArgumentException(Environment.GetResourceString("Argument_CustomCultureCannotBePassedByNumber", culture), "culture");
            }

            this.m_cultureData = CultureData.GetCultureData(culture, true);
            this.m_name        = this.m_cultureData.SREGIONNAME;

            if (this.m_cultureData.IsNeutralCulture)
            {
                // Not supposed to be neutral
                throw new ArgumentException(Environment.GetResourceString("Argument_CultureIsNeutral", culture), "culture");
            }
            m_cultureId = culture;
        }
Example #5
0
        private CultureInfo(int culture, bool useUserOverride, bool read_only)
        {
            if (culture < 0)
            {
                throw new ArgumentOutOfRangeException("culture", "Positive "
                                                      + "number required.");
            }

            constructed       = true;
            m_isReadOnly      = read_only;
            m_useUserOverride = useUserOverride;

            if (culture == InvariantCultureId)
            {
                /* Short circuit the invariant culture */
                m_cultureData = CultureData.Invariant;
                ConstructInvariant(read_only);
                return;
            }

            if (!construct_internal_locale_from_lcid(culture))
            {
                //
                // Be careful not to cause recursive CultureInfo initialization
                //
                var msg = string.Format(InvariantCulture, "Culture ID {0} (0x{1}) is not a supported culture.", culture.ToString(InvariantCulture), culture.ToString("X4", InvariantCulture));
                throw new CultureNotFoundException("culture", msg);
            }

            var ti = GetTextInfoData();

            m_cultureData = CultureData.GetCultureData(m_name, m_useUserOverride, datetime_index, CalendarType, number_index, iso2lang,
                                                       ti.ansi, ti.oem, ti.mac, ti.ebcdic, ti.right_to_left, ((char)ti.list_sep).ToString());
        }
Example #6
0
        public CultureInfo(int culture, bool useUserOverride)
        {
            // We don't check for other invalid LCIDS here...
            if (culture < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(culture), SR.ArgumentOutOfRange_NeedPosNum);
            }

            switch (culture)
            {
            case LOCALE_CUSTOM_DEFAULT:
            case LOCALE_SYSTEM_DEFAULT:
            case LOCALE_NEUTRAL:
            case LOCALE_USER_DEFAULT:
            case LOCALE_CUSTOM_UNSPECIFIED:
                // Can't support unknown custom cultures and we do not support neutral or
                // non-custom user locales.
                throw new CultureNotFoundException(nameof(culture), culture, SR.Argument_CultureNotSupported);

            default:
                // Now see if this LCID is supported in the system default CultureData table.
                _cultureData = CultureData.GetCultureData(culture, useUserOverride);
                break;
            }
            _isInherited = GetType() != typeof(CultureInfo);
            _name        = _cultureData.CultureName;
        }
Example #7
0
        internal CultureInfo(String name, bool useUserOverride)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name",
                                                SR.ArgumentNull_String);
            }

#if CORERT
            // CORERT-TODO CultureInfo
            if (s_InvariantCultureInfo == null)
            {
                m_cultureData = CultureData.GetCultureData("", useUserOverride);
            }
            else
            {
                m_cultureData = s_InvariantCultureInfo.m_cultureData;
            }
            m_name        = _sortName = _nonSortName = name;
            m_isInherited = false;
#else
            // Get our data providing record
            this.m_cultureData = CultureData.GetCultureData(name, useUserOverride);

            if (this.m_cultureData == null)
            {
                throw new CultureNotFoundException(
                          "name", name, SR.Argument_CultureNotSupported);
            }

            this.m_name        = this.m_cultureData.CultureName;
            this.m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
#endif // CORERT
        }
Example #8
0
        private CultureInfo(string name, bool useUserOverride, bool read_only)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            constructed       = true;
            m_isReadOnly      = read_only;
            m_useUserOverride = useUserOverride;
            m_isInherited     = GetType() != typeof(System.Globalization.CultureInfo);

            if (name.Length == 0)
            {
                /* Short circuit the invariant culture */
                m_cultureData = CultureData.Invariant;
                ConstructInvariant(read_only);
                return;
            }

            if (!construct_internal_locale_from_name(name.ToLowerInvariant()))
            {
                throw CreateNotFoundException(name);
            }

            var ti = GetTextInfoData();

            m_cultureData = CultureData.GetCultureData(m_name, useUserOverride, datetime_index, CalendarType, number_index, iso2lang,
                                                       ti.ansi, ti.oem, ti.mac, ti.ebcdic, ti.right_to_left, ((char)ti.list_sep).ToString());
        }
Example #9
0
        public static CultureInfo[] GetCultures(CultureTypes types)
        {
            bool neutral   = ((types & CultureTypes.NeutralCultures) != 0);
            bool specific  = ((types & CultureTypes.SpecificCultures) != 0);
            bool installed = ((types & CultureTypes.InstalledWin32Cultures) != 0);          // TODO

            CultureInfo [] infos = internal_get_cultures(neutral, specific, installed);
            // The runtime returns a NULL in the first position of the array when
            // 'neutral' is true. We fill it in with a clone of InvariantCulture
            // since it must not be read-only
            int i = 0;

            if (neutral && infos.Length > 0 && infos [0] == null)
            {
                infos [i++] = (CultureInfo)InvariantCulture.Clone();
            }

            for (; i < infos.Length; ++i)
            {
                var ci = infos [i];
                var ti = ci.GetTextInfoData();
                infos [i].m_cultureData = CultureData.GetCultureData(ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.number_index, ci.iso2lang,
                                                                     ti.ansi, ti.oem, ti.mac, ti.ebcdic, ti.right_to_left, ((char)ti.list_sep).ToString());
            }

            return(infos);
        }
Example #10
0
        public static CultureInfo CreateSpecificCulture(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (name.Length == 0)
            {
                return(InvariantCulture);
            }

            var src_name = name;

            name = name.ToLowerInvariant();
            CultureInfo ci = new CultureInfo();

            if (!ci.construct_internal_locale_from_name(name))
            {
                int idx = name.IndexOf('-');
                if (idx < 1 || !ci.construct_internal_locale_from_name(name.Substring(0, idx)))
                {
                    throw CreateNotFoundException(src_name);
                }
            }

            if (ci.IsNeutralCulture)
            {
                ci = CreateSpecificCultureFromNeutral(ci.Name);
            }

            ci.m_cultureData = CultureData.GetCultureData(ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.iso2lang);
            return(ci);
        }
Example #11
0
        private CultureInfo(string name, bool useUserOverride, bool read_only)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            constructed       = true;
            m_isReadOnly      = read_only;
            m_useUserOverride = useUserOverride;
            m_isInherited     = GetType() != typeof(System.Globalization.CultureInfo);

            if (name.Length == 0)
            {
                /* Short circuit the invariant culture */
                ConstructInvariant(read_only);
                m_cultureData = CultureData.Invariant;
                return;
            }

            if (!construct_internal_locale_from_name(name.ToLowerInvariant()))
            {
                throw CreateNotFoundException(name);
            }

            m_cultureData = CultureData.GetCultureData(m_name, useUserOverride, datetime_index, CalendarType, iso2lang);
        }
Example #12
0
        private static CultureInfo?CreateCultureInfoNoThrow(string name, bool useUserOverride)
        {
            Debug.Assert(name != null);
            CultureData?cultureData = CultureData.GetCultureData(name, useUserOverride);

            if (cultureData == null)
            {
                return(null);
            }

            return(new CultureInfo(cultureData));
        }
Example #13
0
        private void OnDeserialized(StreamingContext ctx)
        {
            _cultureData = CultureData.GetCultureData(_name, true);

            if (_cultureData == null)
            {
                throw new ArgumentException(
                          String.Format(CultureInfo.CurrentCulture, SR.Argument_InvalidCultureName, _name),
                          "_name");
            }

            _name = _cultureData.SREGIONNAME;
        }
Example #14
0
        private void InitializeFromName(string name, bool useUserOverride)
        {
            // Get our data providing record
            this.m_cultureData = CultureData.GetCultureData(name, useUserOverride);

            if (this.m_cultureData == null)
            {
                throw new CultureNotFoundException("name", name, SR.Argument_CultureNotSupported);
            }

            this.m_name        = this.m_cultureData.CultureName;
            this.m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
        }
 public CultureInfo(string name, bool useUserOverride)
 {
     this.cultureID = 0x7f;
     if (name == null)
     {
         throw new ArgumentNullException("name", Environment.GetResourceString("ArgumentNull_String"));
     }
     this.m_cultureData = CultureData.GetCultureData(name, useUserOverride);
     if (this.m_cultureData == null)
     {
         throw new CultureNotFoundException("name", name, Environment.GetResourceString("Argument_CultureNotSupported"));
     }
     this.m_name        = this.m_cultureData.CultureName;
     this.m_isInherited = base.GetType() != typeof(CultureInfo);
 }
 private void InitializeFromCultureId(int culture, bool useUserOverride)
 {
     switch (culture)
     {
     case 0x800:
     case 0xc00:
     case 0x1000:
     case 0:
     case 0x400:
         throw new CultureNotFoundException("culture", culture, Environment.GetResourceString("Argument_CultureNotSupported"));
     }
     this.m_cultureData = CultureData.GetCultureData(culture, useUserOverride);
     this.m_isInherited = base.GetType() != typeof(CultureInfo);
     this.m_name        = this.m_cultureData.CultureName;
 }
Example #17
0
        public static CultureInfo CreateSpecificCulture(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (name.Length == 0)
            {
                return(InvariantCulture);
            }

            var src_name = name;

            name = name.ToLowerInvariant();
            CultureInfo ci = new CultureInfo();

            if (!ci.construct_internal_locale_from_name(name))
            {
                int idx = name.Length - 1;
                if (idx > 0)
                {
                    while ((idx = name.LastIndexOf('-', idx - 1)) > 0)
                    {
                        if (ci.construct_internal_locale_from_name(name.Substring(0, idx)))
                        {
                            break;
                        }
                    }
                }

                if (idx <= 0)
                {
                    throw CreateNotFoundException(src_name);
                }
            }

            if (ci.IsNeutralCulture)
            {
                ci = CreateSpecificCultureFromNeutral(ci.Name);
            }

            var ti = ci.GetTextInfoData();

            ci.m_cultureData = CultureData.GetCultureData(ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.number_index, ci.iso2lang,
                                                          ti.ansi, ti.oem, ti.mac, ti.ebcdic, ti.right_to_left, ((char)ti.list_sep).ToString());
            return(ci);
        }
Example #18
0
        /// <summary>
        /// Constructor called by SQL Server's special munged culture - creates a culture with
        /// a TextInfo and CompareInfo that come from a supplied alternate source. This object
        /// is ALWAYS read-only.
        /// Note that we really cannot use an LCID version of this override as the cached
        /// name we create for it has to include both names, and the logic for this is in
        /// the GetCultureInfo override *only*.
        /// </summary>
        internal CultureInfo(string cultureName, string textAndCompareCultureName)
        {
            ArgumentNullException.ThrowIfNull(textAndCompareCultureName);

            CultureData?cultureData = CultureData.GetCultureData(cultureName, false) ??
                                      throw new CultureNotFoundException(nameof(cultureName), cultureName, GetCultureNotSupportedExceptionMessage());

            _cultureData = cultureData;

            _name = _cultureData.CultureName;

            CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);

            _compareInfo = altCulture.CompareInfo;
            _textInfo    = altCulture.TextInfo;
        }
Example #19
0
        public CultureInfo(string name, bool useUserOverride)
        {
            ArgumentNullException.ThrowIfNull(name);

            // Get our data providing record
            CultureData?cultureData = CultureData.GetCultureData(name, useUserOverride);

            if (cultureData == null)
            {
                throw new CultureNotFoundException(nameof(name), name, GetCultureNotSupportedExceptionMessage());
            }

            _cultureData = cultureData;
            _name        = _cultureData.CultureName;
            _isInherited = GetType() != typeof(CultureInfo);
        }
Example #20
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public RegionInfo(String name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (name.Length == 0) //The InvariantCulture has no matching region
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_NoRegionInvariantCulture"));
            }

            Contract.EndContractBlock();

#if FEATURE_CORECLR
            //
            // For CoreCLR we only want the region names that are full culture names
            //
            this.m_cultureData = CultureData.GetCultureData(name, true);
#else
            //
            // First try it as an entire culture. We must have user override as true here so
            // that we can pick up custom cultures *before* built-in ones (if they want to
            // prefer built-in cultures they will pass "us" instead of "en-US").
            //
            this.m_cultureData = CultureData.GetCultureDataForRegion(name, true);
            // this.m_name = name.ToUpper(CultureInfo.InvariantCulture);
#endif // FEATURE_CORECLR
            if (this.m_cultureData == null)
            {
                throw new ArgumentException(
                          String.Format(
                              CultureInfo.CurrentCulture,
                              Environment.GetResourceString("Argument_InvalidCultureName"), name), "name");
            }


            // Not supposed to be neutral
            if (this.m_cultureData.IsNeutralCulture)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNeutralRegionName", name), "name");
            }

            SetName(name);
        }
Example #21
0
        public CultureInfo(string name, bool useUserOverride)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            // Get our data providing record
            _cultureData = CultureData.GetCultureData(name, useUserOverride);

            if (_cultureData == null)
            {
                throw new CultureNotFoundException(nameof(name), name, SR.Argument_CultureNotSupported);
            }

            _name        = _cultureData.CultureName;
            _isInherited = GetType() != typeof(CultureInfo);
        }
        internal CultureInfo(string cultureName, string textAndCompareCultureName)
        {
            this.cultureID = 0x7f;
            if (cultureName == null)
            {
                throw new ArgumentNullException("cultureName", Environment.GetResourceString("ArgumentNull_String"));
            }
            this.m_cultureData = CultureData.GetCultureData(cultureName, false);
            if (this.m_cultureData == null)
            {
                throw new CultureNotFoundException("cultureName", cultureName, Environment.GetResourceString("Argument_CultureNotSupported"));
            }
            this.m_name = this.m_cultureData.CultureName;
            CultureInfo cultureInfo = GetCultureInfo(textAndCompareCultureName);

            this.compareInfo = cultureInfo.CompareInfo;
            this.textInfo    = cultureInfo.TextInfo;
        }
Example #23
0
        /// <summary>
        /// Constructor called by SQL Server's special munged culture - creates a culture with
        /// a TextInfo and CompareInfo that come from a supplied alternate source. This object
        /// is ALWAYS read-only.
        /// Note that we really cannot use an LCID version of this override as the cached
        /// name we create for it has to include both names, and the logic for this is in
        /// the GetCultureInfo override *only*.
        /// </summary>
        internal CultureInfo(string cultureName, string textAndCompareCultureName)
        {
            if (cultureName == null)
            {
                throw new ArgumentNullException(nameof(cultureName), SR.ArgumentNull_String);
            }

            CultureData?cultureData = CultureData.GetCultureData(cultureName, false) ??
                                      throw new CultureNotFoundException(nameof(cultureName), cultureName, SR.Argument_CultureNotSupported);

            _cultureData = cultureData;

            _name = _cultureData.CultureName;

            CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);

            _compareInfo = altCulture.CompareInfo;
            _textInfo    = altCulture.TextInfo;
        }
Example #24
0
        internal CultureInfo(String name, bool useUserOverride)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name",
                                                SR.ArgumentNull_String);
            }

            // Get our data providing record
            this.m_cultureData = CultureData.GetCultureData(name, useUserOverride);

            if (this.m_cultureData == null)
            {
                throw new CultureNotFoundException(
                          "name", name, SR.Argument_CultureNotSupported);
            }

            this.m_name        = this.m_cultureData.CultureName;
            this.m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
        }
Example #25
0
        internal CultureInfo(String name, bool useUserOverride)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name),
                                                SR.ArgumentNull_String);
            }

            // Get our data providing record
            this.m_cultureData = CultureData.GetCultureData(name, useUserOverride);

            if (this.m_cultureData == null)
            {
                throw new CultureNotFoundException(
                          nameof(name), name, SR.Argument_CultureNotSupported);
            }

            this.m_name        = this.m_cultureData.CultureName;
            this.m_isInherited = !this.EETypePtr.FastEquals(EETypePtr.EETypePtrOf <CultureInfo>());
        }
Example #26
0
        // Constructor called by SQL Server's special munged culture - creates a culture with
        // a TextInfo and CompareInfo that come from a supplied alternate source. This object
        // is ALWAYS read-only.
        // Note that we really cannot use an LCID version of this override as the cached
        // name we create for it has to include both names, and the logic for this is in
        // the GetCultureInfo override *only*.
        internal CultureInfo(String cultureName, String textAndCompareCultureName)
        {
            if (cultureName == null)
            {
                throw new ArgumentNullException("cultureName", SR.ArgumentNull_String);
            }
            Contract.EndContractBlock();

            m_cultureData = CultureData.GetCultureData(cultureName, false);
            if (m_cultureData == null)
            {
                throw new CultureNotFoundException("cultureName", cultureName, SR.Argument_CultureNotSupported);
            }

            m_name = m_cultureData.CultureName;

            CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);

            compareInfo = altCulture.CompareInfo;
            textInfo    = altCulture.TextInfo;
        }
Example #27
0
        private void InitializeFromCultureId(int culture, bool useUserOverride)
        {
            switch (culture)
            {
            case LOCALE_CUSTOM_DEFAULT:
            case LOCALE_SYSTEM_DEFAULT:
            case LOCALE_NEUTRAL:
            case LOCALE_USER_DEFAULT:
            case LOCALE_CUSTOM_UNSPECIFIED:
                // Can't support unknown custom cultures and we do not support neutral or
                // non-custom user locales.
                throw new CultureNotFoundException("culture", culture, SR.Argument_CultureNotSupported);

            default:
                // Now see if this LCID is supported in the system default CultureData table.
                m_cultureData = CultureData.GetCultureData(culture, useUserOverride);
                break;
            }
            m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
            m_name        = m_cultureData.CultureName;
        }
Example #28
0
        private void OnDeserialized(StreamingContext ctx)
        {
            // This won't happen anyway since CoreCLR doesn't support serialization
            this.m_cultureData = CultureData.GetCultureData(m_name, true);

            if (this.m_cultureData == null)
            {
                throw new ArgumentException(
                          String.Format(
                              CultureInfo.CurrentCulture,
                              Environment.GetResourceString("Argument_InvalidCultureName"), m_name), nameof(m_name));
            }

            if (m_cultureId == 0)
            {
                SetName(this.m_name);
            }
            else
            {
                this.m_name = this.m_cultureData.SREGIONNAME;
            }
        }
Example #29
0
        private void OnDeserialized(StreamingContext ctx)
        {
#if FEATURE_CORECLR
            // This won't happen anyway since CoreCLR doesn't support serialization
            this.m_cultureData = CultureData.GetCultureData(m_name, true);
#else
            if (m_name == null)
            {
                Contract.Assert(m_dataItem >= 0, "[RegionInfo.OnDeserialized] null name and invalid dataItem");
                m_cultureId = IdFromEverettRegionInfoDataItem[m_dataItem];
            }

            if (m_cultureId == 0)
            {
                this.m_cultureData = CultureData.GetCultureDataForRegion(this.m_name, true);
            }
            else
            {
                this.m_cultureData = CultureData.GetCultureData(m_cultureId, true);
            }
#endif
            //
            if (this.m_cultureData == null)
            {
                throw new ArgumentException(
                          String.Format(
                              CultureInfo.CurrentCulture,
                              Environment.GetResourceString("Argument_InvalidCultureName"), m_name), "m_name");
            }

            if (m_cultureId == 0)
            {
                SetName(this.m_name);
            }
            else
            {
                this.m_name = this.m_cultureData.SREGIONNAME;
            }
        }
Example #30
0
        public static CultureInfo[] GetCultures(CultureTypes types)
        {
            bool neutral   = ((types & CultureTypes.NeutralCultures) != 0);
            bool specific  = ((types & CultureTypes.SpecificCultures) != 0);
            bool installed = ((types & CultureTypes.InstalledWin32Cultures) != 0);          // TODO

            CultureInfo [] infos = internal_get_cultures(neutral, specific, installed);
            // The runtime returns a NULL in the first position of the array when
            // 'neutral' is true. We fill it in with a clone of InvariantCulture
            // since it must not be read-only
            if (neutral && infos.Length > 0 && infos [0] == null)
            {
                infos [0] = (CultureInfo)InvariantCulture.Clone();
            }

            for (int i = 1; i < infos.Length; ++i)
            {
                var ci = infos [i];
                infos [i].m_cultureData = CultureData.GetCultureData(ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.iso2lang);
            }

            return(infos);
        }