public static int SaveMatrix Stream fileStream int int string file Rea

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
public static int[,] SaveMatrix(Stream fileStream, int N, int M)
{
string file = ReadFile(fileStream);
string[] fileArr;
file = file.Remove(0, 5);
fileArr = file.Split(new Char[] {'\n', '\r'}, StringSplitOptions.RemoveEmptyEntries);
int len = N * M;
int[,] matrix = new int[len, len];
for (int i = 0; i < len; i++)
for (int j = 0; j < len; j++)
matrix[i, j] = (int)Char.GetNumericValue(fileArr[i][j]);
return matrix;
}