private string[] NormalizeArgs(string[] args)
{
bool ParsingOptions = true;
ArrayList result = new ArrayList();
foreach(string arg in ExpandResponseFiles(args))
{
if (arg.Length > 0)
{
if (ParsingOptions)
{
if (endOptionProcessingWithDoubleDash && (arg == "--"))
{
ParsingOptions = false;
continue;
}
if ((parsingMode & OptionsParsingMode.Linux) > 0 &&
arg[0] == '-' && arg.Length > 1 && arg[1] != '-' &&
breakSingleDashManyLettersIntoManyOptions)
{
foreach(char c in arg.Substring(1)) // many single-letter options
result.Add("-" + c); // expand into individualized options
continue;
}
if (MaybeAnOption(arg))
{
int pos = IndexOfAny(arg, ':', '=');
if (pos < 0)
result.Add(arg);
else
{
result.Add(arg.Substring(0, pos));
result.Add(arg.Substring(pos + 1));
}
continue;
}
}
else
{
argumentsTail.Add(arg);
continue;
}
// if nothing else matches then it get here
result.Add(arg);
}
}
return (string[]) result.ToArray(typeof(string));
}