Exemple #1
0
        private int[,] GetMatrixFromFile(string file)
        {
            StreamReader reader = new StreamReader(file);

            int[] sizes = GetNumbersFromRow(reader);

            int[,] matrix = new int[sizes[0], sizes[1]];

            for (int i = 0; i < sizes[0]; i++)
            {
                int[] nums = GetNumbersFromRow(reader);
                for (int j = 0; j < sizes[1]; j++)
                {
                    matrix[i, j] = nums[j];
                }
            }

            WriteLog(LogStrings.MatrixWasLoaded(file));

            reader.Close();

            return(matrix);
        }