public List <string> Parse(IEnumerable <string> arguments, string currentDirectory = null) { OptionContext c = CreateOptionContext(); c.OptionIndex = -1; bool process = true; if (currentDirectory == null) { currentDirectory = Environment.CurrentDirectory; } var allArguments = new List <string>(); foreach (var arg in arguments) { if (arg[0] == '@') { var path = arg.Substring(1); if (path[0] == '"' && path[path.Length - 1] == '"') { path = path.Substring(1, path.Length - 2); } if (!Path.IsPathRooted(path)) { path = Path.Combine(currentDirectory, path); } if (!File.Exists(path)) { throw new FileNotFoundException(path); } foreach (var responseFileArg in ParseResponseFileLines(OptionsHelper.LoadArgumentsFromFile(path))) { allArguments.Add(responseFileArg); } } else { allArguments.Add(arg); } } List <string> unprocessed = new List <string>(); Option def = Contains("<>") ? this["<>"] : null; foreach (string argument in allArguments) { ++c.OptionIndex; if (argument == "--") { process = false; continue; } if (!process) { Unprocessed(unprocessed, def, c, argument); continue; } if (!Parse(argument, c)) { Unprocessed(unprocessed, def, c, argument); } } if (c.Option != null) { c.Option.Invoke(c); } return(unprocessed); }