private string GetCustomConfigPath(string language)
{
string langPath = language;
if (!string.IsNullOrEmpty(language))
{
// First try the exact string given as a path
if (!File.Exists(langPath))
{
// Nope, well maybe its an absolute path to a folder.
// Add [language name].xml to the path and try that
langPath = Path.Combine(this._customLocation, language + ".xml");
if (!File.Exists(langPath))
{
// Not that either. Now assume its a relative path with the
// path specified in the string
string basePath = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName;
langPath = Path.Combine(basePath, this._customLocation);
if (!File.Exists(langPath))
{
// OK This is the last try. Tack on the [language name].xml
langPath = Path.Combine(langPath, language + ".xml");
if (!File.Exists(langPath))
return null;
}
}
}
}
return langPath;
}