diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs index 85afaf8..d8d0648 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs | |||
@@ -71,10 +71,24 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders | |||
71 | 71 | ||
72 | public ITerrainChannel LoadFile(string filename) | 72 | public ITerrainChannel LoadFile(string filename) |
73 | { | 73 | { |
74 | TerrainChannel retval = new TerrainChannel(); | ||
75 | |||
76 | FileInfo file = new FileInfo(filename); | 74 | FileInfo file = new FileInfo(filename); |
77 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); | 75 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); |
76 | ITerrainChannel retval = LoadStream(s); | ||
77 | |||
78 | s.Close(); | ||
79 | |||
80 | return retval; | ||
81 | } | ||
82 | |||
83 | public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) | ||
84 | { | ||
85 | throw new NotImplementedException(); | ||
86 | } | ||
87 | |||
88 | public ITerrainChannel LoadStream(Stream s) | ||
89 | { | ||
90 | TerrainChannel retval = new TerrainChannel(); | ||
91 | |||
78 | BinaryReader bs = new BinaryReader(s); | 92 | BinaryReader bs = new BinaryReader(s); |
79 | int y; | 93 | int y; |
80 | for (y = 0; y < retval.Height; y++) | 94 | for (y = 0; y < retval.Height; y++) |
@@ -87,21 +101,22 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders | |||
87 | } | 101 | } |
88 | } | 102 | } |
89 | 103 | ||
90 | bs.Close(); | 104 | bs.Close(); |
91 | s.Close(); | 105 | |
92 | |||
93 | return retval; | 106 | return retval; |
94 | } | 107 | } |
95 | 108 | ||
96 | public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) | ||
97 | { | ||
98 | throw new NotImplementedException(); | ||
99 | } | ||
100 | |||
101 | public void SaveFile(string filename, ITerrainChannel map) | 109 | public void SaveFile(string filename, ITerrainChannel map) |
102 | { | 110 | { |
103 | FileInfo file = new FileInfo(filename); | 111 | FileInfo file = new FileInfo(filename); |
104 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); | 112 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); |
113 | SaveStream(s, map); | ||
114 | |||
115 | s.Close(); | ||
116 | } | ||
117 | |||
118 | public void SaveStream(Stream s, ITerrainChannel map) | ||
119 | { | ||
105 | BinaryWriter binStream = new BinaryWriter(s); | 120 | BinaryWriter binStream = new BinaryWriter(s); |
106 | 121 | ||
107 | // Output the calculated raw | 122 | // Output the calculated raw |
@@ -150,11 +165,9 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders | |||
150 | } | 165 | } |
151 | } | 166 | } |
152 | 167 | ||
153 | binStream.Close(); | 168 | binStream.Close(); |
154 | s.Close(); | ||
155 | } | 169 | } |
156 | 170 | ||
157 | |||
158 | public string FileExtension | 171 | public string FileExtension |
159 | { | 172 | { |
160 | get { return ".raw"; } | 173 | get { return ".raw"; } |