private OptionsForm(bool local)
{
InitializeComponent();
// Copy the Bootstrap.exe file to New.exe,
// so that the configuration file will load properly
string currentDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string sandboxDir = Path.Combine(currentDir, "Sandbox");
if (!File.Exists(Path.Combine(sandboxDir, "New.exe")))
{
File.Copy(
Path.Combine(sandboxDir, "Bootstrap.exe"),
Path.Combine(sandboxDir, "New.exe")
);
}
string filename = local ? "New.exe" : "Bootstrap.exe";
string filepath = Path.Combine(sandboxDir, filename);
_Configuration = ConfigurationManager.OpenExeConfiguration(filepath);
// Get the DDay.Update configuration section
_Cfg = _Configuration.GetSection("DDay.Update") as DDayUpdateConfigurationSection;
// Set the default setting on which application folder to use.
cbAppFolder.SelectedIndex = 0;
SetValuesFromConfig();
if (!local)
_Configuration.SaveAs(Path.Combine(sandboxDir, "New.exe.config"));
}