public static Configuration OpenSpecificConfigurationFile(string configPath)
{
if (string.IsNullOrEmpty(configPath))
{
throw new ApplicationException("TODO");
}
System.Configuration.Configuration machineConfig = ConfigurationManager.OpenMachineConfiguration();
if (File.Exists(configPath) == false)
{
throw new ApplicationException("TODO");
}
try
{
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.MachineConfigFilename = machineConfig.FilePath;
fileMap.ExeConfigFilename = configPath;
Configuration cfg = ConfigurationManager.OpenMappedExeConfiguration(fileMap,
ConfigurationUserLevel.None);
return cfg;
}
catch (Exception exception)
{
throw exception;
}
}