We need you! We're working hard on the next version of Developer Fusion -
Let us know what you think we should be up to!
- namespace System.Globalization
- {
- using System;
- using System.IO;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading;
- using System.Runtime.CompilerServices;
- using System.Runtime.ConstrainedExecution;
- using System.Collections;
- using Microsoft.Win32.SafeHandles;
- using System.Runtime.Serialization;
- using System.Runtime.Versioning;
-
-
- [Flags()]
- internal enum CultureFlags
- {
- IsSpecificCulture = 1
- }
-
-
-
- internal class CultureTableRecord
- {
-
- internal const int SPANISH_TRADITIONAL_SORT = 1034;
- private const int SPANISH_INTERNATIONAL_SORT = 3082;
-
-
- private const int MAXSIZE_LANGUAGE = 8;
- private const int MAXSIZE_REGION = MAXSIZE_LANGUAGE;
- private const int MAXSIZE_SUFFIX = 8 * MAXSIZE_LANGUAGE;
- private const int MAXSIZE_FULLTAGNAME = MAXSIZE_LANGUAGE + MAXSIZE_REGION + MAXSIZE_SUFFIX + 4;
-
- private static object s_InternalSyncObject;
- private static object InternalSyncObject {
- get {
- if (s_InternalSyncObject == null) {
- object o = new object();
- Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
- }
- return s_InternalSyncObject;
- }
- }
-
-
-
-
-
-
- private static Hashtable CultureTableRecordCache;
- private static Hashtable CultureTableRecordRegionCache;
-
-
-
-
- private CultureTable m_CultureTable;
- unsafe private CultureTableData* m_pData;
- unsafe private ushort* m_pPool;
- private bool m_bUseUserOverride;
- private int m_CultureID;
- private string m_CultureName;
-
- private int m_ActualCultureID = 0;
- private string m_ActualName = null;
-
-
-
- private bool m_synthetic = false;
-
- private SafeNativeMemoryHandle nativeMemoryHandle;
-
- private string m_windowsPath = null;
-
- private const int LOCALE_SLANGUAGE = 2;
-
- private const int LOCALE_SCOUNTRY = 6;
-
- private const int LOCALE_SNATIVELANGNAME = 4;
-
- private const int LOCALE_SNATIVECTRYNAME = 8;
-
- private const int LOCALE_ICALENDARTYPE = 4105;
-
-
- ////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////
-
- [ResourceExposure(ResourceScope.None)]
- [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
- unsafe private CultureTable GetCustomCultureTable(string name)
- {
- CultureTable cultureTable = null;
-
- string customCultureFile = GetCustomCultureFile(name);
- if (customCultureFile == null) {
- return null;
- }
-
- try {
- cultureTable = new CultureTable(customCultureFile, false);
- if (!cultureTable.IsValid) {
-
-
-
-
- string defaultTableActualName;
- int defaultTableCultureID;
- int defaultTableDataItem = CultureTable.Default.GetDataItemFromCultureName(name, out defaultTableCultureID, out defaultTableActualName);
-
-
- if (defaultTableDataItem < 0) {
-
- }
-
- return null;
-
- }
- }
- catch (FileNotFoundException) {
-
-
-
-
- cultureTable = null;
- }
-
- return cultureTable;
- }
-
- ////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////
-
- unsafe internal CultureTable TryCreateReplacementCulture(string replacementCultureName, out int dataItem)
- {
- string name = ValidateCulturePieceToLower(replacementCultureName, "cultureName", MAXSIZE_FULLTAGNAME);
-
-
-
- CultureTable cultureTable = GetCustomCultureTable(name);
-
- if (cultureTable == null) {
- dataItem = -1;
- return (null);
- }
-
- int tempID;
- string tempName;
- dataItem = cultureTable.GetDataItemFromCultureName(name, out tempID, out tempName);
- return (dataItem >= 0 ? cultureTable : null);
- }
-
-
-
-
-
-
-
-
- static internal CultureTableRecord GetCultureTableRecord(string name, bool useUserOverride)
- {
- BCLDebug.Assert(name != null, "[CultureTableRecord::GetCultureTableRecord] name should be valid.");
-
-
- if (CultureTableRecordCache == null) {
-
- if (name.Length == 0) {
-
- return new CultureTableRecord(name, useUserOverride);
- }
-
- lock (InternalSyncObject) {
- if (CultureTableRecordCache == null)
- CultureTableRecordCache = new Hashtable();
- }
- }
-
- name = ValidateCulturePieceToLower(name, "name", MAXSIZE_FULLTAGNAME);
-
- CultureTableRecord[] cultureRecordArray = (CultureTableRecord[])CultureTableRecordCache[name];
- if (cultureRecordArray != null) {
- int index = useUserOverride ? 0 : 1;
-
- if (cultureRecordArray[index] == null) {
- int filled = index == 0 ? 1 : 0;
- cultureRecordArray[index] = (CultureTableRecord)cultureRecordArray[filled].CloneWithUserOverride(useUserOverride);
- }
-
- return cultureRecordArray[index];
- }
-
- CultureTableRecord cultureRecord = new CultureTableRecord(name, useUserOverride);
- lock (InternalSyncObject) {
- if (CultureTableRecordCache[name] == null) {
- cultureRecordArray = new CultureTableRecord[2];
- cultureRecordArray[useUserOverride ? 0 : 1] = cultureRecord;
- CultureTableRecordCache[name] = cultureRecordArray;
- }
- }
-
- return cultureRecord;
- }
-
-
-
-
-
-
-
- static internal CultureTableRecord GetCultureTableRecord(int cultureId, bool useUserOverride)
- {
- if (cultureId == CultureInfo.LOCALE_INVARIANT)
- return GetCultureTableRecord("", false);
-
- string name = null;
- if (CultureTable.Default.GetDataItemFromCultureID(cultureId, out name) < 0) {
- }
-
-
- if (name != null && name.Length > 0) {
- return GetCultureTableRecord(name, useUserOverride);
- }
-
- throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_CultureNotSupported"), cultureId), "culture");
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- static internal CultureTableRecord GetCultureTableRecordForRegion(string regionName, bool useUserOverride)
- {
- BCLDebug.Assert(regionName != null, "[CultureTableRecord::GetCultureTableRecordForRegion] regionName should be valid.");
-
-
- if (CultureTableRecordRegionCache == null) {
- lock (InternalSyncObject) {
- if (CultureTableRecordRegionCache == null)
- CultureTableRecordRegionCache = new Hashtable();
- }
- }
-
- regionName = ValidateCulturePieceToLower(regionName, "regionName", MAXSIZE_FULLTAGNAME);
-
- CultureTableRecord[] cultureRecordArray = (CultureTableRecord[])CultureTableRecordRegionCache[regionName];
- if (cultureRecordArray != null) {
- int index = useUserOverride ? 0 : 1;
- if (cultureRecordArray[index] == null) {
- cultureRecordArray[index] = cultureRecordArray[index == 0 ? 1 : 0].CloneWithUserOverride(useUserOverride);
- }
- return cultureRecordArray[index];
- }
-
- int dataItem = CultureTable.Default.GetDataItemFromRegionName(regionName);
-
- CultureTableRecord cultureRecord = null;
-
- if (dataItem > 0) {
- cultureRecord = new CultureTableRecord(regionName, dataItem, useUserOverride);
- }
- else {
- try {
- cultureRecord = GetCultureTableRecord(regionName, useUserOverride);
- }
- catch (ArgumentException) {
- throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_InvalidRegionName"), regionName), "name");
- }
- }
-
- BCLDebug.Assert(cultureRecord != null, "[CultureTableRecord::GetCultureTableRecordForRegion] cultureRecord should be valid.");
- lock (InternalSyncObject) {
- if (CultureTableRecordRegionCache[regionName] == null) {
- cultureRecordArray = new CultureTableRecord[2];
- cultureRecordArray[useUserOverride ? 0 : 1] = cultureRecord.CloneWithUserOverride(useUserOverride);
- CultureTableRecordRegionCache[regionName] = cultureRecordArray;
- }
- }
-
- return cultureRecord;
- }
-
-
-
-
-
-
-
- unsafe internal CultureTableRecord(int cultureId, bool useUserOverride)
- {
- this.m_bUseUserOverride = useUserOverride;
-
- int defaultTableDataItem = CultureTable.Default.GetDataItemFromCultureID(cultureId, out m_ActualName);
- if (defaultTableDataItem < 0) {
- throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_CultureNotSupported"), cultureId), "culture");
- }
-
- m_ActualCultureID = cultureId;
- m_CultureTable = CultureTable.Default;
-
- m_pData = (CultureTableData*)(m_CultureTable.m_pItemData + m_CultureTable.m_itemSize * defaultTableDataItem);
- m_pPool = m_CultureTable.m_pDataPool;
-
- m_CultureName = SNAME;
- m_CultureID = (cultureId == SPANISH_TRADITIONAL_SORT) ? cultureId : ILANGUAGE;
-
- BCLDebug.Assert(!IsCustomCulture, "[CultureTableRecord::ctor] we shouldn't have custom culture.");
- BCLDebug.Assert(!IsSynthetic, "[CultureTableRecord::ctor] we shouldn't have synthetic culture.");
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- unsafe private CultureTableRecord(string cultureName, bool useUserOverride)
- {
- BCLDebug.Assert(cultureName != null, "[CultureTableRecord::ctor] cultureName should be valid.");
-
- int cultureID = 0;
-
-
- if (cultureName.Length == 0) {
- useUserOverride = false;
- cultureID = CultureInfo.LOCALE_INVARIANT;
- }
-
- this.m_bUseUserOverride = useUserOverride;
-
-
- int iDataItem = -1;
- if (cultureName.Length > 0) {
-
- string defaultTableActualName;
- int defaultTableCultureID;
- string name = cultureName;
- int defaultTableDataItem = CultureTable.Default.GetDataItemFromCultureName(name, out defaultTableCultureID, out defaultTableActualName);
- if (defaultTableDataItem >= 0 && (CultureInfo.GetSortID(defaultTableCultureID) > 0 || defaultTableCultureID == SPANISH_TRADITIONAL_SORT)) {
- string replacmentCultureName;
-
- int nonSortId;
- if (defaultTableCultureID == SPANISH_TRADITIONAL_SORT)
- nonSortId = SPANISH_INTERNATIONAL_SORT;
- else
- nonSortId = CultureInfo.GetLangID(defaultTableCultureID);
-
-
- if (CultureTable.Default.GetDataItemFromCultureID(nonSortId, out replacmentCultureName) >= 0) {
-
- name = ValidateCulturePieceToLower(replacmentCultureName, "cultureName", MAXSIZE_FULLTAGNAME);
- }
- }
-
-
-
- if (!Environment.GetCompatibilityFlag(CompatibilityFlag.DisableReplacementCustomCulture) || IsCustomCultureId(defaultTableCultureID)) {
-
-
-
-
- m_CultureTable = GetCustomCultureTable(name);
- }
-
- if (m_CultureTable != null) {
-
-
-
- iDataItem = this.m_CultureTable.GetDataItemFromCultureName(name, out this.m_ActualCultureID, out this.m_ActualName);
- if (defaultTableDataItem >= 0) {
-
-
- this.m_ActualCultureID = defaultTableCultureID;
- this.m_ActualName = defaultTableActualName;
- }
- }
-
- if (iDataItem < 0 && defaultTableDataItem >= 0) {
-
-
-
- this.m_CultureTable = CultureTable.Default;
- this.m_ActualCultureID = defaultTableCultureID;
- this.m_ActualName = defaultTableActualName;
- iDataItem = defaultTableDataItem;
- }
-
- }
-
-
- if (iDataItem < 0 && cultureID > 0) {
- if (cultureID == CultureInfo.LOCALE_INVARIANT) {
-
- iDataItem = CultureTable.Default.GetDataItemFromCultureID(cultureID, out this.m_ActualName);
- if (iDataItem > 0) {
- m_ActualCultureID = cultureID;
- m_CultureTable = CultureTable.Default;
- }
- }
- }
-
-
- if (iDataItem >= 0) {
-
- this.m_pData = (CultureTableData*)(this.m_CultureTable.m_pItemData + this.m_CultureTable.m_itemSize * iDataItem);
- this.m_pPool = this.m_CultureTable.m_pDataPool;
-
- this.m_CultureName = this.SNAME;
- this.m_CultureID = (m_ActualCultureID == SPANISH_TRADITIONAL_SORT) ? m_ActualCultureID : this.ILANGUAGE;
-
-
- return;
- }
-
-
- if (cultureName != null)
- throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_InvalidCultureName"), cultureName), "name");
-
-
- throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_CultureNotSupported"), cultureID), "culture");
- }
-
-
-
-
-
-
- unsafe private CultureTableRecord(string regionName, int dataItem, bool useUserOverride)
- {
- BCLDebug.Assert(regionName != null && regionName.Length > 0, "[CultureTableRecord.CultureTableRecord(regionName,bool)]Expected non-null/empty name");
-
- BCLDebug.Assert(dataItem > 0, "[CultureTableRecord.CultureTableRecord(regionName, dataItem, bool)] dataItem > 0 should be true.");
-
-
- this.m_bUseUserOverride = useUserOverride;
- this.m_CultureName = regionName;
- this.m_CultureTable = CultureTable.Default;
-
-
- this.m_pData = (CultureTableData*)(this.m_CultureTable.m_pItemData + this.m_CultureTable.m_itemSize * dataItem);
- this.m_pPool = this.m_CultureTable.m_pDataPool;
-
-
- this.m_CultureID = this.ILANGUAGE;
- }
-
-
-
-
- static internal void ResetCustomCulturesCache()
- {
- }
-
-
-
- private string WindowsPath {
- get {
- if (m_windowsPath == null) {
- m_windowsPath = CultureInfo.nativeGetWindowsDirectory();
- }
- return (m_windowsPath);
- }
- }
-
-
- private string GetCustomCultureFile(string name)
- {
- return (null);
- }
-
-
- private static string ValidateCulturePieceToLower(string testString, string paramName, int maxLength)
- {
- if (testString.Length > maxLength) {
- throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_NameTooLong"), testString, maxLength), paramName);
- }
-
- StringBuilder sb = new StringBuilder(testString.Length);
-
- for (int ich = 0; ich < testString.Length; ich++) {
- char ch = testString[ich];
-
- if (ch <= 'Z' && ch >= 'A') {
- sb.Append((char)(ch - 'A' + 'a'));
- }
- else if (((ch <= 'z' && ch >= 'a') || (ch <= '9' && ch >= '0') || (ch == '_') || (ch == '-'))) {
- sb.Append(ch);
- }
- else {
- throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_NameContainsInvalidCharacters"), testString), paramName);
- }
- }
-
- return (sb.ToString());
-
- }
-
- static internal string AnsiToLower(string testString)
- {
- StringBuilder sb = new StringBuilder(testString.Length);
-
- for (int ich = 0; ich < testString.Length; ich++) {
- char ch = testString[ich];
- sb.Append(ch <= 'Z' && ch >= 'A' ? (char)(ch - 'A' + 'a') : ch);
- }
-
- return (sb.ToString());
- }
-
-
-
-
-
-
-
-
-
- unsafe static internal string GetCultureNameFromIetfName(string name)
- {
- BCLDebug.Assert(name != null, "CultureTable.GetCultureNameFromIetfName(): name!=null");
- string actualName = null;
-
-
- actualName = CultureTable.Default.LookupIetfName(name);
-
-
-
- return actualName;
- }
-
- static internal string LookupIetfNameFromSynthetic(string name)
- {
- string cultureName = null;
- return cultureName;
- }
-
-
- internal bool IsSynthetic {
- get { return m_synthetic; }
- }
-
- internal bool IsCustomCulture {
- get { return !(this.m_CultureTable.fromAssembly); }
- }
-
- internal bool IsReplacementCulture {
- get { return (this.IsCustomCulture && !IsCustomCultureId(m_CultureID)); }
- }
-
- internal int CultureID {
- get {
- BCLDebug.Assert(this.m_CultureID > 0, "[CultureTableRecord.CultureID]unexpected m_CultureId");
- return this.m_CultureID;
- }
- }
-
- internal string CultureName {
- get {
- BCLDebug.Assert(this.m_CultureName != null, "[CultureTableRecord.CultureName]unexpected m_CultureName");
- return this.m_CultureName;
- }
-
- set {
- BCLDebug.Assert(value != null, "[CultureTableRecord.CultureName]Expected non-null value for culture name");
- this.m_CultureName = value;
- }
- }
-
- internal bool UseUserOverride {
- get { return this.m_bUseUserOverride; }
- }
-
-
-
- unsafe internal bool UseGetLocaleInfo {
- get {
- if (!this.m_bUseUserOverride) {
- return (false);
- }
- int lcid;
- CultureInfo.nativeGetUserDefaultLCID(&lcid, CultureInfo.LOCALE_USER_DEFAULT);
-
- if (ActualCultureID == CultureInfo.LOCALE_CUSTOM_UNSPECIFIED && lcid == CultureInfo.LOCALE_CUSTOM_DEFAULT) {
- if (SNAME.Equals(CultureInfo.nativeGetCultureName(lcid, true, false))) {
- return true;
- }
- return false;
- }
-
- return (this.ActualCultureID == lcid);
- }
- }
-
-
-
-
-
-
-
-
- unsafe internal bool UseCurrentCalendar(int calID)
- {
- return (UseGetLocaleInfo && CultureInfo.nativeGetCurrentCalendar() == calID);
- }
-
-
- internal bool IsValidSortID(int sortID)
- {
- BCLDebug.Assert(sortID >= 0 && sortID <= 65535, "sortID is invalid");
-
- if (sortID == 0 || (this.SALTSORTID != null && this.SALTSORTID.Length >= sortID && this.SALTSORTID[sortID - 1].Length != 0)) {
- return true;
- }
- else {
- return false;
- }
- }
-
- internal CultureTableRecord CloneWithUserOverride(bool userOverride)
- {
- if (m_bUseUserOverride == userOverride)
- return this;
-
- CultureTableRecord cultureTableRecord = (CultureTableRecord)this.MemberwiseClone();
- cultureTableRecord.m_bUseUserOverride = userOverride;
-
- return cultureTableRecord;
- }
-
-
-
-
-
-
- unsafe internal string CultureNativeDisplayName {
- get {
- int lcid;
- CultureInfo.nativeGetUserDefaultUILanguage(&lcid);
-
- if (CultureInfo.GetLangID(lcid) == CultureInfo.GetLangID(CultureInfo.CurrentUICulture.LCID)) {
- string localizedLanguageName = CultureInfo.nativeGetLocaleInfo(m_ActualCultureID, LOCALE_SLANGUAGE);
- if (localizedLanguageName != null) {
-
- if (localizedLanguageName[localizedLanguageName.Length - 1] == '\0')
- return localizedLanguageName.Substring(0, localizedLanguageName.Length - 1);
- else
- return localizedLanguageName;
- }
- }
-
- return this.SNATIVEDISPLAYNAME;
- }
- }
-
-
-
-
-
-
- unsafe internal string RegionNativeDisplayName {
- get {
- int lcid;
- CultureInfo.nativeGetUserDefaultUILanguage(&lcid);
-
- if (CultureInfo.GetLangID(lcid) == CultureInfo.GetLangID(CultureInfo.CurrentUICulture.LCID)) {
- string localizedCountryName = CultureInfo.nativeGetLocaleInfo(m_ActualCultureID, LOCALE_SCOUNTRY);
- if (localizedCountryName != null) {
- if (localizedCountryName[localizedCountryName.Length - 1] == '\0')
- return localizedCountryName.Substring(0, localizedCountryName.Length - 1);
- else
- return localizedCountryName;
- }
- }
-
- return this.SNATIVECOUNTRY;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////
- unsafe public override bool Equals(object value)
- {
- CultureTableRecord that = value as CultureTableRecord;
- return (that != null) && (this.m_pData == that.m_pData && this.m_bUseUserOverride == that.m_bUseUserOverride && this.m_CultureID == that.m_CultureID && CultureInfo.InvariantCulture.CompareInfo.Compare(this.m_CultureName, that.m_CultureName, CompareOptions.IgnoreCase) == 0 && this.m_CultureTable.Equals(that.m_CultureTable));
- }
-
- ////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////
- public override int GetHashCode()
- {
-
- if (!IsCustomCultureId(m_CultureID))
- return (this.m_CultureID);
-
- return (this.m_CultureName.GetHashCode());
- }
-
-
- unsafe private string GetString(uint iOffset)
- {
- char* pCharValues = unchecked((char*)(this.m_pPool + iOffset));
- if (pCharValues[1] == 0) {
- BCLDebug.Assert(iOffset == 0, "[CultureTableRecord.GetString]Expected empty strings to have 0 offset");
- return String.Empty;
- }
- return new string(pCharValues + 1, 0, (int)pCharValues[0]);
- }
-
- private int InteropLCID {
- get { return ActualCultureID == CultureInfo.LOCALE_CUSTOM_UNSPECIFIED ? CultureInfo.LOCALE_CUSTOM_DEFAULT : ActualCultureID; }
- }
-
- private string GetOverrideString(uint iOffset, int iWindowsFlag)
- {
- return GetString(iOffset);
- }
-
- unsafe private string[] GetStringArray(uint iOffset)
- {
- if (iOffset == 0)
- return new string[0];
-
-
- ushort* pCount = m_pPool + iOffset;
- int count = (int)pCount[0];
-
- BCLDebug.Assert(count != 0, "[CultureTableRecord.GetStringArray]Expected non-zero length array");
- string[] values = new string[count];
-
-
- uint* pStringArray = (uint*)(pCount + 1);
-
-
- for (int i = 0; i < count; i++)
- values[i] = GetString(pStringArray[i]);
-
- return (values);
- }
-
-
- unsafe private string GetStringArrayDefault(uint iOffset)
- {
- if (iOffset == 0)
- return String.Empty;
-
-
- ushort* pCount = m_pPool + iOffset;
- BCLDebug.Assert(pCount[0] != 0, "[CultureTableRecord.GetStringArrayDefault]Expected non-zero length array");
-
-
- uint* pStringArray = (uint*)(pCount + 1);
-
-
- return GetString(pStringArray[0]);
- }
-
-
- private string GetOverrideStringArrayDefault(uint iOffset, int iWindowsFlag)
- {
-
- return GetStringArrayDefault(iOffset);
- }
-
- private ushort GetOverrideUSHORT(ushort iData, int iWindowsFlag)
- {
- return iData;
- }
-
- unsafe private int[] GetWordArray(uint iData)
- {
- if (iData == 0)
- return new int[0];
-
- ushort* pWord = this.m_pPool + iData;
- int count = (int)pWord[0];
-
- BCLDebug.Assert(count != 0, "[CultureTableRecord.GetWordArray]Expected non-zero length array");
-
- int[] values = new int[count];
- pWord++;
-
- for (int i = 0; i < count; i++) {
- values[i] = pWord[i];
- }
- return (values);
- }
-
- private int[] GetOverrideGrouping(uint iData, int iWindowsFlag)
- {
-
- return GetWordArray(iData);
- }
-
-
-
- internal int ActualCultureID {
- get {
- if (0 == this.m_ActualCultureID) {
- this.m_ActualCultureID = this.ILANGUAGE;
- }
-
- return (this.m_ActualCultureID);
- }
- }
-
-
-
- internal string ActualName {
- get {
- if (null == this.m_ActualName) {
- this.m_ActualName = this.SNAME;
- }
-
- return (this.m_ActualName);
- }
- }
-
- internal bool IsNeutralCulture {
- get { return ((IFLAGS & (ushort)CultureFlags.IsSpecificCulture) == 0); }
- }
-
- ////////////////////////////////////////////////////////////////////////
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////
-
-
-
- unsafe internal ushort IDIGITS {
- get { return (this.m_pData->iDigits); }
- }
-
- unsafe internal ushort INEGNUMBER {
- get { return (this.m_pData->iNegativeNumber); }
- }
-
- unsafe internal ushort ICURRDIGITS {
- get { return (this.m_pData->iCurrencyDigits); }
- }
-
- unsafe internal ushort ICURRENCY {
- get { return (this.m_pData->iCurrency); }
- }
-
- unsafe internal ushort INEGCURR {
- get { return (this.m_pData->iNegativeCurrency); }
- }
-
-
- unsafe internal ushort ICALENDARTYPE {
- get { return ((ushort)IOPTIONALCALENDARS[0]); }
- }
- unsafe internal ushort IFIRSTWEEKOFYEAR {
- get { return GetOverrideUSHORT(this.m_pData->iFirstWeekOfYear, CultureTableData.LOCALE_IFIRSTWEEKOFYEAR); }
- }
-
-
- unsafe internal ushort IMEASURE {
- get { return GetOverrideUSHORT(this.m_pData->iMeasure, CultureTableData.LOCALE_IMEASURE); }
- }
-
- unsafe internal ushort IDIGITSUBSTITUTION {
- get { return GetOverrideUSHORT(this.m_pData->iDigitSubstitution, CultureTableData.LOCALE_IDIGITSUBSTITUTION); }
- }
-
-
- unsafe internal int[] SGROUPING {
- get { return GetOverrideGrouping(this.m_pData->waGrouping, CultureTableData.LOCALE_SGROUPING); }
- }
-
- unsafe internal int[] SMONGROUPING {
- get { return GetOverrideGrouping(this.m_pData->waMonetaryGrouping, CultureTableData.LOCALE_SMONGROUPING); }
- }
-
-
- unsafe internal string SLIST {
- get { return GetOverrideString(this.m_pData->sListSeparator, CultureTableData.LOCALE_SLIST); }
- }
-
- unsafe internal string SDECIMAL {
- get { return GetString(this.m_pData->sDecimalSeparator); }
- }
-
- unsafe internal string STHOUSAND {
- get { return GetString(this.m_pData->sThousandSeparator); }
- }
-
- unsafe internal string SCURRENCY {
- get { return GetString(this.m_pData->sCurrency); }
- }
-
- unsafe internal string SMONDECIMALSEP {
- get { return GetString(this.m_pData->sMonetaryDecimal); }
- }
-
- unsafe internal string SMONTHOUSANDSEP {
- get { return GetString(this.m_pData->sMonetaryThousand); }
- }
-
- unsafe internal string SNEGATIVESIGN {
- get { return GetString(this.m_pData->sNegativeSign); }
- }
-
- unsafe internal string S1159 {
- get { return GetString(this.m_pData->sAM1159); }
- }
-
- unsafe internal string S2359 {
- get { return GetString(this.m_pData->sPM2359); }
- }
-
-
-
- unsafe internal string STIMEFORMAT {
- get { return ReescapeWin32String(GetStringArrayDefault(this.m_pData->saTimeFormat)); }
- }
-
- unsafe internal string SSHORTTIME {
- get { return ReescapeWin32String(GetStringArrayDefault(this.m_pData->saShortTime)); }
- }
-
- unsafe internal string SSHORTDATE {
- get { return ReescapeWin32String(GetStringArrayDefault(this.m_pData->saShortDate)); }
- }
-
- unsafe internal string SLONGDATE {
- get { return ReescapeWin32String(GetStringArrayDefault(this.m_pData->saLongDate)); }
- }
-
- unsafe internal string SYEARMONTH {
- get { return ReescapeWin32String(GetStringArrayDefault(this.m_pData->saYearMonth)); }
- }
-
- unsafe internal string SMONTHDAY {
- get { return ReescapeWin32String(GetString(this.m_pData->sMonthDay)); }
- }
-
-
- unsafe internal string[] STIMEFORMATS {
- get { return ReescapeWin32Strings(GetStringArray(this.m_pData->saTimeFormat)); }
- }
-
- unsafe internal string[] SSHORTTIMES {
- get { return ReescapeWin32Strings(GetStringArray(this.m_pData->saShortTime)); }
- }
-
- unsafe internal string[] SSHORTDATES {
- get { return ReescapeWin32Strings(GetStringArray(this.m_pData->saShortDate)); }
- }
-
- unsafe internal string[] SLONGDATES {
- get { return ReescapeWin32Strings(GetStringArray(this.m_pData->saLongDate)); }
- }
-
- unsafe internal string[] SYEARMONTHS {
- get { return ReescapeWin32Strings(GetStringArray(this.m_pData->saYearMonth)); }
- }
-
- unsafe internal string[] SNATIVEDIGITS {
-
- get { return GetStringArray(this.m_pData->saNativeDigits); }
- }
-
-
- unsafe internal ushort ILANGUAGE {
- get { return this.m_pData->iLanguage; }
- }
-
-
- unsafe internal ushort IDEFAULTANSICODEPAGE {
- get { return this.m_pData->iDefaultAnsiCodePage; }
- }
-
- unsafe internal ushort IDEFAULTOEMCODEPAGE {
- get { return this.m_pData->iDefaultOemCodePage; }
- }
-
- unsafe internal ushort IDEFAULTMACCODEPAGE {
- get { return this.m_pData->iDefaultMacCodePage; }
- }
-
- unsafe internal ushort IDEFAULTEBCDICCODEPAGE {
- get { return this.m_pData->iDefaultEbcdicCodePage; }
- }
-
- unsafe internal ushort IGEOID {
- get { return this.m_pData->iGeoId; }
- }
-
-
-
- unsafe internal ushort INEGATIVEPERCENT {
- get { return this.m_pData->iNegativePercent; }
- }
-
- unsafe internal ushort IPOSITIVEPERCENT {
- get { return this.m_pData->iPositivePercent; }
- }
-
- unsafe internal ushort IPARENT {
- get { return this.m_pData->iParent; }
- }
-
- unsafe internal ushort ILINEORIENTATIONS {
- get { return this.m_pData->iLineOrientations; }
- }
-
- unsafe internal uint ICOMPAREINFO {
- get { return this.m_pData->iCompareInfo; }
- }
-
- unsafe internal uint IFLAGS {
- get { return this.m_pData->iFlags; }
- }
-
-
- unsafe internal int[] IOPTIONALCALENDARS {
- get { return GetWordArray(this.m_pData->waCalendars); }
- }
-
-
- unsafe internal string SNAME {
- get { return GetString(this.m_pData->sName); }
- }
-
- unsafe internal string SABBREVLANGNAME {
- get { return GetString(this.m_pData->sAbbrevLang); }
- }
-
- unsafe internal string SISO639LANGNAME {
- get { return GetString(this.m_pData->sISO639Language); }
- }
-
-
-
- unsafe internal string SENGCOUNTRY {
- get { return GetString(this.m_pData->sEnglishCountry); }
- }
-
- unsafe internal string SNATIVECOUNTRY {
- get { return GetString(this.m_pData->sNativeCountry); }
- }
-
- unsafe internal string SABBREVCTRYNAME {
- get { return GetString(this.m_pData->sAbbrevCountry); }
- }
-
- unsafe internal string SISO3166CTRYNAME {
- get { return GetString(this.m_pData->sISO3166CountryName); }
- }
-
- unsafe internal string SINTLSYMBOL {
- get { return GetString(this.m_pData->sIntlMonetarySymbol); }
- }
-
- unsafe internal string SENGLISHCURRENCY {
- get { return GetString(this.m_pData->sEnglishCurrency); }
- }
-
- unsafe internal string SNATIVECURRENCY {
- get { return GetString(this.m_pData->sNativeCurrency); }
- }
-
- unsafe internal string SENGDISPLAYNAME {
- get { return GetString(this.m_pData->sEnglishDisplayName); }
- }
-
- unsafe internal string SISO639LANGNAME2 {
- get { return GetString(this.m_pData->sISO639Language2); }
- }
-
- unsafe internal string SNATIVEDISPLAYNAME {
- get {
-
- if (CultureInfo.GetLangID(ActualCultureID) == 1028 && CultureInfo.GetLangID(CultureInfo.InstalledUICulture.LCID) == 1028 && !IsCustomCulture) {
- return (CultureInfo.nativeGetLocaleInfo(1028, LOCALE_SNATIVELANGNAME) + " (" + CultureInfo.nativeGetLocaleInfo(1028, LOCALE_SNATIVECTRYNAME) + ")");
- }
- return GetString(this.m_pData->sNativeDisplayName);
- }
- }
-
- unsafe internal string SPERCENT {
- get { return GetString(this.m_pData->sPercent); }
- }
-
- unsafe internal string SNAN {
- get { return GetString(this.m_pData->sNaN); }
- }
-
- unsafe internal string SPOSINFINITY {
- get { return GetString(this.m_pData->sPositiveInfinity); }
- }
-
- unsafe internal string SNEGINFINITY {
- get { return GetString(this.m_pData->sNegativeInfinity); }
- }
-
- unsafe internal string SADERA {
- get { return GetString(this.m_pData->sAdEra); }
- }
-
- unsafe internal string SABBREVADERA {
- get { return GetString(this.m_pData->sAbbrevAdEra); }
- }
-
- unsafe internal string SISO3166CTRYNAME2 {
- get { return GetString(this.m_pData->sISO3166CountryName2); }
- }
-
- unsafe internal string SREGIONNAME {
- get { return GetString(this.m_pData->sRegionName); }
- }
-
- unsafe internal string SPARENT {
- get { return GetString(this.m_pData->sParent); }
- }
-
- unsafe internal string SCONSOLEFALLBACKNAME {
- get { return GetString(this.m_pData->sConsoleFallbackName); }
- }
- unsafe internal string SSPECIFICCULTURE {
- get { return GetString(this.m_pData->sSpecificCulture); }
- }
- unsafe internal string SIETFTAG {
- get { return GetString(this.m_pData->sIetfLanguage); }
- }
-
-
- unsafe internal string[] SDAYNAMES {
- get { return GetStringArray(this.m_pData->saDayNames); }
- }
-
- unsafe internal string[] SABBREVDAYNAMES {
- get { return GetStringArray(this.m_pData->saAbbrevDayNames); }
- }
-
- unsafe internal string[] SSUPERSHORTDAYNAMES {
- get { return GetStringArray(this.m_pData->saSuperShortDayNames); }
- }
-
- unsafe internal string[] SMONTHNAMES {
- get { return GetStringArray(this.m_pData->saMonthNames); }
- }
-
- unsafe internal string[] SABBREVMONTHNAMES {
- get { return GetStringArray(this.m_pData->saAbbrevMonthNames); }
- }
-
- unsafe internal string[] SMONTHGENITIVENAMES {
- get { return GetStringArray(this.m_pData->saMonthGenitiveNames); }
- }
-
- unsafe internal string[] SABBREVMONTHGENITIVENAMES {
- get { return GetStringArray(this.m_pData->saAbbrevMonthGenitiveNames); }
- }
-
- unsafe internal string[] SNATIVECALNAMES {
- get { return GetStringArray(this.m_pData->saNativeCalendarNames); }
- }
-
- unsafe internal string[] SDATEWORDS {
- get { return GetStringArray(this.m_pData->saDateWords); }
- }
-
- unsafe internal string[] SALTSORTID {
- get { return GetStringArray(this.m_pData->saAltSortID); }
- }
-
-
-
-
-
- unsafe internal DateTimeFormatFlags IFORMATFLAGS {
- get { return (DateTimeFormatFlags)this.m_pData->iFormatFlags; }
- }
-
-
-
- unsafe internal string SPOSITIVESIGN {
- get {
- string strTemp = GetString(this.m_pData->sPositiveSign);
- if (strTemp == null || strTemp.Length == 0)
- strTemp = "+";
- return strTemp;
- }
- }
-
- static internal bool IsCustomCultureId(int cultureId)
- {
- if (cultureId == CultureInfo.LOCALE_CUSTOM_DEFAULT || cultureId == CultureInfo.LOCALE_CUSTOM_UNSPECIFIED)
- return true;
-
- return false;
- }
-
- unsafe private ushort ConvertFirstDayOfWeekMonToSun(int iTemp)
- {
-
- if (iTemp < 0 || iTemp > 6) {
-
-
- iTemp = 1;
- }
- else {
- if (iTemp == 6) {
- iTemp = 0;
- }
- else {
- iTemp++;
- }
- }
- return unchecked((ushort)iTemp);
- }
-
-
- unsafe internal ushort IFIRSTDAYOFWEEK {
- get { return this.m_pData->iFirstDayOfWeek; }
- }
-
- unsafe internal ushort IINPUTLANGUAGEHANDLE {
- get { return (this.m_pData->iInputLanguageHandle); }
- }
-
- unsafe internal ushort ITEXTINFO {
- get {
- ushort textInfo = this.m_pData->iTextInfo;
-
- if (this.CultureID == (ushort)SPANISH_TRADITIONAL_SORT)
- textInfo = (ushort)SPANISH_TRADITIONAL_SORT;
-
-
- if (textInfo == CultureInfo.LOCALE_CUSTOM_DEFAULT || textInfo == 0)
- textInfo = CultureInfo.LOCALE_INVARIANT;
- return textInfo;
- }
- }
-
-
- ////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////////
- private static string UnescapeWin32String(string str, int start, int end)
- {
- StringBuilder result = null;
-
- bool inQuote = false;
- for (int i = start; i < str.Length && i <= end; i++) {
-
- if (str[i] == '\'') {
-
- if (inQuote) {
- BCLDebug.Assert(result != null, "[CultureTable.UnescapeWin32String]Expect result to be non-null");
-
- if (i + 1 < str.Length) {
- if (str[i + 1] == '\'') {
-
- result.Append('\'');
- i++;
- continue;
- }
- }
-
- inQuote = false;
- }
- else {
-
- inQuote = true;
- if (result == null)
- result = new StringBuilder(str, start, i - start, str.Length);
- }
- }
- else {
-
- if (result != null)
- result.Append(str[i]);
- }
- }
-
-
- if (result == null)
- return (str.Substring(start, end - start + 1));
-
-
- return (result.ToString());
- }
-
-
- ////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////////
- private static string ReescapeWin32String(string str)
- {
-
- if (str == null)
- return null;
-
- StringBuilder result = null;
-
- bool inQuote = false;
- for (int i = 0; i < str.Length; i++) {
-
- if (str[i] == '\'') {
-
- if (inQuote) {
-
- if (i + 1 < str.Length && str[i + 1] == '\'') {
-
-
- if (result == null)
- result = new StringBuilder(str, 0, i, str.Length * 2);
-
-
- result.Append("\\'");
- i++;
- continue;
- }
-
-
- inQuote = false;
- }
- else {
-
- inQuote = true;
- }
- }
-
- else if (str[i] == '\\') {
-
-
- if (result == null)
- result = new StringBuilder(str, 0, i, str.Length * 2);
-
-
- result.Append("\\\\");
- continue;
- }
-
-
- if (result != null)
- result.Append(str[i]);
- }
-
-
- if (result == null)
- return str;
-
-
- return result.ToString();
- }
-
- private static string[] ReescapeWin32Strings(string[] array)
- {
- if (array != null) {
- for (int i = 0; i < array.Length; i++) {
- array[i] = ReescapeWin32String(array[i]);
- }
- }
-
- return array;
- }
-
- unsafe internal string STIME {
- get {
-
- string timeFormat = GetOverrideStringArrayDefault(this.m_pData->saTimeFormat, CultureTableData.LOCALE_STIMEFORMAT);
- return GetTimeSeparator(timeFormat);
- }
- }
-
- unsafe internal string SDATE {
- get {
-
- string shortDate = GetOverrideStringArrayDefault(this.m_pData->saShortDate, CultureTableData.LOCALE_SSHORTDATE);
- return GetDateSeparator(shortDate);
- }
- }
-
- private static string GetTimeSeparator(string format)
- {
-
-
-
-
-
-
-
-
- string strUse = String.Empty;
- int count = 0;
- int separatorStart = -1;
-
-
- for (count = 0; count < format.Length; count++) {
-
- if (format[count] == 'H' || format[count] == 'h' || format[count] == 'm' || format[count] == 's') {
-
- char cFound = format[count];
-
- for (count++; count < format.Length && format[count] == cFound; count++) {
-
- }
-
-
- if (count < format.Length) {
-
- separatorStart = count;
- break;
- }
- }
-
-
- if (format[count] == '\'') {
-
-
-
-
- for (count++; count < format.Length && (format[count] != '\''); count++) {
-
- }
-
-
- }
-
-
- }
-
-
- if (separatorStart != -1) {
- for (count = separatorStart; count < format.Length; count++) {
-
- if (format[count] == 'H' || format[count] == 'h' || format[count] == 'm' || format[count] == 's') {
-
-
- strUse = UnescapeWin32String(format, separatorStart, count - 1);
- break;
- }
-
-
- if (format[count] == '\'') {
-
-
-
- for (count++; count < format.Length && (format[count] != '\''); count++) {
-
- }
-
-
- }
-
-
- }
- }
-
-
- return strUse;
- }
-
- private static string GetDateSeparator(string format)
- {
-
-
-
-
-
-
-
-
- string strUse = String.Empty;
- int count = 0;
- int separatorStart = -1;
-
-
- for (count = 0; count < format.Length; count++) {
-
- if (format[count] == 'd' || format[count] == 'y' || format[count] == 'M') {
-
- char cFound = format[count];
-
- for (count++; count < format.Length && format[count] == cFound; count++) {
-
- }
-
-
- if (count < format.Length) {
-
- separatorStart = count;
- break;
- }
- }
-
-
- if (format[count] == '\'') {
-
-
-
-
- for (count++; count < format.Length && (format[count] != '\''); count++) {
-
- }
-
-
- }
-
-
- }
-
-
- if (separatorStart != -1) {
- for (count = separatorStart; count < format.Length; count++) {
-
- if (format[count] == 'y' || format[count] == 'M' || format[count] == 'd') {
-
-
- strUse = UnescapeWin32String(format, separatorStart, count - 1);
- break;
- }
-
-
- if (format[count] == '\'') {
-
-
-
- for (count++; count < format.Length && (format[count] != '\''); count++) {
-
- }
-
-
- }
-
-
- }
- }
-
-
- return strUse;
- }
-
- ////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////////
- unsafe internal void GetDTFIOverrideValues(ref DTFIUserOverrideValues values)
- {
- BCLDebug.Assert(UseUserOverride, "CultureTableRecord.GetDTFIOverrideValues(): Call this only when UseUserOverride is true.");
- bool result = false;
- if (UseGetLocaleInfo)
- result = CultureInfo.nativeGetDTFIUserValues(InteropLCID, ref values);
-
- if (result) {
-
-
-
-
-
- values.firstDayOfWeek = ConvertFirstDayOfWeekMonToSun((int)values.firstDayOfWeek);
-
-
- values.shortDatePattern = ReescapeWin32String(values.shortDatePattern);
- values.longDatePattern = ReescapeWin32String(values.longDatePattern);
- values.longTimePattern = ReescapeWin32String(values.longTimePattern);
- values.yearMonthPattern = ReescapeWin32String(values.yearMonthPattern);
- }
- else {
-
-
-
- values.firstDayOfWeek = IFIRSTDAYOFWEEK;
- values.calendarWeekRule = IFIRSTWEEKOFYEAR;
- values.shortDatePattern = SSHORTDATE;
- values.longDatePattern = SLONGDATE;
- values.yearMonthPattern = SYEARMONTH;
- values.amDesignator = S1159;
- values.pmDesignator = S2359;
- values.longTimePattern = STIMEFORMAT;
- }
- }
-
- unsafe internal void GetNFIOverrideValues(NumberFormatInfo nfi)
- {
- bool result = false;
- if (UseGetLocaleInfo) {
- result = CultureInfo.nativeGetNFIUserValues(InteropLCID, nfi);
- }
-
- if (!result) {
-
- nfi.numberDecimalDigits = IDIGITS;
- nfi.numberNegativePattern = INEGNUMBER;
- nfi.currencyDecimalDigits = ICURRDIGITS;
- nfi.currencyPositivePattern = ICURRENCY;
- nfi.currencyNegativePattern = INEGCURR;
- nfi.negativeSign = SNEGATIVESIGN;
- nfi.numberDecimalSeparator = SDECIMAL;
- nfi.numberGroupSeparator = STHOUSAND;
- nfi.positiveSign = SPOSITIVESIGN;
- nfi.currencyDecimalSeparator = SMONDECIMALSEP;
- nfi.currencySymbol = SCURRENCY;
- nfi.currencyGroupSeparator = SMONTHOUSANDSEP;
- nfi.nativeDigits = SNATIVEDIGITS;
- nfi.digitSubstitution = IDIGITSUBSTITUTION;
- }
- else if (-1 == nfi.digitSubstitution) {
-
-
-
- nfi.digitSubstitution = IDIGITSUBSTITUTION;
- }
-
- nfi.numberGroupSizes = SGROUPING;
- nfi.currencyGroupSizes = SMONGROUPING;
-
- nfi.percentDecimalDigits = nfi.numberDecimalDigits;
- nfi.percentDecimalSeparator = nfi.numberDecimalSeparator;
- nfi.percentGroupSizes = nfi.numberGroupSizes;
- nfi.percentGroupSeparator = nfi.numberGroupSeparator;
- nfi.percentNegativePattern = INEGATIVEPERCENT;
- nfi.percentPositivePattern = IPOSITIVEPERCENT;
- nfi.percentSymbol = SPERCENT;
-
- if (nfi.positiveSign == null || nfi.positiveSign.Length == 0)
- nfi.positiveSign = "+";
-
- if (nfi.currencyDecimalSeparator.Length == 0) {
- nfi.currencyDecimalSeparator = SMONDECIMALSEP;
- }
-
-
- }
-
-
-
-
- unsafe internal int EverettDataItem()
- {
-
- if (this.IsCustomCulture) {
- return 0;
- }
-
- InitEverettCultureDataItemMapping();
-
-
- int left = 0;
- int right = (m_EverettCultureDataItemMappingsSize / 2) - 1;
-
- while (left <= right) {
- int mid = (left + right) / 2;
- int result = this.m_CultureID - m_EverettCultureDataItemMappings[mid * 2];
- if (result == 0) {
-
- return m_EverettCultureDataItemMappings[mid * 2 + 1];
- }
- if (result < 0)
- right = mid - 1;
- else
- left = mid + 1;
- }
-
- return 0;
- }
-
- unsafe internal int EverettRegionDataItem()
- {
-
- if (this.IsCustomCulture) {
- return 0;
- }
-
- InitEverettRegionDataItemMapping();
-
-
- int left = 0;
- int right = (m_EverettRegionDataItemMappingsSize / 2) - 1;
-
- while (left <= right) {
- int mid = (left + right) / 2;
- int result = this.m_CultureID - m_EverettRegionDataItemMappings[mid * 2];
- if (result == 0) {
-
- return m_EverettRegionDataItemMappings[mid * 2 + 1];
- }
- if (result < 0)
- right = mid - 1;
- else
- left = mid + 1;
- }
-
- return 0;
- }
-
- unsafe static internal int IdFromEverettDataItem(int iDataItem)
- {
- InitEverettDataItemToLCIDMappings();
-
-
- BCLDebug.Assert(iDataItem >= 0 && iDataItem < m_EverettDataItemToLCIDMappingsSize, String.Format(CultureInfo.CurrentCulture, "[CultureTableRecord.IdFromEverettDataItem]Expected Everett data item in range of data table {0}", iDataItem));
- if (iDataItem < 0 || iDataItem >= m_EverettDataItemToLCIDMappingsSize) {
-
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFieldState"));
- }
- return m_EverettDataItemToLCIDMappings[iDataItem];
- }
-
- unsafe static internal int IdFromEverettRegionInfoDataItem(int iDataItem)
- {
- InitEverettRegionDataItemToLCIDMappings();
-
-
- BCLDebug.Assert(iDataItem >= 0 && iDataItem < m_EverettRegionInfoDataItemToLCIDMappingsSize, String.Format(CultureInfo.CurrentCulture, "[CultureTableRecord.IdFromEverettRegionInfoDataItem]Expected Everett data item in range of data table {0}", iDataItem));
- if (iDataItem < 0 || iDataItem >= m_EverettRegionInfoDataItemToLCIDMappingsSize) {
-
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFieldState"));
- }
- return m_EverettRegionInfoDataItemToLCIDMappings[iDataItem];
- }
-
-
- const int INT32TABLE_EVERETT_REGION_DATA_ITEM_MAPPINGS = 0;
- const int INT32TABLE_EVERETT_CULTURE_DATA_ITEM_MAPPINGS = 1;
- const int INT32TABLE_EVERETT_DATA_ITEM_TO_LCID_MAPPINGS = 2;
- const int INT32TABLE_EVERETT_REGION_DATA_ITEM_TO_LCID_MAPPINGS = 3;
-
- unsafe static int* m_EverettRegionDataItemMappings = null;
- unsafe static int m_EverettRegionDataItemMappingsSize = 0;
-
-
-
-
- unsafe private static void InitEverettRegionDataItemMapping()
- {
- if (m_EverettRegionDataItemMappings == null) {
- int* temp = CultureInfo.nativeGetStaticInt32DataTable(INT32TABLE_EVERETT_REGION_DATA_ITEM_MAPPINGS, out m_EverettRegionDataItemMappingsSize);
- m_EverettRegionDataItemMappings = temp;
- BCLDebug.Assert(m_EverettRegionDataItemMappings != null, "CultureTableRecord.m_EverettRegionDataItemMappings can not be null");
- BCLDebug.Assert(m_EverettRegionDataItemMappingsSize > 0, "CultureTableRecord.m_EverettRegionDataItemMappingsSize > 0");
- }
- }
-
- unsafe static int* m_EverettCultureDataItemMappings = null;
- static int m_EverettCultureDataItemMappingsSize = 0;
-
-
-
-
- unsafe private static void InitEverettCultureDataItemMapping()
- {
- if (m_EverettCultureDataItemMappings == null) {
- int* temp = CultureInfo.nativeGetStaticInt32DataTable(INT32TABLE_EVERETT_CULTURE_DATA_ITEM_MAPPINGS, out m_EverettCultureDataItemMappingsSize);
- m_EverettCultureDataItemMappings = temp;
- BCLDebug.Assert(m_EverettCultureDataItemMappings != null, "CultureTableRecord.m_EverettCultureDataItemMappings can not be null");
- BCLDebug.Assert(m_EverettCultureDataItemMappingsSize > 0, "CultureTableRecord.m_EverettCultureDataItemMappingsSize > 0");
- }
- }
-
-
- unsafe private static int* m_EverettDataItemToLCIDMappings = null;
- private static int m_EverettDataItemToLCIDMappingsSize = 0;
-
-
-
-
- unsafe private static void InitEverettDataItemToLCIDMappings()
- {
- if (m_EverettDataItemToLCIDMappings == null) {
- int* temp = CultureInfo.nativeGetStaticInt32DataTable(INT32TABLE_EVERETT_DATA_ITEM_TO_LCID_MAPPINGS, out m_EverettDataItemToLCIDMappingsSize);
- m_EverettDataItemToLCIDMappings = temp;
- BCLDebug.Assert(m_EverettDataItemToLCIDMappings != null, "CultureTableRecord.m_EverettDataItemToLCIDMappings can not be null");
- BCLDebug.Assert(m_EverettDataItemToLCIDMappingsSize > 0, "CultureTableRecord.m_EverettDataItemToLCIDMappingsSize > 0");
- }
- }
-
- unsafe private static int* m_EverettRegionInfoDataItemToLCIDMappings = null;
- private static int m_EverettRegionInfoDataItemToLCIDMappingsSize = 0;
-
-
-
-
- unsafe private static void InitEverettRegionDataItemToLCIDMappings()
- {
- if (m_EverettRegionInfoDataItemToLCIDMappings == null) {
- int* temp = CultureInfo.nativeGetStaticInt32DataTable(INT32TABLE_EVERETT_REGION_DATA_ITEM_TO_LCID_MAPPINGS, out m_EverettRegionInfoDataItemToLCIDMappingsSize);
-
- m_EverettRegionInfoDataItemToLCIDMappings = temp;
- BCLDebug.Assert(m_EverettRegionInfoDataItemToLCIDMappings != null, "CultureTableRecord.m_EverettRegionInfoDataItemToLCIDMappings can not be null");
- BCLDebug.Assert(m_EverettRegionInfoDataItemToLCIDMappingsSize > 0, "CultureTableRecord.m_EverettRegionInfoDataItemToLCIDMappingsSize > 0");
- }
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////////
-
- [StructLayout(LayoutKind.Sequential, Pack = 2)]
- internal struct DTFIUserOverrideValues
- {
-
- internal string shortDatePattern;
- internal string longDatePattern;
- internal string yearMonthPattern;
-
-
- internal string amDesignator;
- internal string pmDesignator;
- internal string longTimePattern;
- internal int firstDayOfWeek;
- internal int padding1;
-
- internal int calendarWeekRule;
- internal int padding2;
-
- }
-
-
-
-
-
-
-
-
-
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct CultureData
- {
- internal string sIso639Language;
-
- internal string sIso3166CountryName;
-
- internal string sListSeparator;
-
- internal string sDecimalSeparator;
-
- internal string sThousandSeparator;
-
- internal string sCurrency;
-
- internal string sMonetaryDecimal;
-
- internal string sMonetaryThousand;
-
- internal string sNegativeSign;
-
- internal string sAM1159;
-
- internal string sPM2359;
-
- internal string sAbbrevLang;
-
- internal string sEnglishLanguage;
-
- internal string sEnglishCountry;
-
- internal string sNativeLanguage;
-
- internal string sNativeCountry;
-
- internal string sAbbrevCountry;
-
- internal string sIntlMonetarySymbol;
-
- internal string sEnglishCurrency;
-
- internal string sNativeCurrency;
-
- internal string saAltSortID;
-
-
-
- internal string sPositiveSign;
-
-
- internal string saNativeDigits;
-
- internal string waGrouping;
-
- internal string waMonetaryGrouping;
-
- internal string waFontSignature;
-
-
- internal string sNaN;
-
- internal string sPositiveInfinity;
-
- internal string sNegativeInfinity;
-
- internal string sISO3166CountryName2;
-
- internal string sISO639Language2;
-
- internal string sIetfLanguage;
-
- internal string[] saSuperShortDayNames;
-
-
- internal string[] saTimeFormat;
-
- internal string[] saShortDate;
-
- internal string[] saLongDate;
-
- internal string[] saYearMonth;
-
- internal string[] saMonthNames;
-
-
- internal string[] saDayNames;
-
-
- internal string[] saAbbrevDayNames;
-
- internal string[] saAbbrevMonthNames;
-
- internal string[] saNativeCalendarNames;
-
- internal string[] saGenitiveMonthNames;
-
- internal string[] saAbbrevGenitiveMonthNames;
-
-
- internal ushort[] waCalendars;
-
-
- internal int iFirstDayOfWeek;
-
- internal int iDigits;
-
- internal int iNegativeNumber;
-
- internal int iCurrencyDigits;
-
- internal int iCurrency;
-
- internal int iNegativeCurrency;
-
- internal int iFirstWeekOfYear;
-
- internal int iMeasure;
-
- internal int iDigitSubstitution;
-
- internal int iDefaultAnsiCodePage;
-
- internal int iDefaultOemCodePage;
-
- internal int iDefaultMacCodePage;
-
- internal int iDefaultEbcdicCodePage;
-
- internal int iCountry;
-
- internal int iPaperSize;
-
- internal int iLeadingZeros;
-
- internal int iIntlCurrencyDigits;
-
- internal int iGeoId;
-
- internal int iDefaultCalender;
-
- }
- }