public static Map Load(string Path) { Map Map = null; int x = 0, y = 0; using (StreamReader Reader = new StreamReader(Path)) { string Line = null; while (!string.IsNullOrEmpty(Line = Reader.ReadLine())) { string[] Elements = (Line.Contains(":") ? Line.Split(':')[1].Split(',') : Line.Split(',')); if (Line.StartsWith("size")) Map = new Map(Convert.ToInt32(Elements[0]), Convert.ToInt32(Elements[1])); else { byte Fore = Convert.ToByte(Elements[0]), Back = Convert.ToByte(Elements[1]); if (Fore > 0) Map.PlaceFore(Fore, x, y, Convert.ToByte(Elements[2])); if (Back > 0) Map.PlaceBack(Back, x, y); if (x == (Map.Tiles.GetLength(0) - 1)) { x = 0; y++; } else x++; } } Reader.Close(); } return Map; }