예제 #1
0
파일: Options.cs 프로젝트: toyners/Siftan
            internal InListOptions(Queue<String> queue)
            {
                Boolean parsingComplete = false;
                while (queue.Count > 0 && !parsingComplete)
                {
                  var field = queue.Peek();
                  switch (field)
                  {
                case "-f":
                {
                  queue.Dequeue();
                  this.FilePath = queue.DequeueArgument("-f");
                  break;
                }

                case "-m":
                {
                  queue.Dequeue();
                  this.MatchQuota = queue.DequeueEnum<InListExpression.MatchQuotas>("-m");
                  break;
                }

                case "-v":
                {
                  queue.Dequeue();
                  this.Values = queue.DequeueArray(':', "-v");
                  break;
                }

                default:
                {
                  parsingComplete = true;
                  break;
                }
                  }
                }

                if (this.FilePath != null && this.Values != null)
                {
                  throw new Exception("Cannot have both 'File Path' (-f) and 'Value List' (-v) terms.");
                }

                if (this.FilePath == null && this.Values == null)
                {
                  throw new Exception("Missing one required term. Must have 'File Path' (-f) or 'Value List' (-v) but not both.");
                }
            }