コード例 #1
0
ファイル: OptionSet.cs プロジェクト: veyvin/UpuGuiWPF
        private bool ParseBundledValue(string f, string n, OptionContext c)
        {
            if (f != "-")
            {
                return(false);
            }
            for (int index = 0; index < n.Length; ++index)
            {
                string name = f + n[index].ToString();
                string key  = n[index].ToString();
                if (!this.Contains(key))
                {
                    if (index == 0)
                    {
                        return(false);
                    }
                    throw new OptionException(string.Format(this.localizer("Cannot use unregistered option '{0}' in bundle '{1}'."), (object)key, (object)(f + n)), (string)null);
                }
                Option option = this[key];
                switch (option.OptionValueType)
                {
                case OptionValueType.None:
                    OptionSet.Invoke(c, name, n, option);
                    continue;

                case OptionValueType.Optional:
                case OptionValueType.Required:
                    string str = n.Substring(index + 1);
                    c.Option     = option;
                    c.OptionName = name;
                    this.ParseValue(str.Length != 0 ? str : (string)null, c);
                    return(true);

                default:
                    throw new InvalidOperationException("Unknown OptionValueType: " + (object)option.OptionValueType);
                }
            }
            return(true);
        }