Beispiel #1
0
 private void OnDeserialized(StreamingContext ctx)
 {
     if ((this.m_name != null) && (this.cultureID != 0x40a))
     {
         this.m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(this.m_name, this.m_useUserOverride);
     }
     else
     {
         this.m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(this.cultureID, this.m_useUserOverride);
     }
     this.m_isInherited = base.GetType() != typeof(CultureInfo);
     if (this.m_name == null)
     {
         this.m_name = this.m_cultureTableRecord.ActualName;
     }
     if (base.GetType().Assembly == typeof(CultureInfo).Assembly)
     {
         if (this.textInfo != null)
         {
             CheckDomainSafetyObject(this.textInfo, this);
         }
         if (this.compareInfo != null)
         {
             CheckDomainSafetyObject(this.compareInfo, this);
         }
     }
 }
Beispiel #2
0
        private unsafe void OnDeserialized()
        {
            // this method will be called twice because of the support of IDeserializationCallback
            if (m_cultureTableRecord == null)
            {
                if (m_win32LangID == 0)
                {
                    m_win32LangID = CultureTableRecord.IdFromEverettDataItem(m_nDataItem);
                }

                if (customCultureName != null)
                {
                    m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(customCultureName, m_useUserOverride);
                }
                else
                {
                    m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(m_win32LangID, m_useUserOverride);
                }

                m_textInfoID = m_cultureTableRecord.ITEXTINFO;

                if (m_cultureTableRecord.IsSynthetic)
                {
                    // <SyntheticSupport/>
                    m_pNativeTextInfo = InvariantNativeTextInfo;
                }
                else
                {
                    m_pNativeTextInfo = GetNativeTextInfo(m_textInfoID);
                }
            }
        }
Beispiel #3
0
 public CultureInfo(string name, bool useUserOverride)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name", Environment.GetResourceString("ArgumentNull_String"));
     }
     this.m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(name, useUserOverride);
     this.cultureID            = this.m_cultureTableRecord.ActualCultureID;
     this.m_name        = this.m_cultureTableRecord.ActualName;
     this.m_isInherited = base.GetType() != typeof(CultureInfo);
 }
Beispiel #4
0
        internal CultureInfo(string cultureName, string textAndCompareCultureName)
        {
            if (cultureName == null)
            {
                throw new ArgumentNullException("cultureName", Environment.GetResourceString("ArgumentNull_String"));
            }
            this.m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(cultureName, false);
            this.cultureID            = this.m_cultureTableRecord.ActualCultureID;
            this.m_name = this.m_cultureTableRecord.ActualName;
            CultureInfo cultureInfo = GetCultureInfo(textAndCompareCultureName);

            this.compareInfo = cultureInfo.CompareInfo;
            this.textInfo    = cultureInfo.TextInfo;
        }
 private void OnDeserialized(StreamingContext ctx)
 {
     if (m_name == null)
     {
         BCLDebug.Assert(m_dataItem >= 0, "[RegionInfo.OnDeserialized] null name and invalid dataItem");
         m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(CultureTableRecord.IdFromEverettRegionInfoDataItem(m_dataItem), true);
         m_name = m_cultureTableRecord.SREGIONNAME;
     }
     else
     {
         if (m_cultureId != 0)
         {
             m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(m_cultureId, true);
         }
         else
         {
             m_cultureTableRecord = CultureTableRecord.GetCultureTableRecordForRegion(m_name, true);
         }
     }
 }
Beispiel #6
0
 public CultureInfo(int culture, bool useUserOverride)
 {
     if (culture < 0)
     {
         throw new ArgumentOutOfRangeException("culture", Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
     }
     switch (culture)
     {
     case 0x800:
     case 0xc00:
     case 0x1000:
     case 0:
     case 0x400:
         throw new ArgumentException(Environment.GetResourceString("Argument_CultureNotSupported", new object[] { culture }), "culture");
     }
     this.cultureID            = culture;
     this.m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(this.cultureID, useUserOverride);
     this.m_name        = this.m_cultureTableRecord.ActualName;
     this.m_isInherited = base.GetType() != typeof(CultureInfo);
 }
        public RegionInfo(int culture)
        {
            // Get the culture data item.

            if (culture == CultureInfo.LOCALE_INVARIANT)   //The InvariantCulture has no matching region
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_NoRegionInvariantCulture"));
            }

            if (CultureTableRecord.IsCustomCultureId(culture))   // Customized culture
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_CustomCultureCannotBePassedByNumber", "culture"));
            }
            if (CultureInfo.GetSubLangID(culture) == 0)
            {
                // Supposed to have sublang (region) info
                throw new ArgumentException(Environment.GetResourceString("Argument_CultureIsNeutral", culture), "culture");
            }

            //
            // From this region data item, get the region data item.
            // Several culture ID may map to the same region.
            // For example, 0x1009 (English (Canada)) and 0x0c0c (French (Canada)) all map to
            // the same region "CA" (Canada).
            //
            this.m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(culture, true);

            if (this.m_cultureTableRecord.IsNeutralCulture)
            {
                // Not supposed to be neutral
                throw new ArgumentException(Environment.GetResourceString("Argument_CultureIsNeutral", culture), "culture");
            }

            // Make sure that we initialize m_name since it will be used in deserialization.
            this.m_name = this.m_cultureTableRecord.SREGIONNAME;

            m_cultureId = culture;
        }