private static Room[] LoadFromFile() { RoomBuilder rb = new RoomBuilder(); StreamReader s = new StreamReader(File.Open("Maze2.txt", FileMode.Open)); while (!s.EndOfStream) { string data = s.ReadLine(); if (data.Length > 0) { switch (data[0]) { case '|': rb.AppendWallsAndDoors(data.Substring(1)); break; case ':': rb.BeginNewRoom(data.Substring(1)); break; default: break; } } } s.Dispose(); return(rb.GetRooms()); }
private static Room[] LoadFromFile() { RoomBuilder rb = new RoomBuilder(); StreamReader s = new StreamReader(File.Open("Maze2.txt", FileMode.Open)); while (!s.EndOfStream) { string data = s.ReadLine(); if (data.Length > 0) { switch (data[0]) { case '|': rb.AppendWallsAndDoors(data.Substring(1)); break; case ':': rb.BeginNewRoom(data.Substring(1)); break; default: break; } } } s.Dispose(); return rb.GetRooms(); }