From 7d5a21ddbf738c51197a98bef11a52ceb85fe907 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sun, 29 Jun 2008 19:21:43 +0000 Subject: * Allow terrains to be loaded and saved from streams as well as directly to and from files * Should be making use of this in the next revisions --- .../Modules/World/Terrain/FileLoaders/Terragen.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs') diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs index fe36cf7..5dc2aa5 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs @@ -43,10 +43,19 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders public ITerrainChannel LoadFile(string filename) { - TerrainChannel retval = new TerrainChannel(); - FileInfo file = new FileInfo(filename); FileStream s = file.Open(FileMode.Open, FileAccess.Read); + ITerrainChannel retval = LoadStream(s); + + s.Close(); + + return retval; + } + + public ITerrainChannel LoadStream(Stream s) + { + TerrainChannel retval = new TerrainChannel(); + BinaryReader bs = new BinaryReader(s); bool eof = false; @@ -98,8 +107,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders } bs.Close(); - s.Close(); - + return retval; } @@ -107,6 +115,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders { throw new NotImplementedException(); } + + public void SaveStream(Stream stream, ITerrainChannel map) + { + throw new NotImplementedException(); + } public string FileExtension { -- cgit v1.1