예제 #1
0
        public List <Wall> GetWallData()
        {
            int           counter = 0;
            string        line;
            List <string> WallsData = new List <string>();
            List <Wall>   Walls     = new List <Wall>();

            System.IO.StreamReader file =
                new System.IO.StreamReader("Walls.txt");
            while ((line = file.ReadLine()) != null)
            {
                System.Console.WriteLine(line);
                WallsData.Add(line);
                counter++;
            }
            foreach (string WallData in WallsData)
            {
                string[] xy      = WallData.Split(",".ToCharArray());
                Wall     NewWall = new Wall(Convert.ToInt32(xy[1]) - 1, Convert.ToInt32(xy[0]) - 1);
                Walls.Add(NewWall);
            }
            return(Walls);
        }