예제 #1
0
        public static DataRow NewRow()
        {
            DataTable table = Moves.GetMovesTable();

            DataRow row = table.NewRow();

            table.Rows.Add(row);

            table.AcceptChanges();

            return(row);
        }
예제 #2
0
        private Moves GetMoves(Kv kvMoves)
        {
            Moves moves = new Moves(Moves.GetMovesTable());
            Move  m;

            foreach (DataRow dr in kvMoves.DataTable.Rows)
            {
                m       = Move.NewMove();
                m.Game  = this.Game;
                m.Id    = Convert.ToInt32(dr["Id"].ToString());
                m.Pid   = Convert.ToInt32(dr["Pid"].ToString());
                m.White = Convert.ToInt32(dr["W"].ToString());
                if (Convert.ToBoolean(m.White))
                {
                    m.IsWhite = true;
                    m.IsBlack = false;
                }
                else
                {
                    m.IsWhite = false;
                    m.IsBlack = true;
                }
                m.MoveNo         = Convert.ToInt32(dr["No"].ToString());
                m.PieceStr       = dr["P"].ToString();
                m.From           = dr["F"].ToString();
                m.To             = dr["T"].ToString();
                m.MoveFlags      = dr["Mf"].ToString();
                m.MoveTime       = Convert.ToInt64(dr["Mt"].ToString());
                m.MoveTimeWhite  = Convert.ToInt64(dr["Mw"].ToString());
                m.MoveTimeBlack  = Convert.ToInt64(dr["Mb"].ToString());
                m.CapturedPceStr = dr["Cp"].ToString();
                m.Fen            = dr["Fen"].ToString();
                moves.DataTable.ImportRow(m.DataRow);
            }
            return(moves);
        }