Example #1
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())
                   );
        }
        public string GetMatches(string searchString, string file)
        {
            var strings = FileHelper.FileToArray(file);

            return(string.Join(",", strings.Where(s => _comparer.Compare(s, searchString))));
        }