示例#1
0
        private void ValidateWeight(List <string> playerParts, PlayerValidationResult res)
        {
            string pos = Get(playerParts, "Position");

            string[] possibilities = null;
            switch (pos)
            {
            case "SS":
            case "FS":
            case "QB":
            case "RB":
            case "WR":
                possibilities = GetRange(170, 260);
                break;

            case "CB":
            case "P":
            case "K":
                possibilities = GetRange(150, 240);
                break;

            case "ILB":
            case "OLB":
            case "FB":
                possibilities = GetRange(210, 280);
                break;

            case "TE":
                possibilities = GetRange(220, 280);
                break;

            case "G":
            case "T":
                possibilities = GetRange(260, 390);
                break;

            case "C":
                possibilities = GetRange(240, 380);
                break;

            case "DE":
                possibilities = GetRange(220, 320);
                break;

            case "DT":
                possibilities = GetRange(260, 390);
                break;
            }
            if (!ValidateAttribute("Weight", possibilities, playerParts))
            {
                res.Invalid = true;
            }
        }
示例#2
0
        /// <summary>
        /// Will add warnings if there is an issue with the player.
        /// </summary>
        /// <param name="line">The player line</param>
        public string ValidatePlayer(string line)
        {
            List <string>          playerParts = InputParser.ParsePlayerLine(line);
            PlayerValidationResult res         = new PlayerValidationResult(Get(playerParts, "Position"), Get(playerParts, "fname"), Get(playerParts, "lname"));

            ValidateBodyType(playerParts, res);
            ValidateWeight(playerParts, res);
            if (res.Invalid)
            {
                res.Height   = Get(playerParts, "Height");
                res.BodyType = Get(playerParts, "BodyType");
                res.Weight   = Get(playerParts, "Weight");
                return(String.Format("{0},{1},{2},{3},{4},{5}\n", res.Position, res.FirstName, res.LastName, res.BodyType, res.Height, res.Weight));
            }
            return("");
        }
示例#3
0
        // Skinny = 0, Normal, Large, ExtraLarge
        private void ValidateBodyType(List <string> playerParts, PlayerValidationResult res)
        {
            string pos = Get(playerParts, "Position");

            string[] possibilities = null;
            switch (pos)
            {
            case "CB":
            case "SS":
            case "FS":
            case "QB":
            case "RB":
            case "P":
            case "K":
            case "WR":
                possibilities = new string[] { "Skinny", "Normal", /*"Large", "ExtraLarge"*/ };
                break;

            case "ILB":
            case "OLB":
            case "FB":
            case "TE":
                possibilities = new string[] { /*"Skinny",*/ "Normal", "Large", /*"ExtraLarge"*/ };
                break;

            case "G":
            case "T":
            case "C":
                possibilities = new string[] { /*"Skinny",*/ "Normal", "Large", "ExtraLarge" };
                break;

            case "DE":
                possibilities = new string[] { /*"Skinny",*/ "Normal", "Large", "ExtraLarge" };
                break;

            case "DT":
                possibilities = new string[] { /*"Skinny",*/ "Normal", "Large", "ExtraLarge" };
                break;
            }
            if (!ValidateAttribute("BodyType", possibilities, playerParts))
            {
                res.Invalid = true;
            }
        }