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

                case "-fu":
                {
                  queue.Dequeue();
                  this.FileUnmatched = queue.DequeueArgument("-fu");
                  break;
                }

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

                if (this.FileMatched == null && this.FileUnmatched == null)
                {
                  throw new Exception("Missing required file term. Use either '-fm' or '-fu' or both.");
                }
            }
예제 #2
0
파일: Options.cs 프로젝트: toyners/Siftan
            internal LogOptions(Queue<String> queue)
            {
                Boolean parsingComplete = false;
                while (queue.Count > 0 && !parsingComplete)
                {
                  var field = queue.Peek();
                  switch (field)
                  {
                case "-a":
                {
                  queue.Dequeue();
                  this.ApplicationLogFilePath = queue.DequeueArgument("-a");
                  break;
                }

                case "-j":
                {
                  queue.Dequeue();
                  this.JobLogFilePath = queue.DequeueArgument("-j");
                  break;
                }

                default:
                {
                  parsingComplete = true;
                  break;
                }
                  }
                }
            }
예제 #3
0
파일: Options.cs 프로젝트: toyners/Siftan
            internal FixedWidthOptions(Queue<String> queue)
            {
                Boolean parsingComplete = false;
                Boolean gotLineStart = false;
                Boolean gotLineLength = false;
                Boolean gotTermStart = false;
                Boolean gotTermLength = false;
                while (queue.Count > 0 && !parsingComplete)
                {
                  var field = queue.Peek();
                  switch (field)
                  {
                case "-h":
                {
                  queue.Dequeue();
                  this.HeaderLineID = queue.DequeueArgument("-h");
                  break;
                }

                case "-ls":
                {
                  queue.Dequeue();
                  this.LineIDStart = queue.DequeueUInt32("-hs");
                  gotLineStart = true;
                  break;
                }

                case "-ll":
                {
                  queue.Dequeue();
                  this.LineIDLength = queue.DequeueUInt32("-hl");
                  gotLineLength = true;
                  break;
                }

                case "-t":
                {
                  queue.Dequeue();
                  this.TermLineID = queue.DequeueArgument("-t");
                  break;
                }

                case "-ts":
                {
                  queue.Dequeue();
                  this.TermStart = queue.DequeueUInt32("-ts");
                  gotTermStart = true;
                  break;
                }

                case "-tl":
                {
                  queue.Dequeue();
                  this.TermLength = queue.DequeueUInt32("-tl");
                  gotTermLength = true;
                  break;
                }

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

                if (this.HeaderLineID == null)
                {
                  throw new Exception("Missing required term 'Header ID' (-h).");
                }

                if (this.TermLineID == null)
                {
                  throw new Exception("Missing required term 'Term Line ID' (-t).");
                }

                if (!gotLineStart)
                {
                  throw new Exception("Missing required term 'Line ID Start' (-ls).");
                }

                if (!gotLineLength)
                {
                  throw new Exception("Missing required term 'Line ID Length' (-ll).");
                }

                if (!gotTermStart)
                {
                  throw new Exception("Missing required term 'Term Start' (-ts).");
                }

                if (!gotTermLength)
                {
                  throw new Exception("Missing required term 'Term Length' (-tl).");
                }
            }
예제 #4
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.");
                }
            }
예제 #5
0
파일: Options.cs 프로젝트: toyners/Siftan
            internal DelimitedOptions(Queue<String> queue)
            {
                Boolean parsingComplete = false;
                while (queue.Count > 0 && !parsingComplete)
                {
                  var field = queue.Peek();
                  switch (field)
                  {
                case "-d":
                {
                  queue.Dequeue();
                  this.Delimiter = queue.DequeueArgument("-d");
                  break;
                }

                case "-q":
                {
                  queue.Dequeue();
                  this.Qualifier = queue.DequeueChar("-q");
                  break;
                }

                case "-h":
                {
                  queue.Dequeue();
                  this.HeaderLineID = queue.DequeueArgument("-h");
                  break;
                }

                case "-ti":
                {
                  queue.Dequeue();
                  this.TermIndex = queue.DequeueUInt32("-ti");
                  break;
                }

                case "-li":
                {
                  queue.Dequeue();
                  this.LineIDIndex = queue.DequeueUInt32("-li");
                  break;
                }

                case "-t":
                {
                  queue.Dequeue();
                  this.TermLineID = queue.DequeueArgument("-t");
                  break;
                }

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

                if (this.Delimiter == null)
                {
                  this.Delimiter = ",";
                }

                if (this.HeaderLineID == null)
                {
                  throw new Exception("Missing required term 'Header ID' (-h).");
                }

                if (this.TermLineID == null)
                {
                  throw new Exception("Missing required term 'Term Line ID' (-t).");
                }
            }