コード例 #1
0
        // FIXME: this parser should really never have been made
        // -> this should have been outsourced to library code
        static Options ParseArgs(string[] args)
        {
            var lastArg = null as string;
            var result  = new Options();

            foreach (var s in args)
            {
                if (s == "--help" || s == "-h")
                {
                    ShowHelp();
                    return(result);
                }

                if (s == "-w")
                {
                    result.Watch = true;
                    continue;
                }

                if (s == "-v")
                {
                    result.Verbose = true;
                    continue;
                }

                if (s == "-d")
                {
                    result.Dummy = true;
                    continue;
                }

                if (s == "-n" || s == "-p" || s == "-l" || s == "-f")
                {
                    lastArg = s;
                    continue;
                }

                if (lastArg == "-f")
                {
                    result.ProcessMatchers.Add(s);
                    continue;
                }

                if (lastArg == "-l")
                {
                    result.LogFile = s;
                    continue;
                }


                if (lastArg == "-n")
                {
                    result.Niceness = SymMap.TryGetValue(s, out var sym)
                        ? sym
                        : TryParseInt(lastArg, s);
                    result.NicenessSet = true;
                    continue;
                }

                result.ProcessIds.Add(TryParseInt(lastArg, s));
            }

            return(result);
        }
コード例 #2
0
 public LipSyncData()
 {
     this.symMap = SymMap.FillMap();
 }