コード例 #1
0
        private static DvoikaImeRezultat[] UpgradeTopScorePairs(string[] topScores)
        {
            int startIndex = 0;

            while (topScores[startIndex] == null)
            {
                startIndex++;
            }

            int arraySize = Math.Min(TopScoresAmount - startIndex + 1, TopScoresAmount);

            DvoikaImeRezultat[] topScoresPairs = new DvoikaImeRezultat[arraySize];
            for (int topScoresPairsIndex = 0; topScoresPairsIndex < arraySize; topScoresPairsIndex++)
            {
                int    topScoresIndex = topScoresPairsIndex + startIndex;
                string name           = Regex.Replace(topScores[topScoresIndex], TopScoresPersonPattern, @"$1");
                string score          = Regex.Replace(topScores[topScoresIndex], TopScoresPersonPattern, @"$2");
                int    scoreInt       = int.Parse(score);
                topScoresPairs[topScoresPairsIndex] = new DvoikaImeRezultat(name, scoreInt);
            }

            return(topScoresPairs);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: niki-funky/Telerik_Academy
        private static DvoikaImeRezultat[] UpgradeTopScorePairs(string[] topScores)
        {
            int startIndex = 0;
            while (topScores[startIndex] == null)
            {
                startIndex++;
            }

            int arraySize = Math.Min(TopScoresAmount - startIndex + 1, TopScoresAmount);
            DvoikaImeRezultat[] topScoresPairs = new DvoikaImeRezultat[arraySize];
            for (int topScoresPairsIndex = 0; topScoresPairsIndex < arraySize; topScoresPairsIndex++)
            {
                int topScoresIndex = topScoresPairsIndex + startIndex;
                string name = Regex.Replace(topScores[topScoresIndex], TopScoresPersonPattern, @"$1");
                string score = Regex.Replace(topScores[topScoresIndex], TopScoresPersonPattern, @"$2");
                int scoreInt = int.Parse(score);
                topScoresPairs[topScoresPairsIndex] = new DvoikaImeRezultat(name, scoreInt);
            }

            return topScoresPairs;
        }