/// <devdoc> /// We delegate this to the ClientConfigurationHost. The only thing we need to do here is to /// build a configPath from the ConfigurationUserLevel we get passed in. /// </devdoc> public override void InitForConfiguration(ref string locationSubPath, out string configPath, out string locationConfigPath, IInternalConfigRoot configRoot, params object[] hostInitConfigurationParams) { ConfigurationUserLevel userLevel = (ConfigurationUserLevel)hostInitConfigurationParams[0]; string desiredConfigPath = null; Host = (IInternalConfigHost)TypeUtil.CreateInstanceWithReflectionPermission(ClientConfigurationHostTypeName); switch (userLevel) { case ConfigurationUserLevel.None: desiredConfigPath = ClientHost.GetExeConfigPath(); break; case ConfigurationUserLevel.PerUserRoaming: desiredConfigPath = ClientHost.GetRoamingUserConfigPath(); break; case ConfigurationUserLevel.PerUserRoamingAndLocal: desiredConfigPath = ClientHost.GetLocalUserConfigPath(); break; default: throw new ArgumentException(SR.GetString(SR.UnknownUserLevel)); } Host.InitForConfiguration(ref locationSubPath, out configPath, out locationConfigPath, configRoot, null, null, desiredConfigPath); }
/// <summary> /// We delegate this to the ClientConfigurationHost. The only thing we need to do here is to /// build a configPath from the ConfigurationUserLevel we get passed in. /// </summary> public override void InitForConfiguration(ref string locationSubPath, out string configPath, out string locationConfigPath, IInternalConfigRoot configRoot, params object[] hostInitConfigurationParams) { ConfigurationUserLevel userLevel = (ConfigurationUserLevel)hostInitConfigurationParams[0]; Host = TypeUtil.CreateInstance <IInternalConfigHost>(ClientConfigurationHostTypeName); string desiredConfigPath = userLevel switch { ConfigurationUserLevel.None => ClientHost.GetExeConfigPath(), ConfigurationUserLevel.PerUserRoaming => ClientHost.GetRoamingUserConfigPath(), ConfigurationUserLevel.PerUserRoamingAndLocal => ClientHost.GetLocalUserConfigPath(), _ => throw new ArgumentException(SR.UnknownUserLevel), }; Host.InitForConfiguration(ref locationSubPath, out configPath, out locationConfigPath, configRoot, null, null, desiredConfigPath); }