private unsafe 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)
{
// If we have invalid culture table then we have custom culture. in that case we'll try
// to see if the culture name is one of the framework or synthetic cultures and then
// try to create it otherwise we'll throw.
String defaultTableActualName;
int defaultTableCultureID;
int defaultTableDataItem = CultureTable.Default.GetDataItemFromCultureName(
name, out defaultTableCultureID, out defaultTableActualName);
if (defaultTableDataItem < 0) // not built in framework culture
{
}
return null; // returning null means fallback to framework or synthetic culture.
}
}
catch (FileNotFoundException)
{
//
// getting here means custom culture file get unregistered/renamed from different AppDomain/Process.
// just update the cache to point to the empty string as subsequent calls will not bother trying again.
//
cultureTable = null;
}
return cultureTable;
}