예제 #1
0
        public bool Parse(string[] args)
        {
            CommandLineOptionEngine.CommandLineParseState ps = new CommandLineOptionEngine.CommandLineParseState();
            Func <string, int, char, string> replaceAt       = (s, i, c) => s.Substring(0, i) + c + s.Substring(i + 1);

            ps.args = new List <string>(args)
                      .ConvertAll(s => s.StartsWith("/") && s.Contains(":") ? replaceAt(s, s.IndexOf(':'), '*') : s)
                      .SelectMany(s => s.Split(new char[] { '*' })).ToList();
            ps.i = 0;
            for (ps.i = 0; ps.i < ps.args.Count; ps.i++)
            {
                string name = ps.args[ps.i];
                if (name.StartsWith("-") || name.StartsWith("/"))
                {
                    if (!Clo.ParseOption(name.Substring(1), ps))
                    {
                        throw new Exception("unknown command-line switch: " + name);
                    }
                }
                else
                {
                    Files.Add(new FileInfo(ps.args[ps.i]).FullName);
                }
            }
            return(true);
        }
예제 #2
0
 public bool Parse(string[] args)
 {
     CommandLineOptionEngine.CommandLineParseState ps = new CommandLineOptionEngine.CommandLineParseState();
     Func<string,int,char,string> replaceAt = (s, i, c) => s.Substring(0, i) + c + s.Substring(i + 1);
     ps.args = new List<string>(args)
         .ConvertAll(s => s.StartsWith("/") && s.Contains(":") ? replaceAt(s, s.IndexOf(':'), '*') : s)
         .SelectMany(s => s.Split(new char[] {'*'})).ToList();
     ps.i = 0;
     for (ps.i = 0; ps.i < ps.args.Count; ps.i++)
     {
         string name = ps.args[ps.i];
         if (name.StartsWith("-") || name.StartsWith("/"))
         {
             if (!Clo.ParseOption(name.Substring(1), ps))
             {
                 throw new Exception("unknown command-line switch: " + name);
             }
         }
         else
         {
             Files.Add(new FileInfo(ps.args[ps.i]).FullName);
         }
     }
     return true;
 }
예제 #3
0
    protected override bool ParseOption(string name, Bpl.CommandLineOptionEngine.CommandLineParseState ps)
    {
        switch (name)
        {
        case "outdir":
            if (ps.ConfirmArgumentCount(1))
            {
                outDir = ps.args[ps.i];
            }
            return(true);

        case "minVerify":
            minVerify = true;
            return(true);

        default:
            break;
        }
        return(base.ParseOption(name, ps));
    }
예제 #4
0
 protected virtual bool ParseOption(string name, CommandLineOptionEngine.CommandLineParseState ps)
 {
     return(false);
 }