Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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())
                   );
        }
Ejemplo n.º 3
0
 public static IEnumerable <PgnGame> FindGames(this IEnumerable <PgnGame> games, PgnGameFinderService.FindOptions options)
 {
     return(games.Where(g => new PgnGameMatcher().MatchGame(g, options)));
 }