GR.Gambling.Blackjack.Shoe.Parse C# (CSharp) Méthode

Parse() public static méthode

public static Parse ( string s ) : Shoe
s string
Résultat Shoe
        public static Shoe Parse(string s)
        {
            string[] parts = s.Split(new char[] { ' ' });
            if (parts.Length < 10)
            {
                throw new ArgumentException(string.Format("Error while parsing a shoe, too few counts ({0})", parts.Length));
            }

            Shoe shoe = new Shoe();

            if (parts.Length == 11) shoe.decks = int.Parse(parts[0]);
            else shoe.decks = 8;

            for (int i = 0; i < 10; i++)
            {
                int count = int.Parse(parts[(parts.Length - 10) + i]);
                shoe.counts[i] = count;
                shoe.total += count;
            }

            return shoe;
        }