예제 #1
0
        public static void DisplayPreview(LinescoreGame linescore, GameCenterGame gcg)
        {
            DisplayHeader(linescore);
            Console.WriteLine();
            foreach (string s in Boxify((gcg.Previews.Mlb.Headline ?? "".ToUpper()), WordWrap(gcg.Previews.Mlb.Blurb, 100), 1, 120, 100))
            {
                Console.WriteLine(s);
            }

            Console.WriteLine();
            foreach (string s in Boxify(linescore.Home_team_name, WordWrap(gcg.Probables.Home.Report, 100), 1, 120, 100))
            {
                Console.WriteLine(s);
            }

            Console.WriteLine();
            foreach (string s in Boxify(linescore.Away_team_name, WordWrap(gcg.Probables.Away.Report, 100), 1, 120, 100))
            {
                Console.WriteLine(s);
            }
        }
예제 #2
0
        public static void DisplayGameData(Object stateInfo, Game game, LinescoreGame line_score, Boxscore boxscore, GameEvents events, GameCenterGame gcg)
        {
            string outStr = "";

            if (line_score.Status == "Final" || line_score.Status == "Game Over")
            {
                Console.Clear();
                Display.DisplayFinal(game, boxscore, line_score, gcg);
            }
            else if (line_score.Status == "Pre-Game" || line_score.Status == "Preview")
            {
                DisplayLinescore(line_score);
                outStr = string.Format("Game Starts at {0}", line_score.Time + line_score.Time_zone);
                ConsoleLineFill(outStr, consoleWidth);
            }
            else
            {
                DisplayLinescore(line_score);
                outStr = line_score.Inning_state + " " + line_score.Inning;
                ConsoleLineFill(outStr, consoleWidth);
                DisplayStatus(line_score, events);
            }
            GC.Collect();
        }
예제 #3
0
        public static void DisplayFinal(Game game, Boxscore boxscore, LinescoreGame l, GameCenterGame gcg)
        {
            DisplayLinescore(l);
            string str = "";

            foreach (string s in Boxify(gcg.Recaps.Mlb.Headline, WordWrap(gcg.Recaps.Mlb.Blurb, 60), 1, 120, 120))
            {
                Console.WriteLine(s);
            }

            ConsoleLineFill("", consoleWidth);
            string[] info = { string.Format("{0} is now {1}-{2} and are {3} games back", l.Home_team_city, l.Home_win, l.Home_loss, l.Home_games_back),
                              string.Format("{0} is now {1}-{2} and are {3} games back", l.Away_team_city, l.Away_win, l.Away_loss, l.Away_games_back) };
            foreach (string s in Boxify("", info, 1, 120, 120))
            {
                Console.WriteLine(s);
            }
            ;
            ConsoleLineFill(str, consoleWidth);

            //Batting
            foreach (var bTeam in boxscore.Batting)
            {
                str = string.Format("┌{0}────────────────────────────────────────────────┐", bTeam.Team_flag.ToUpper() + " Batting");
                Console.WriteLine(str);
                str = string.Format("│                    AB  H  R  RBI  BB  SO  .AVG  .OBP  .SLG │");
                Console.WriteLine(str);
                foreach (var b in bTeam.Batter)
                {
                    str = string.Format("│ {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} │", b.Name_display_first_last.PadRight(18),
                                        b.Ab.PadLeft(2),
                                        b.H.PadLeft(2),
                                        b.R.PadLeft(2),
                                        b.Rbi.PadLeft(3),
                                        b.Bb.PadLeft(3),
                                        b.So.PadLeft(3),
                                        b.Avg.PadLeft(6),
                                        b.Obp.PadLeft(5),
                                        b.Slg.PadLeft(5));
                    ConsoleLineFill(str, consoleWidth);
                }
                str = string.Format("│ {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} │", "TOTALS".PadRight(18),
                                    bTeam.Ab.PadLeft(2),
                                    bTeam.H.PadLeft(2),
                                    bTeam.R.PadLeft(2),
                                    bTeam.Rbi.PadLeft(3),
                                    bTeam.Bb.PadLeft(3),
                                    bTeam.So.PadLeft(3),
                                    bTeam.Avg.PadLeft(6),
                                    bTeam.Obp.PadLeft(5),
                                    bTeam.Slg.PadLeft(5)
                                    );
                Console.WriteLine(str);
                str = "└────────────────────────────────────────────────────────────┘";
                Console.WriteLine(str);
            }

            //Pitching
            foreach (var pTeam in boxscore.Pitching)
            {
                str = string.Format("┌{0}───────────────────────────────────────────────┐", pTeam.Team_flag.ToUpper() + " Pitching");
                Console.WriteLine(str);
                str = "│                             IP  H  R  ER  BB  SO  HR   ERA │";
                Console.WriteLine(str);
                foreach (var p in pTeam.Pitcher)
                {
                    str = string.Format("│ {0} {1} {2} {3} {4} {5} {6} {7} {8} │",
                                        (p.Name_display_first_last + " " + p.Note).PadRight(26),
                                        GetInnings(p.Out).PadLeft(3),
                                        p.H.PadLeft(2),
                                        p.R.PadLeft(2),
                                        p.Er.PadLeft(3),
                                        p.Bb.PadLeft(3),
                                        p.So.PadLeft(3),
                                        p.Hr.PadLeft(3),
                                        p.Era.PadLeft(5)
                                        );
                    Console.WriteLine(str);
                }
                str = string.Format("│ {0} {1} {2} {3} {4} {5} {6} {7} {8} │",
                                    "TOTALS".PadRight(26),
                                    GetInnings(pTeam.Out).PadLeft(3),
                                    pTeam.H.PadLeft(2),
                                    pTeam.R.PadLeft(2),
                                    pTeam.Er.PadLeft(3),
                                    pTeam.Bb.PadLeft(3),
                                    pTeam.So.PadLeft(3),
                                    pTeam.Hr.PadLeft(3),
                                    pTeam.Era.PadLeft(5)
                                    );
                Console.WriteLine(str);
                str = "└────────────────────────────────────────────────────────────┘";
                Console.WriteLine(str);
            }


            Console.SetWindowPosition(0, 0);
        }