Exemplo n.º 1
0
        public void CopyGame()
        {
            String white = this.Game.Player1.PlayerTitle;
            String black = this.Game.Player2.PlayerTitle;

            TagPairs tp = new TagPairs();

            FileContent += tp.Event = "[Event \"" + this.Game.GameType.ToString() + "\"]" + Environment.NewLine;
            FileContent += tp.Site = "[Site \"?\"]" + Environment.NewLine;
            FileContent += tp.Date = "[Date \"" + DateTime.Now.ToString() + "\"]" + Environment.NewLine;
            FileContent += tp.Round = "[Round \"?\"]" + Environment.NewLine;
            FileContent += tp.White = "[White \"" + white + "\"]" + Environment.NewLine;
            FileContent += tp.Black = "[Black \"" + black + "\"]" + Environment.NewLine;

            if (!ChessLibrary.FenParser.IsInitialFen(this.Game.InitialBoardFen))
            {
                FileContent += tp.Fen = "[Fen \"" + this.Game.InitialBoardFen + "\"]" + Environment.NewLine;
            }

            FileContent += tp.Result = "[Result \"*\"]" + Environment.NewLine;

            String notations = GetNotationsFromDataTable();

            FileContent = FileContent + Environment.NewLine + notations;
            System.Windows.Forms.Clipboard.SetText(FileContent);
        }
Exemplo n.º 2
0
        public void Load(string gameContent)
        {
            string[] setsSeparators = { "\r\n\r\n" };
            string[] sets           = gameContent.Split(setsSeparators, StringSplitOptions.RemoveEmptyEntries);

            if (sets.Length > 0)
            {
                _pgnTagPairs = new TagPairs();
                _pgnTagPairs.Load(sets[0].Trim());

                _pgnMoveText = new MoveText();
                _pgnMoveText.Load(sets[1].Trim());
            }
        }