Exemple #1
0
 // 次でエラーを出すようにする
 // "option"の指定の時に--option=abc
 // "option="の指定の時に--option-
 protected override bool Parse(string argument, Mono.Options.OptionContext c)
 {
     if (c.Option == null)
     {
         string f, n, s, v;
         if (!GetOptionParts(argument, out f, out n, out s, out v))
         {
             return(false);
         }
         if (Contains(n))
         {
             var p = this[n];
             if (v != null && p.OptionValueType == Mono.Options.OptionValueType.None)
             {
                 // メッセージはさぼり
                 throw new Mono.Options.OptionException(c.OptionSet.MessageLocalizer(""), f + n);
             }
         }
         else
         {
             string rn;
             if (n.Length >= 1 && (n[n.Length - 1] == '-' || n[n.Length - 1] == '+') && Contains((rn = n.Substring(0, n.Length - 1))))
             {
                 var p = this[rn];
                 if (p.OptionValueType == Mono.Options.OptionValueType.Required)
                 {
                     throw new Mono.Options.OptionException(c.OptionSet.MessageLocalizer("An argument is required for the option '" + f + rn + "'"), f + rn);
                 }
             }
         }
     }
     return(base.Parse(argument, c));
 }
 protected virtual bool Parse(string argument, Mono.Options.OptionContext c)
 {
     throw null;
 }
 protected abstract void OnParseComplete(Mono.Options.OptionContext c);
 protected static T Parse <T>(string value, Mono.Options.OptionContext c)
 {
     throw null;
 }
 public void Invoke(Mono.Options.OptionContext c)
 {
 }