public static Map.MapInfo loadMapInfo(string mapname) { reloadDir(); var mapdir = Path.Combine(dir, mapname); if (Directory.Exists(mapdir)) { var datpath = Path.Combine(mapdir, filename_info); if (File.Exists(datpath)) { var formatter = new BinaryFormatter(); var stream = new FileStream(datpath, FileMode.Open, FileAccess.Read, FileShare.Read); Map.MapInfo info = null; try { info = (Map.MapInfo)formatter.Deserialize(stream); } catch { } stream.Close(); return(info); } } return(null); }
public static Map loadMap(string mapname) { reloadDir(); var mapdir = Path.Combine(dir, mapname); if (Directory.Exists(mapdir)) { var datpath = Path.Combine(mapdir, filename_map); if (File.Exists(datpath)) { var formatter = new BinaryFormatter(); var stream = new FileStream(Path.Combine(mapdir, filename_info), FileMode.Open, FileAccess.Read, FileShare.Read); Map.MapInfo info = null; try { info = (Map.MapInfo)formatter.Deserialize(stream); } catch { } stream.Close(); stream = new FileStream(datpath, FileMode.Open, FileAccess.Read, FileShare.Read); Map map = null; try { map = (Map)formatter.Deserialize(stream); map.mapname = mapname; map.info = info; map.init(); } catch (EndOfStreamException) { // TODO マップ非対応の表示 } stream.Close(); return(map); } } return(null); }