Пример #1
0
            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).");
                }
            }