public static Board GetValidBoard(this IValid valid, string rowIndex, string columnIndex) { byte numberOfRows = valid.GetValidByteArg(rowIndex); byte NumverOfColumns = valid.GetValidByteArg(columnIndex); if (numberOfRows <= 0 || NumverOfColumns <= 0) { throw new ArgumentOutOfRangeException(Settings.INSTRUCTION); } if (numberOfRows > 30 || NumverOfColumns > 100) { throw new ArgumentOutOfRangeException(Settings.BIG_NUM); } return(new Board(numberOfRows, NumverOfColumns)); }
public static byte TryPowerParse(this IValid valid, string str) { byte power = valid. GetValidByteArg(str); if (power % 2 == 1) { throw new Exception(Settings.LENGTH_ERROR); } if (power > 6) { throw new Exception(Settings.VALUE_ERROR); } return(power); }