예제 #1
0
        public override void Start()
        {
            CPlayerUpdate playerUpdateTest = new CPlayerUpdate(DATA_SOURCE);

            playerUpdateTest.Name    = "Maor Melikson";
            playerUpdateTest.Height  = 1.75;
            playerUpdateTest.Country = "Israel";
            playerUpdateTest.DOB     = new DateTime(1984, 10, 30);

            playerUpdateTest.Position          = (int)ESoccerPlayerPositions.Midfield;
            playerUpdateTest.FormationPosition = (int)ESoccerPlayerFormationPositions.AM;

            var playerStat = new CPlayerIndividualStat();

            playerStat.StatisticType = (int)ESoccerPlayerStatistics.Goals;
            playerStat.Value         = "1";
            List <CPlayerIndividualStat> playerStats = new List <CPlayerIndividualStat>()
            {
                playerStat
            };

            playerUpdateTest.Statistics.Add(new CAthleteStatisticsUpdate()
            {
                Stats = playerStats
            });

            playerUpdateTest.Competitions = new List <string> {
                "Israeli Premier League", "Israeli FA Cup"
            };
            playerUpdateTest.Competitors = new List <string> {
                "Hapoel Beer Sheva", "Israel"
            };
            playerUpdateTest.JerseyNum    = 24;
            playerUpdateTest.Nationalitys = new List <string> {
                "Poland", "Israel"
            };
            playerUpdateTest.Weight = 70;

            RaiseEvent(new List <CPlayerUpdate>()
            {
                playerUpdateTest
            });
        }
예제 #2
0
        public static CPlayerIndividualStat ParseSingleStat(string itemName, string escapedTest)
        {
            CPlayerIndividualStat stat = null;

            if (itemName.ToLower().Contains("lineups"))
            {
                stat = new CPlayerIndividualStat()
                {
                    StatisticType = (int)ESoccerPlayerStatistics.Lineups, Value = escapedTest
                };
            }
            else if (itemName.ToLower().Contains("game-minutes"))
            {
                stat = new CPlayerIndividualStat()
                {
                    StatisticType = (int)ESoccerPlayerStatistics.TimePlayed, Value = escapedTest
                };
            }
            else if (itemName.ToLower().Contains("appearances"))
            {
                stat = new CPlayerIndividualStat()
                {
                    StatisticType = (int)ESoccerPlayerStatistics.Appearences, Value = escapedTest
                };
            }
            else if (itemName.ToLower().Contains("subs-in"))
            {
                stat = new CPlayerIndividualStat()
                {
                    StatisticType = (int)ESoccerPlayerStatistics.Substitutions, Value = escapedTest
                };
            }
            else if (itemName.ToLower().Contains("goals"))
            {
                stat = new CPlayerIndividualStat()
                {
                    StatisticType = (int)ESoccerPlayerStatistics.Goals, Value = escapedTest
                };
            }
            else if (itemName.ToLower().Contains("assists"))
            {
                if (!string.IsNullOrWhiteSpace(escapedTest) && escapedTest.Trim() != "0")
                {
                    stat = new CPlayerIndividualStat()
                    {
                        StatisticType = (int)ESoccerPlayerStatistics.Assists, Value = escapedTest
                    };
                }
            }
            else if (itemName.ToLower().Contains("yellow") && !itemName.ToLower().Contains("2nd"))
            {
                stat = new CPlayerIndividualStat()
                {
                    StatisticType = (int)ESoccerPlayerStatistics.YellowCards, Value = escapedTest
                };
            }
            else if (itemName.ToLower().Contains("yellow") && itemName.ToLower().Contains("2nd"))
            {
                stat = new CPlayerIndividualStat()
                {
                    StatisticType = (int)ESoccerPlayerStatistics.RedCards, Value = escapedTest
                };
            }
            else if (itemName.ToLower().Contains("red-cards") || itemName.ToLower().Contains("red_cards"))
            {
                stat = new CPlayerIndividualStat()
                {
                    StatisticType = (int)ESoccerPlayerStatistics.RedCards, Value = escapedTest
                };
            }

            return(stat);
        }