public void SaveLevel(string name) { LastSaveName = name; using (FileStream fs = new FileStream(ArxPaths.GetDlfPath(name), FileMode.Create, FileAccess.Write)) using (MemoryStream ms = new MemoryStream()) { dlf.WriteTo(ms); using (var packedStream = DLF_IO.EnsurePacked(ms)) { packedStream.CopyTo(fs); } } using (FileStream fs = new FileStream(ArxPaths.GetLlfPath(name), FileMode.Create, FileAccess.Write)) using (MemoryStream ms = new MemoryStream()) { llf.WriteTo(ms); using (var packedStream = LLF_IO.EnsurePacked(ms)) { packedStream.CopyTo(fs); } } using (FileStream fs = new FileStream(ArxPaths.GetFtsPath(name), FileMode.Create, FileAccess.Write)) using (MemoryStream ms = new MemoryStream()) { fts.WriteTo(ms); using (var packedStream = FTS_IO.EnsurePacked(ms)) { packedStream.CopyTo(fs); } } }
public void SaveLevel(string name) { LastSaveName = name; using (MemoryStream ms = new MemoryStream()) { dlf.WriteTo(ms); ms.Position = 0; using (var packedStream = DLF_IO.EnsurePacked(ms)) using (FileStream fs = new FileStream(ArxPaths.GetDlfPath(name), FileMode.Create, FileAccess.Write)) { packedStream.CopyTo(fs); } } using (MemoryStream ms = new MemoryStream()) { llf.WriteTo(ms); ms.Position = 0; using (var packedStream = LLF_IO.EnsurePacked(ms)) using (FileStream fs = new FileStream(ArxPaths.GetLlfPath(name), FileMode.Create, FileAccess.Write)) { packedStream.CopyTo(fs); } } using (MemoryStream ms = new MemoryStream()) { fts.header.uncompressedsize = fts.CalculateWrittenSize(true); fts.sceneHeader.nb_textures = fts.textureContainers.Length; fts.sceneHeader.nb_polys = fts.CalculatePolyCount(); fts.sceneHeader.nb_anchors = fts.anchors.Length; fts.sceneHeader.nb_portals = fts.portals.Length; fts.sceneHeader.nb_rooms = fts.rooms.Length - 1; for (int i = 0; i < fts.rooms.Length; ++i) { fts.rooms[i].data.nb_polys = fts.rooms[i].polygons.Length; fts.rooms[i].data.nb_portals = fts.rooms[i].portals.Length; } fts.WriteTo(ms); ms.Position = 0; using (var packedStream = FTS_IO.EnsurePacked(ms)) using (FileStream fs = new FileStream(ArxPaths.GetFtsPath(name), FileMode.Create, FileAccess.Write)) { packedStream.CopyTo(fs); } } }