public AddinSettings()
{
GetDefaultSettings();
Configuration roamingConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming);
//the roamingConfig now get a path such as C:\Users\<user>\AppData\Roaming\Sparx_Systems_Pty_Ltd\DefaultDomain_Path_2epjiwj3etsq5yyljkyqqi2yc4elkrkf\9,_2,_0,_921\user.config
// which I don't like. So we move up three directories and then add a directory for the EA Navigator so that we get
// C:\Users\<user>\AppData\Roaming\ho\hoTools\user.config
string configFileName = Path.GetFileName(roamingConfig.FilePath);
string configDirectory ="";
try
{
configDirectory = Directory.GetParent(roamingConfig.FilePath).Parent.Parent.Parent.FullName;
}
catch (Exception e)
{
MessageBox.Show($"Expected path: '\\Users\\<user>\\AppData\\Roaming\\ho\\hoTools\\user.config'\r\nconfigFilaname:'{configFileName}'\r\n{e}",
@"Can't get config file!");
}
string path;
switch (Customer) {
case CustomerCfg.HoTools:
path = @"\ho\hoTools\";
break;
case CustomerCfg.Var1:
path = @"\ho\hoTools_VAR1\";
break;
default:
path = @"\ho\hoTools\";
break;
}
// remember
ConfigPath = configDirectory + path;
ConfigFilePath = ConfigPath + configFileName;
// Map the roaming configuration file. This
// enables the application to access
// the configuration file using the
// System.Configuration.Configuration class
var configFileMap = new ExeConfigurationFileMap {ExeConfigFilename = ConfigFilePath};
// Get the mapped configuration file.
CurrentConfig = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
//merge the default settings
// - For simple values that's all to do
// they uses Getter/Setter, no special handling here
MergeDefaultSettings();
// get list from config
// for simple values nothing is to do here (there exists only a getter/setter)
ButtonsConfigSearch = GetButtonsSearch();
ButtonsServiceConfig = GetButtonsService();
GlobalKeysConfig = GetKeysService();
GlobalKeysConfigSearch = GetKeysSearch();
GetConnector(_logicalConnectors);
GetConnector(_activityConnectors);
HistorySqlFiles = new SqlHistoryFilesCfg(CurrentConfig);// history of sql files
LastOpenedFiles = new SqlLastOpenedFilesCfg(CurrentConfig); // last opened files
//-------------------------------------------
// Simple values uses Getter/Setter, no special handling here
}
#endregion