Esempio n. 1
0
        private static Nhl_Games_Rtss_RosterParticipantItem ParseOfficial(HtmlNode row)
        {
            HtmlNode columnNode = row.SelectSingleNode(@"./td");
            string nameText = columnNode.InnerText.Trim();

            Nhl_Games_Rtss_RosterParticipantItem official = new Nhl_Games_Rtss_RosterParticipantItem();
            official.ParticipantType = ParticipantType.Official;

            int officialsNumber = 0;
            string officialsName = String.Empty;
            NhlBaseClass.ParseNameText(nameText, out officialsNumber, out officialsName);

            official.Number = officialsNumber;
            official.Name = officialsName;

            return official;
        }
Esempio n. 2
0
        private static Nhl_Games_Rtss_RosterParticipantItem ParsePlayer(HtmlNode row)
        {
            Nhl_Games_Rtss_RosterParticipantItem player = new Nhl_Games_Rtss_RosterParticipantItem();

            // Assume it is a Player
            player.ParticipantType = ParticipantType.Player;

            HtmlNodeCollection columnNodes = row.SelectNodes(@"./td");

            string numberText = columnNodes[0].InnerText;
            if (!String.IsNullOrWhiteSpace(numberText))
            {
                player.Number = Convert.ToInt32(numberText);
            }
            player.Position = columnNodes[1].InnerText;

            // Parse out the name, captaincy, starting lineup
            string nameText = columnNodes[2].InnerText;
            if (columnNodes[2].Attributes["class"].Value.IndexOf("bold", StringComparison.InvariantCultureIgnoreCase) >= 0)
            {
                player.StartingLineup = true;
            }

            if (nameText.IndexOf("(C)", StringComparison.InvariantCultureIgnoreCase) >= 0)
            {
                player.Designation = Designation.Captain;
                player.Name = nameText.Replace("(C)", String.Empty).Trim();
            }
            else if (nameText.IndexOf("(A)", StringComparison.InvariantCultureIgnoreCase) >= 0)
            {
                player.Designation = Designation.AssistantCaptain;
                player.Name = nameText.Replace("(A)", String.Empty).Trim();
            }
            else
            {
                player.Name = nameText.Trim();
            }

            return player;
        }
Esempio n. 3
0
        private static Nhl_Games_Rtss_RosterParticipantItem ParseCoach(HtmlNode row)
        {
            HtmlNode columnNode = row.SelectSingleNode(@"./td");

            Nhl_Games_Rtss_RosterParticipantItem coach = new Nhl_Games_Rtss_RosterParticipantItem();
            coach.ParticipantType = ParticipantType.Coach;
            coach.Designation = Designation.HeadCoach;
            coach.Name = columnNode.InnerText.Trim();
            return coach;
        }