public List<Pod> createNewGroup()
{
try
{
groupPods = new List<Pod>();
int row, col, oldRow, oldCol;
groupPods.Clear();
row = podRow[0];
col = podCol[0];
oldRow = row;
oldCol = col;
groupPods.Add(matrix[podRow[0], podCol[0]]);
podRow.RemoveAt(0);
podCol.RemoveAt(0);
for (int i = 0; i < podRow.Count; i++)
{
if (podRow == row)
{
if (podCol == podCol[0])
{
CrestronConsole.PrintLine("Found {0}, {1}", podRow[0], podCol[0]);
groupPods.Add(matrix[podRow, podCol]);
row = podRow;
podRow.RemoveAt(i);
podCol.RemoveAt(i);
i = 0;
}
else
{
row = oldRow;
}
}
if (podCol == col)
{
if (podRow == podRow[0])
{
groupPods.Add(matrix[podRow, podCol]);
col = podCol;
podRow.RemoveAt(i);
podCol.RemoveAt(i);
i = 0;
}
else
{
col = oldCol;
}
}
}
}
catch (Exception e)
{
CrestronConsole.PrintLine("Error in matrix search {0}", e.Message);
}
return groupPods;
}