Ejemplo n.º 1
0
        private static void WritePlayerRow(PlayerRow row)
        {
            if (PlayerStream == null)
            {
                PlayerStream = new StreamWriter(Path.Combine(OUTPUT_PATH, "Players.tsv"));
            }

            PlayerStream.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}\t{16}",
                                   row.playerName, row.gid, row.teamCode,
                                   row.min, row.fgm, row.fga,
                                   row.tpm, row.tpa, row.ftm, row.fta,
                                   row.oreb, row.dreb, row.ast, row.to, row.stl, row.blk, row.pf);
        }
Ejemplo n.º 2
0
        private static void ParseScoreTable(HtmlNode awayTable, string gid, string team)
        {
            HtmlNodeCollection rows = awayTable.SelectNodes("tr");

            // skip the first two rows which are the team name and the headers
            // also skip the last three rows which are spacers plus team info
            if (rows.Count > 5)
            {
                for (int i = 2; i < rows.Count - 3; i++)
                {
                    HtmlNode           row   = rows[i];
                    HtmlNodeCollection cells = row.SelectNodes("td");
                    // we should have 13 cells
                    if (cells.Count == 13)
                    {
                        PlayerRow player = new PlayerRow();
                        // get the name
                        HtmlNode nameNode = cells[0].SelectSingleNode("a");
                        string   name     = (nameNode == null ? cells[0].InnerText : nameNode.InnerText);
                        // now set the stats
                        player.playerName = name;
                        player.gid        = gid;
                        player.teamCode   = team;
                        player.min        = ParseSingleCell(cells[1]);
                        ParseFraction(cells[2].InnerText, out player.fga, out player.fgm);
                        ParseFraction(cells[3].InnerText, out player.tpa, out player.tpm);
                        ParseFraction(cells[4].InnerText, out player.fta, out player.ftm);
                        player.oreb = ParseSingleCell(cells[5]);
                        player.dreb = ParseSingleCell(cells[6]);
                        player.ast  = ParseSingleCell(cells[7]);
                        player.to   = ParseSingleCell(cells[8]);
                        player.stl  = ParseSingleCell(cells[9]);
                        player.blk  = ParseSingleCell(cells[10]);
                        player.pf   = ParseSingleCell(cells[11]);
                        // skip cells[12] which is the total points

                        WritePlayerRow(player);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private static void WritePlayerRow(PlayerRow row)
        {
            if (PlayerStream == null)
            {
                PlayerStream = new StreamWriter(Path.Combine(OUTPUT_PATH, "Players.tsv"));
            }

            PlayerStream.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}\t{16}",
                row.playerName, row.gid, row.teamCode,
                row.min, row.fgm, row.fga,
                row.tpm, row.tpa, row.ftm, row.fta,
                row.oreb, row.dreb, row.ast, row.to, row.stl, row.blk, row.pf);
        }
Ejemplo n.º 4
0
        private static void ParseScoreTable(HtmlNode awayTable, string gid, string team)
        {
            HtmlNodeCollection rows = awayTable.SelectNodes("tr");
            // skip the first two rows which are the team name and the headers
            // also skip the last three rows which are spacers plus team info
            if (rows.Count > 5)
            {
                for (int i = 2; i < rows.Count - 3; i++)
                {
                    HtmlNode row = rows[i];
                    HtmlNodeCollection cells = row.SelectNodes("td");
                    // we should have 13 cells
                    if (cells.Count == 13)
                    {
                        PlayerRow player = new PlayerRow();
                        // get the name
                        HtmlNode nameNode = cells[0].SelectSingleNode("a");
                        string name = (nameNode == null ? cells[0].InnerText : nameNode.InnerText);
                        // now set the stats
                        player.playerName = name;
                        player.gid = gid;
                        player.teamCode = team;
                        player.min = ParseSingleCell(cells[1]);
                        ParseFraction(cells[2].InnerText, out player.fga, out player.fgm);
                        ParseFraction(cells[3].InnerText, out player.tpa, out player.tpm);
                        ParseFraction(cells[4].InnerText, out player.fta, out player.ftm);
                        player.oreb = ParseSingleCell(cells[5]);
                        player.dreb = ParseSingleCell(cells[6]);
                        player.ast = ParseSingleCell(cells[7]);
                        player.to = ParseSingleCell(cells[8]);
                        player.stl = ParseSingleCell(cells[9]);
                        player.blk = ParseSingleCell(cells[10]);
                        player.pf = ParseSingleCell(cells[11]);
                        // skip cells[12] which is the total points

                        WritePlayerRow(player);
                    }
                }
            }
        }