Example #1
0
 public PgnWriterTest()
 {
     _testGame = new Game
         {
             Event = "Breslau",
             Site = "Breslau",
             Year = 1879,
             WhitePlayer = "Tarrasch, Siegbert",
             BlackPlayer = "Mendelsohn, J.",
             Result = GameResult.White,
             MoveText =
                 new MoveTextEntryList {new CommentEntry("some moves"), new GameEndEntry(GameResult.White)},
         };
 }
Example #2
0
 private Match ToMatch(ilf.pgn.Data.Game game)
 {
     return(new Match
     {
         BlackPlayerName = game.BlackPlayer,
         Day = game.Day,
         Event = game.Event,
         Month = game.Month,
         Round = game.Round,
         Site = game.Site,
         WhitePlayerName = game.WhitePlayer,
         Year = game.Year,
         Tags = game.Tags,
         Game = ToGame(game)
     });
 }
Example #3
0
        private IGame ToGame(ilf.pgn.Data.Game pgnGame)
        {
            var game = _gameFactory.NewGame();

            foreach (var pgnMove in pgnGame.MoveText)
            {
                if (pgnMove.Type == ilf.pgn.Data.MoveTextEntryType.MovePair)
                {
                    var twoMoves = pgnMove as ilf.pgn.Data.MovePairEntry;

                    MakeMove(game, twoMoves.White);
                    MakeMove(game, twoMoves.Black);
                }
                else if (pgnMove.Type == ilf.pgn.Data.MoveTextEntryType.SingleMove)
                {
                    MakeMove(game, (pgnMove as ilf.pgn.Data.HalfMoveEntry).Move);
                }
            }

            return(game);
        }