aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-29 19:21:43 +0000
committerJustin Clarke Casey2008-06-29 19:21:43 +0000
commit7d5a21ddbf738c51197a98bef11a52ceb85fe907 (patch)
treeb45ce6542acb9b6d17824983fb8d135560e8d3f8 /OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs
parent* Fix for http://opensimulator.org/mantis/view.php?id=1512 (diff)
downloadopensim-SC_OLD-7d5a21ddbf738c51197a98bef11a52ceb85fe907.zip
opensim-SC_OLD-7d5a21ddbf738c51197a98bef11a52ceb85fe907.tar.gz
opensim-SC_OLD-7d5a21ddbf738c51197a98bef11a52ceb85fe907.tar.bz2
opensim-SC_OLD-7d5a21ddbf738c51197a98bef11a52ceb85fe907.tar.xz
* 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
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs21
1 files changed, 17 insertions, 4 deletions
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
43 43
44 public ITerrainChannel LoadFile(string filename) 44 public ITerrainChannel LoadFile(string filename)
45 { 45 {
46 TerrainChannel retval = new TerrainChannel();
47
48 FileInfo file = new FileInfo(filename); 46 FileInfo file = new FileInfo(filename);
49 FileStream s = file.Open(FileMode.Open, FileAccess.Read); 47 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
48 ITerrainChannel retval = LoadStream(s);
49
50 s.Close();
51
52 return retval;
53 }
54
55 public ITerrainChannel LoadStream(Stream s)
56 {
57 TerrainChannel retval = new TerrainChannel();
58
50 BinaryReader bs = new BinaryReader(s); 59 BinaryReader bs = new BinaryReader(s);
51 60
52 bool eof = false; 61 bool eof = false;
@@ -98,8 +107,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
98 } 107 }
99 108
100 bs.Close(); 109 bs.Close();
101 s.Close(); 110
102
103 return retval; 111 return retval;
104 } 112 }
105 113
@@ -107,6 +115,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
107 { 115 {
108 throw new NotImplementedException(); 116 throw new NotImplementedException();
109 } 117 }
118
119 public void SaveStream(Stream stream, ITerrainChannel map)
120 {
121 throw new NotImplementedException();
122 }
110 123
111 public string FileExtension 124 public string FileExtension
112 { 125 {