private static void SetOutArray(MatrixCreate matrix) { var rows = matrix.Rows.ToList(); var outArray = Enumerable.Range(0, 6).Select(x => Enumerable.Range(0, 6) .Select(y => y).ToList()).ToList(); for (var i = 0; i < rows.Count; ++i) { outArray[0][i] = rows[i]; } for (var i = 0; i < rows.Count; ++i) { if (rows[i] == 0) { continue; } outArray[i][0] = rows[i]; for (var j = 1; j < rows.Count; ++j) { outArray[i][j] = matrix.Normal != matrix.TMatrix ? (rows[j - 1] + rows[i] % 12) % 12 : (rows[j - 1] + (12 - rows[i] % 12)) % 12; } } matrix.OutArray = outArray; }
public MatrixCreate GetMatrix(bool normal, bool tMatrix, string rowString) { var matrix = new MatrixCreate { Normal = normal, TMatrix = tMatrix, Rows = new List <int>(GetRows(rowString)) }; SetOutArray(matrix); return(matrix); }