BattleShip.FileManager.readBoard C# (CSharp) Метод

readBoard() публичный Метод

public readBoard ( string boardType, string player ) : ].int[
boardType string
player string
Результат ].int[
        public int[,] readBoard(string boardType, string player)
        {
            int[,] board = new int[10, 10];
            int i = 0, j = 0;
            string regexpLine = @"(\d)";

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(this.fullFileName);
            XmlNode node = xmlDoc.DocumentElement.SelectSingleNode(boardType + player);

            Match m = Regex.Match(node.InnerText, regexpLine);

            while (m.Success)
            {
                board[i, j] = System.Convert.ToInt16(m.Value);
                if (j < 9)
                {
                    j++;
                }
                else
                {
                    j = 0;
                    i++;
                }
                m = m.NextMatch();

            }

            return board;
        }