internal override void Apply(FlagSet set)
        {
            if (!string.IsNullOrEmpty(EnvironmentVariable))
            {
                foreach (var variable in EnvironmentVariable.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
                {
                    var envVar = variable.Trim();
                    var envVal = Environment.GetEnvironmentVariable(envVar);
                    if (string.IsNullOrEmpty(envVal))
                    {
                        continue;
                    }

                    Value = decimal.Parse(envVal);
                    break;
                }
            }

            if (Value == default(decimal) && DefaultValue != default(decimal))
            {
                Value = DefaultValue;
            }

            set.AddFlag(this);
        }
Exemplo n.º 2
0
        internal override void Apply(FlagSet set)
        {
            if (!string.IsNullOrEmpty(EnvironmentVariable))
            {
                foreach (var variable in EnvironmentVariable.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
                {
                    var envVar = variable.Trim();
                    var envVal = Environment.GetEnvironmentVariable(envVar);
                    if (string.IsNullOrEmpty(envVal))
                    {
                        continue;
                    }

                    bool envValBool;

                    if (bool.TryParse(envVal, out envValBool))
                    {
                        Value = envValBool;
                        break;
                    }
                }
            }

            if (!set.HasFlag(this))
            {
                set.AddFlag(this);
            }
        }