//Main method
public static void Main(string[] args)
{
if(args != null && args.Length > 0)
{
string clientConfigFile = args[0];
if(!File.Exists(Environment.CurrentDirectory + "\\" + clientConfigFile))
{
throw new Exception("client config file: " + clientConfigFile + " does not exist!");
}
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = clientConfigFile;
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
AppSettingsSection section = (AppSettingsSection)config.GetSection("appSettings");
Utils.Section = section;
}
else
{
throw new Exception("No config file specified!");
}
}
</pre><p></p><p></p><p> //Utils.cs</p><p> <pre name="code" class="csharp"> public class Utils
{
public static AppSettingsSection Section = null;
public static String ListURL
{
get
{
return Section.Settings[SourceName + "ListURL"].Value;
}
}
}