コード例 #1
0
        protected new void FetchData()
        {
            if (IsPublic)
            {
                var stats = doc.GetXmlElement("stats");

                // TODO: check if node is empty (== null)
                var mostRecentGame = stats.GetXmlElement("mostrecentgame");

                if (mostRecentGame.InnerText != string.Empty)
                {
                    MostRecentGame = new L4DMostRecentGame(mostRecentGame);
                }
                else
                {
                    mostRecentGame = null;
                }

                Favourite     = new      L4DFavourite(stats.GetXmlElement("favorites"));
                SurvivalStats = new  L4DSurvivalStats(stats.GetXmlElement("survival"));
                TeamPlayStats = new  L4DTeamPlayStats(stats.GetXmlElement("teamplay"));
                VersusStats   = new    L4DVersusStats(stats.GetXmlElement("versus"));

                var lifeTime = stats.GetXmlElement("lifetime");

                FinalesSurvived    = int.Parse(lifeTime.GetInnerText("finales"));
                GamesPlayed        = int.Parse(lifeTime.GetInnerText("gamesplayed"));
                InfectedKilled     = int.Parse(lifeTime.GetInnerText("infectedkilled"));
                KillsPerHour       = float.Parse(lifeTime.GetInnerText("killsperhour"));
                AverageKitsShared  = float.Parse(lifeTime.GetInnerText("kitsshared"));
                AverageKitsUsed    = float.Parse(lifeTime.GetInnerText("kitsused"));
                AveragePillsShared = float.Parse(lifeTime.GetInnerText("pillsshared"));
                AveragePillsUsed   = float.Parse(lifeTime.GetInnerText("pillsused"));

                TimePlayed = lifeTime.GetInnerText("timeplayed");

                FinalesSurvivedPercentage = (float)FinalesSurvived / GamesPlayed;
            }
        }
コード例 #2
0
        protected new void FetchData()
        {
            if (IsPublic)
            {
                var stats = doc.GetXmlElement("stats");

                // TODO: check if node is empty (== null)
                var mostRecentGame = stats.GetXmlElement("mostrecentgame");

                if (mostRecentGame.InnerText != string.Empty)
                    MostRecentGame = new L4DMostRecentGame(mostRecentGame);
                else
                    mostRecentGame = null;

                Favourite        = new      L4DFavourite(stats.GetXmlElement("favorites"));
                SurvivalStats    = new  L4DSurvivalStats(stats.GetXmlElement("survival"));
                TeamPlayStats    = new  L4DTeamPlayStats(stats.GetXmlElement("teamplay"));
                VersusStats      = new    L4DVersusStats(stats.GetXmlElement("versus"));

                var lifeTime = stats.GetXmlElement("lifetime");

                FinalesSurvived    =   int.Parse(lifeTime.GetInnerText("finales"));
                GamesPlayed        =   int.Parse(lifeTime.GetInnerText("gamesplayed"));
                InfectedKilled     =   int.Parse(lifeTime.GetInnerText("infectedkilled"));
                KillsPerHour       = float.Parse(lifeTime.GetInnerText("killsperhour"));
                AverageKitsShared  = float.Parse(lifeTime.GetInnerText("kitsshared"));
                AverageKitsUsed    = float.Parse(lifeTime.GetInnerText("kitsused"));
                AveragePillsShared = float.Parse(lifeTime.GetInnerText("pillsshared"));
                AveragePillsUsed   = float.Parse(lifeTime.GetInnerText("pillsused"));

                TimePlayed = lifeTime.GetInnerText("timeplayed");

                FinalesSurvivedPercentage = (float)FinalesSurvived/GamesPlayed;
            }
        }