/// <summary> /// Public constructor. /// </summary> public DfpAppConfig() : base() { networkCode = ""; applicationName = DEFAULT_APPLICATION_NAME; dfpApiServer = DEFAULT_DFPAPI_SERVER; authorizationMethod = DEFAULT_AUTHORIZATION_METHOD; ReadSettings((Hashtable)ConfigurationManager.GetSection("DfpApi")); }
/// <summary> /// Read all settings from App.config. /// </summary> /// <param name="settings">The parsed App.config settings.</param> protected override void ReadSettings(Hashtable settings) { base.ReadSettings(settings); networkCode = ReadSetting(settings, NETWORK_CODE, networkCode); applicationName = ReadSetting(settings, APPLICATION_NAME, applicationName); dfpApiServer = ReadSetting(settings, DFPAPI_SERVER, dfpApiServer); try { authorizationMethod = (DfpAuthorizationMethod)Enum.Parse( typeof(DfpAuthorizationMethod), ReadSetting(settings, AUTHORIZATION_METHOD, authorizationMethod.ToString())); } catch { authorizationMethod = DEFAULT_AUTHORIZATION_METHOD; } // If there is an OAuth2 scope mentioned in App.config, this will be // loaded by the above call. If there isn't one, we will initialize it // with a library-specific default value. if (string.IsNullOrEmpty(this.OAuth2Scope)) { this.OAuth2Scope = GetDefaultOAuth2Scope(); } }
/// <summary> /// Read all settings from App.config. /// </summary> /// <param name="settings">The parsed App.config settings.</param> protected override void ReadSettings(Hashtable settings) { base.ReadSettings(settings); networkCode = ReadSetting(settings, NETWORK_CODE, networkCode); applicationName = ReadSetting(settings, APPLICATION_NAME, applicationName); dfpApiServer = ReadSetting(settings, DFPAPI_SERVER, dfpApiServer); try { authorizationMethod = (DfpAuthorizationMethod) Enum.Parse( typeof(DfpAuthorizationMethod), ReadSetting(settings, AUTHORIZATION_METHOD, authorizationMethod.ToString())); } catch { authorizationMethod = DEFAULT_AUTHORIZATION_METHOD; } // If there is an OAuth2 scope mentioned in App.config, this will be // loaded by the above call. If there isn't one, we will initialize it // with a library-specific default value. if (string.IsNullOrEmpty(this.OAuth2Scope)) { this.OAuth2Scope = GetDefaultOAuth2Scope(); } }
/// <summary> /// Public constructor. /// </summary> public DfpAppConfig() : base() { networkCode = ""; applicationName = DEFAULT_APPLICATION_NAME; dfpApiServer = DEFAULT_DFPAPI_SERVER; authorizationMethod = DEFAULT_AUTHORIZATION_METHOD; ReadSettings((Hashtable) ConfigurationManager.GetSection("DfpApi")); }