public static TmxMap LoadTmxMap(this TmxMap map, string filepath) { if (Path.IsPathRooted(filepath)) { using (var stream = File.OpenRead(filepath)) { var xDoc = XDocument.Load(stream); map.TmxDirectory = Path.GetDirectoryName(filepath); map.LoadTmxMap(xDoc); return(map); } } else { using (var stream = TitleContainer.OpenStream(filepath)) { var xDoc = XDocument.Load(stream); map.TmxDirectory = Path.GetDirectoryName(filepath); map.LoadTmxMap(xDoc); return(map); } } }
public static TmxMap LoadTmxMap(this TmxMap map, string filepath, bool headless = false) { using (var stream = TitleContainer.OpenStream(filepath)) { var xDoc = XDocument.Load(stream); map.TmxDirectory = Path.GetDirectoryName(filepath); map.SetHeadless(headless); map.LoadTmxMap(xDoc); return(map); } }