コード例 #1
0
ファイル: NflSeason.cs プロジェクト: Quarterback16/Tycoon.API
        private static void WriteGameNode(XmlWriter writer, NFLGame g)
        {
            var winner = g.WinningTeamCode();

            if (winner.Equals("HO"))
            {
                winner = "TT";
            }

            if ((g.HomeScore + g.AwayScore == 0) && (g.GameDate < DateTime.Now))
            {
                Utility.Announce(String.Format("0-0 tie {0} {1} @ {2}", g.GameKey(), g.AwayTeamName, g.HomeTeamName));
            }

            writer.WriteStartElement("game");
            writer.WriteAttributeString("winner", winner);
            writer.WriteAttributeString("type", g.GameType());
            decimal spread = g.Spread;

            if (spread == 0.0M)
            {
                writer.WriteAttributeString("off-the-board", "true");
            }
            else if (spread == 0.5M)
            {
                spread = 0.0M;
            }

            if (g.WentIntoOvertime())
            {
                writer.WriteAttributeString("overtime", "true");
            }

            WriteElement(writer, "date", g.GameDate.ToString("yyyy-MM-dd"));
            WriteElement(writer, "week-number", g.WeekNo.ToString());

            WriteTeams(writer, g);
            WriteElement(writer, "spread", spread.ToString());
            writer.WriteEndElement();
        }