Example #1
0
        private static void AppendGame(PBNGame g, StringBuilder csv)
        {
            string line = GetHand(g.Identification.Deal.North)
                          + GetHand(g.Identification.Deal.East)
                          + GetHand(g.Identification.Deal.South)
                          + GetHand(g.Identification.Deal.West)
                          + '"'
                          + HTMLVulnerabilityMapper
                          .GetstringFromVulnerability(g.Identification.Vulnerable)
                          + '"' + separator + '"' + g.Identification.Board + '"'
                          + separator + '\n';

            csv.Append(line);
        }
Example #2
0
        private static void AppendGame(PBNGame g, StringBuilder csv)
        {
            Deal deal = g.Identification.Deal;

            if (deal == null)
            {
                deal = new Deal();
            }
            csv.Append(GetHand(deal.North));
            csv.Append(GetHand(deal.East));
            csv.Append(GetHand(deal.South));
            csv.Append(GetHand(deal.West));
            csv.Append("\"" + g.Identification.Board + "\"" + separator);
            csv.Append("\"" + PBNDirectionMapper.GetstringFromDirection(g.Identification.Dealer));
            csv.Append("/" + GetVulnerability(g.Identification.Vulnerable) + "\"");
            csv.Append(separator + "\n");
        }
        /*
         * public static Game GetGameFromStream(InputStream identification) {
         *  // TODO
         *  return null;
         * }
         */

        public static void AppendGame(StringBuilder pbn, PBNGame game)
        {
            if (game == null)
            {
                return;
            }
            // Each game should start with empty line:
            pbn.Append('\n');
            PBNIdentificationMapper.AppendIdentification(pbn, game.Identification);
            if (game.Auction == null)
            {
                game.Auction = new PBNAuction
                {
                    Auction = new Auction(
                        game.Identification.Dealer)
                };
            }
            PBNAuctionMapper.AppendAuction(pbn, game.Auction);
            // TODO: PlayMapper
            PBNSupplementalMapper.AppendSupplemental(pbn, game.Supplemental);
        }