Пример #1
0
        public void save(string filePath, ref Cell[,] area)
        {
            var rank = area.Rank;

            if (rank != 2)
                throw new Exception("Not two dimensional");

            int height = area.GetUpperBound(1);
            int width  = area.GetLowerBound(2);

            try {
                using (StreamWriter sw = new StreamWriter(filePath))
                {
                    sw.WriteLine("%d", width);
                    sw.WriteLine("%d", height);

                    for (var i = 0; i < height; ++height)
                    {
                        for (var j = 0; j < width; ++width)
                        {
                            sw.WriteLine("%d", area[i, j].status);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }