public override void Parse(ArgsIterator iter)
        {
            if (!iter.HasNext())
            {
                throw new CommandLineException("Filename expected");
            }

            m_fileName = iter.Next();
        }
Example #2
0
        public void Parse(String[] args)
        {
            ArgsIterator iter = new ArgsIterator(args);

            while (iter.HasNext())
            {
                String arg = iter.Next();
                if (arg.StartsWith("--"))
                {
                    String longParam = arg.Substring(2);
                    if (longParam.Length == 0)
                    {
                        throw new CommandLineException("Long param expected");
                    }

                    CommandLineEntry entry = FindEntry(longParam, false);
                    if (entry == null)
                    {
                        throw new CommandLineException("Unknown param: " + arg);
                    }

                    entry.Parse(iter);
                }
                else if (arg.StartsWith("-"))
                {
                    String shortParam = arg.Substring(1);
                    if (shortParam.Length == 0)
                    {
                        throw new CommandLineException("Short param expected");
                    }

                    CommandLineEntry entry = FindEntry(shortParam, true);
                    if (entry == null)
                    {
                        throw new CommandLineException("Unknown param: " + arg);
                    }

                    entry.Parse(iter);
                }
                else
                {
                    if (m_defaultEntry == null)
                    {
                        throw new CommandLineException("Default entry is not set");
                    }

                    m_defaultEntry.Parse(iter);
                }
            }
        }
        public void Parse(String[] args)
        {
            ArgsIterator iter = new ArgsIterator(args);
            while (iter.HasNext())
            {
                String arg = iter.Next();
                if (arg.StartsWith("--"))
                {
                    String longParam = arg.Substring(2);
                    if (longParam.Length == 0)
                    {
                        throw new CommandLineException("Long param expected");
                    }

                    CommandLineEntry entry = FindEntry(longParam, false);
                    if (entry == null)
                    {
                        throw new CommandLineException("Unknown param: " + arg);
                    }

                    entry.Parse(iter);
                }
                else if (arg.StartsWith("-"))
                {
                    String shortParam = arg.Substring(1);
                    if (shortParam.Length == 0)
                    {
                        throw new CommandLineException("Short param expected");
                    }

                    CommandLineEntry entry = FindEntry(shortParam, true);
                    if (entry == null)
                    {
                        throw new CommandLineException("Unknown param: " + arg);
                    }

                    entry.Parse(iter);
                }
                else
                {
                    if (m_defaultEntry == null)
                    {
                        throw new CommandLineException("Default entry is not set");
                    }

                    m_defaultEntry.Parse(iter);
                }
            }
        }
 public abstract void Parse(ArgsIterator iter);
Example #5
0
 public abstract void Parse(ArgsIterator iter);