コード例 #1
0
        public (bool IsSet, object Value) GetValue(Type type, string category, string name)
        {
            var variableName = $"{category}.{name}".ToUpperInvariant();

            return(!_args.ContainsKey(variableName.ToUpperInvariant())
                ? (false, ConfigSourceHelper.GetDefault(type))
                : (true, ConfigSourceHelper.ParseValue(type, _args[variableName])));
        }
コード例 #2
0
        public (bool IsSet, object Value) GetValue(Type type, string category, string name)
        {
            var variableName        = $"NETHERMIND_{category.ToUpperInvariant()}_{name.ToUpperInvariant()}";
            var variableValueString = Environment.GetEnvironmentVariable(variableName);

            return(string.IsNullOrWhiteSpace(variableValueString)
                ? (false, ConfigSourceHelper.GetDefault(type))
                : (true, ConfigSourceHelper.ParseValue(type, variableValueString)));
        }
コード例 #3
0
        public (bool IsSet, object Value) GetValue(Type type, string category, string name)
        {
            if (!_values.ContainsKey(category) || !_values[category].ContainsKey(name))
            {
                return(false, ConfigSourceHelper.GetDefault(type));
            }

            if (!_parsedValues[category].ContainsKey(name))
            {
                ParseValue(type, category, name);
            }

            return(true, _parsedValues[category][name]);
        }
コード例 #4
0
 public (bool IsSet, object Value) GetValue(Type type, string category, string name)
 {
     (bool isSet, string value) = GetRawValue(category, name);
     return(isSet, isSet ? ConfigSourceHelper.ParseValue(type, value) : ConfigSourceHelper.GetDefault(type));
 }