public void ClearArea(LifeSelection selection) { for (int i = selection.sx; i <= selection.fx; i++) { for (int j = selection.sy; j < selection.fy; j++) { field[i, j] = false; colors[i, j] = 0; } } DrawField(); }
public void SaveStructure(FileInfo target, LifeSelection selection) { if (selection.sx < selection.fx || selection.sy < selection.fy) { StreamWriter sw = target.CreateText(); sw.WriteLine(target.Name); sw.WriteLine(selection.fx - selection.sx); sw.WriteLine(selection.fy - selection.sy); for (int i = selection.sx; i < selection.fx; i++) { for (int j = selection.sy; j < selection.fy; j++) { if (field[i, j]) { sw.WriteLine((i - selection.sx) + " " + (j - selection.sy) + " " + colors[i, j]); } } } sw.Close(); } }