private static PgnGameFinderService.FindOptions CreateOptions(PgnQueryCommandLineParser parser) { var opts = new PgnGameFinderService.FindOptions( parser.FileSources, parser.Event, parser.Site, parser.Date, parser.Round, parser.White, parser.Black, parser.Result, parser.CountMode, parser.Debug); return(opts); }
public bool MatchGame(PgnGame game, PgnGameFinderService.FindOptions options) { var stringComparisons = new List <Func <bool> >() { () => _stringComparer.Compare(game.Event.ToLower(), options.Event.ToLower()), () => _stringComparer.Compare(game.Site.ToLower(), options.Site.ToLower()), () => _stringComparer.Compare(game.Date.ToString().ToLower(), options.Date.ToLower()), () => _stringComparer.Compare(game.White.ToLower(), options.White.ToLower()), () => _stringComparer.Compare(game.Round.ToLower(), options.Round.ToLower()), () => _stringComparer.Compare(game.Black.ToLower(), options.Black.ToLower()), }; return(stringComparisons.All(c => c()) && _pgnGameResultComparer.Compare(game.Result, options.Result.ToLower()) ); }
public static IEnumerable <PgnGame> FindGames(this IEnumerable <PgnGame> games, PgnGameFinderService.FindOptions options) { return(games.Where(g => new PgnGameMatcher().MatchGame(g, options))); }