LinkAlternatesInsideList() public static method

public static LinkAlternatesInsideList ( ArrayList list ) : void
list System.Collections.ArrayList
return void
Esempio n. 1
0
        public string[] ProcessArgs(string[] args)
        {
            string arg;
            string nextArg;
            bool   OptionWasProcessed;

            list.Sort();

            OptionDetails.LinkAlternatesInsideList(list);

            args = NormalizeArgs(args);

            try {
                int argc = args.Length;
                for (int i = 0; i < argc; i++)
                {
                    arg = args[i];
                    if (i + 1 < argc)
                    {
                        nextArg = args[i + 1];
                    }
                    else
                    {
                        nextArg = null;
                    }

                    OptionWasProcessed = false;

                    if (arg.Length > 1 && (arg.StartsWith("-") || arg.StartsWith("/")))
                    {
                        foreach (OptionDetails option in list)
                        {
                            OptionProcessingResult result = option.ProcessArgument(arg, nextArg);
                            if (result != OptionProcessingResult.NotThisOption)
                            {
                                OptionWasProcessed = true;
                                if (result == OptionProcessingResult.OptionConsumedParameter)
                                {
                                    i++;
                                }
                                break;
                            }
                        }
                    }

                    if (!OptionWasProcessed)
                    {
                        ProcessNonOption(arg);
                    }
                }

                foreach (OptionDetails option in list)
                {
                    option.TransferValues();
                }

                foreach (string argument in argumentsTail)
                {
                    ProcessNonOption(argument);
                }

                return((string[])arguments.ToArray(typeof(string)));
            } catch (Exception ex) {
                System.Console.WriteLine(ex.ToString());
                //System.Environment.Exit(1);
                throw;
            }
        }