/// <summary> /// Parse the command arguments for the bounding-box command. /// </summary> /// <param name="args"></param> /// <param name="idx"></param> /// <param name="switchOut"></param> /// <returns></returns> public override int Parse(string[] args, int idx, out Switch switchOut) { // check next argument. if (args.Length < idx + 1) { throw new SwitchParserException("None", "Invalid --filter-routes command!"); } int startIdx = idx; while (idx < args.Length && !SwitchParser.IsSwitch(args[idx])) { // parse arguments. var argSplit = args[idx].Split('='); if (argSplit.Length != 2 || argSplit[0] == null || argSplit[1] == null) { throw new SwitchParserException(args[idx], "Invalid argument for --filter-routes."); } switch (argSplit[0]) { case "ids": this.RouteIds = argSplit[1].Split(','); break; case "exclude": this.Exclude = argSplit[1].ToLowerInvariant() == "yes"; break; default: throw new SwitchParserException(args[idx], "Unknown argument for --filter-routes."); } idx++; } // everything ok, take the next argument as the filename. switchOut = new SwitchFilterRoutes() { RouteIds = this.RouteIds, Exclude = this.Exclude }; return(idx - startIdx); }