Beispiel #1
0
        public static MatchScore Str2ScoreAustralian(string str)
        {
            var tokens = new char[] { '/', '(', '.' };
            var score  = new MatchScore();
            var o      = new OverValue();

            if (!str.Contains("/"))
            {
                str = "10/" + str;
            }
            //7/156 (20 overs)
            var scoreParts = str.Replace(")", "").Split(tokens);

            if (scoreParts.Length > 0)
            {
                score.Wickets = Int32.Parse(scoreParts[0]);
            }
            if (scoreParts.Length > 1)
            {
                score.Runs = Int32.Parse(scoreParts[1]);
            }

            if (scoreParts.Length > 2)
            {
                o.Overs = Int32.Parse(scoreParts[2].Replace("overs", "").Trim());
            }
            if (scoreParts.Length > 3)
            {
                o.Balls = Int32.Parse(scoreParts[3].Replace("overs", "").Trim());
            }
            score.Overs = o;
            return(score);
        }
Beispiel #2
0
        public static MatchScore Str2ScoreEnglish(string str)
        {
            var tokens = new char[] { '/', '(', '.' };
            var score  = new MatchScore();
            var o      = new OverValue();
            //176/3(18.4)
            var scoreParts = str.Replace(")", "").Split(tokens);

            if (scoreParts.Length > 0)
            {
                score.Runs = Int32.Parse(scoreParts[0]);
            }
            if (scoreParts.Length > 1)
            {
                score.Wickets = Int32.Parse(scoreParts[1]);
            }
            else
            {
                score.Wickets = 10;
            }

            if (scoreParts.Length > 2)
            {
                o.Overs = Int32.Parse(scoreParts[2]);
            }
            if (scoreParts.Length > 3)
            {
                o.Balls = Int32.Parse(scoreParts[3]);
            }
            score.Overs = o;
            return(score);
        }
Beispiel #3
0
        //public List<Inning> Innings;

        public Match()
        {
            HomeScore = new MatchScore();
            AwayScore = new MatchScore();
            Result    = new MatchResult();
        }