public override bool TryGetBoxedSetting(ISettingsContext context, string settingName, Type settingType, out object settingValue)
        {
            ConfigurationSection configurationSection = this.Section;

            if (configurationSection != null)
            {
                ExchangeConfigurationSection exchangeConfigurationSection = configurationSection as ExchangeConfigurationSection;
                if (exchangeConfigurationSection != null)
                {
                    object propertyValue = exchangeConfigurationSection.GetPropertyValue(settingName);
                    if (propertyValue != exchangeConfigurationSection.GetConfigurationProperty(settingName, null).DefaultValue)
                    {
                        settingValue = propertyValue;
                        return(true);
                    }
                }
                else
                {
                    AppSettingsSection           appSettingsSection           = configurationSection as AppSettingsSection;
                    KeyValueConfigurationElement keyValueConfigurationElement = appSettingsSection.Settings[settingName];
                    if (keyValueConfigurationElement != null)
                    {
                        settingValue = base.ParseAndValidateConfigValue(settingName, keyValueConfigurationElement.Value, settingType);
                        return(true);
                    }
                }
            }
            settingValue = null;
            return(false);
        }
 public object RetrieveValue(ISettingsContext ctx)
 {
     if (ctx == null)
     {
         return(null);
     }
     return(this.retrieveValueDelegate(ctx));
 }
        private T GetConfigInternal <T>(ISettingsContext context, string settingName, Func <IConfigSchema, string, T> defaultValueGetter)
        {
            T result;

            if (this.TryGetConfig <T>(context, settingName, out result))
            {
                return(result);
            }
            return(defaultValueGetter(this.schema, settingName));
        }
Example #4
0
        internal bool Matches(IConfigSchema schema, ISettingsContext context)
        {
            if (!this.Enabled || (this.ExpirationDate != DateTime.MinValue && DateTime.UtcNow > this.ExpirationDate))
            {
                return(false);
            }
            Exception   ex;
            QueryFilter filter = this.TryParseFilter(schema, null, out ex);

            return(OpathFilterEvaluator.FilterMatches(filter, null, (PropertyDefinition pdef) => ((SettingsScopeFilterSchema.ScopeFilterPropertyDefinition)pdef).RetrieveValue(context)));
        }
Example #5
0
        public override bool TryGetBoxedSetting(ISettingsContext context, string settingName, Type settingType, out object settingValue)
        {
            InternalExchangeSettings adsettings = this.ADSettings;
            string serializedValue;

            if (adsettings != null && adsettings.TryGetConfig(base.Schema, context, settingName, out serializedValue))
            {
                settingValue = base.ParseAndValidateConfigValue(settingName, serializedValue, settingType);
                return(true);
            }
            settingValue = null;
            return(false);
        }
        public bool TryGetConfig <T>(ISettingsContext context, string settingName, out T settingValue)
        {
            base.CheckDisposed();
            object rawValue;

            if (this.TryGetBoxedSettingFromDrivers(context, settingName, typeof(T), out rawValue))
            {
                settingValue = ConfigSchemaBase.ConvertValue <T>(this.schema, settingName, rawValue);
                return(true);
            }
            settingValue = default(T);
            return(false);
        }
 private bool TryGetBoxedSettingFromDrivers(ISettingsContext context, string settingName, Type settingType, out object boxedValue)
 {
     this.Initialize();
     foreach (IConfigDriver configDriver in this.configDrivers)
     {
         if (configDriver.TryGetBoxedSetting(context, settingName, settingType, out boxedValue))
         {
             return(true);
         }
     }
     boxedValue = null;
     return(false);
 }
            private static T ComputeInheritedValue <T>(Func <SettingsContextBase, T> valueGetter)
            {
                for (SettingsContextBase.NestedContext nestedContext = SettingsContextBase.NestedContext.Current; nestedContext != null; nestedContext = nestedContext.ParentContext)
                {
                    T t = SettingsContextBase.EffectiveContextObject.ComputeChainedValue <T>(nestedContext.Context, valueGetter);
                    if (t != null && !t.Equals(default(T)))
                    {
                        return(t);
                    }
                }
                ISettingsContext settingsContext = (SettingsContextBase.DefaultContextGetter != null) ? SettingsContextBase.DefaultContextGetter() : null;

                return(SettingsContextBase.EffectiveContextObject.ComputeChainedValue <T>(settingsContext as SettingsContextBase, valueGetter));
            }
Example #9
0
        internal bool TryGetConfig(IConfigSchema configSchema, ISettingsContext context, string settingName, out string settingValue)
        {
            settingValue = null;
            int num = -1;

            foreach (SettingsGroup settingsGroup in this.Settings.Values)
            {
                string text;
                if (settingsGroup.Priority > num && settingsGroup.TryGetValue(settingName, out text) && settingsGroup.Matches(configSchema, context))
                {
                    settingValue = text;
                    num          = settingsGroup.Priority;
                }
            }
            return(num != -1);
        }
Example #10
0
            // Token: 0x06000097 RID: 151 RVA: 0x000033A8 File Offset: 0x000015A8
            public override bool TryGetBoxedSetting(ISettingsContext context, string settingName, Type settingType, out object settingValue)
            {
                settingValue = null;
                AppSettingsSection appSettingsSection = base.Section as AppSettingsSection;

                if (appSettingsSection == null)
                {
                    return(false);
                }
                string key = string.Format("{0}_{1}", this.applicationName, settingName);
                KeyValueConfigurationElement keyValueConfigurationElement = appSettingsSection.Settings[key];

                if (keyValueConfigurationElement != null)
                {
                    settingValue = base.ParseAndValidateConfigValue(settingName, keyValueConfigurationElement.Value, settingType);
                    return(true);
                }
                return(false);
            }
 public T GetConfig <T>(ISettingsContext context, string settingName, T defaultValue)
 {
     return(this.GetConfigInternal <T>(context, settingName, (IConfigSchema schema, string sName) => defaultValue));
 }
 public T GetConfig <T>(ISettingsContext context, string settingName)
 {
     base.CheckDisposed();
     return(this.GetConfigInternal <T>(context, settingName, new Func <IConfigSchema, string, T>(ConfigSchemaBase.GetDefaultConfig <T>)));
 }
Example #13
0
 public SettingsRepo(ISettingsContext context)
 {
     this.context = context;
 }
 public SettingsJsonRepository(ISettingsContext ctx, ICacheService mem)
 {
     Db     = ctx;
     _cache = mem;
 }
 public SettingsService(ISettingsContext settingsContext)
 {
     this.settingsContext = settingsContext;
 }
Example #16
0
 // Token: 0x06000090 RID: 144 RVA: 0x000032C7 File Offset: 0x000014C7
 public T GetConfig <T>(ISettingsContext context, string settingName)
 {
     return(this.Provider.GetConfig <T>(context, settingName));
 }
Example #17
0
 public abstract bool TryGetBoxedSetting(ISettingsContext context, string settingName, Type settingType, out object settingValue);
Example #18
0
 public ApplicationConfigRepository(ISettingsContext ctx)
 {
     Ctx = ctx;
 }
Example #19
0
 protected AbstractSettings(ISettingsContext context, ISettingsProvider provider)
 {
     Context = context;
     Provider = provider;
 }