Fix compile errors

This commit is contained in:
UnknownShadow200 2016-11-24 09:22:36 +11:00
parent f1c14cf613
commit b52848530d
8 changed files with 24 additions and 12 deletions

View File

@ -245,9 +245,11 @@ namespace MCGalaxy.Commands {
public void FromOfflineLevel(string name) {
this.Name = name;
LvlImporter.LoadDimensions(LevelInfo.LevelPath(name),
out Width, out Height, out Length);
string path = LevelInfo.FindPropertiesFile(name);
string path = LevelInfo.LevelPath(name);
Vec3U16 dims = IMapImporter.Formats[0].ReadDimensions(path);
Width = dims.X; Height = dims.Y; Length = dims.Z;
path = LevelInfo.FindPropertiesFile(name);
if (path != null)
PropertiesFile.Read(path, ParseProperty, '=');
if (Authors == null) Authors = "";

View File

@ -44,7 +44,6 @@ namespace MCGalaxy.DB {
void DumpRow(IDataReader reader) {
if (stream == null) {
stream = File.Create("blockdefs/" + mapName + ".dump");
Vec3U16 dims = L
}
string user = reader.GetString(0);

View File

@ -23,6 +23,10 @@ namespace MCGalaxy.Levels.IO {
public sealed class CwImporter : IMapImporter {
public override string Extension { get { return ".cw"; } }
public override Vec3U16 ReadDimensions(Stream src) {
throw new NotSupportedException();
}
public override Level Read(Stream src, string name, bool metadata) {
NbtFile file = new NbtFile();

View File

@ -40,6 +40,10 @@ namespace MCGalaxy.Levels.IO {
public sealed class DatImporter : IMapImporter {
public override string Extension { get { return ".dat"; } }
public override Vec3U16 ReadDimensions(Stream src) {
throw new NotSupportedException();
}
public override Level Read(Stream src, string name, bool metadata) {
byte[] temp = new byte[8];

View File

@ -61,7 +61,6 @@ namespace MCGalaxy.Levels.IO {
}
static Vec3U16 ReadDimensions(BinaryReader reader) {
BinaryReader reader = new BinaryReader(src);
if (reader.ReadInt32() != 0x0FC2AF40 || reader.ReadByte() != 13) {
throw new InvalidDataException( "Unexpected constant in .fcm file" );
}

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Levels.IO {
public override Vec3U16 ReadDimensions(Stream src) {
using (Stream gs = new GZipStream(src, CompressionMode.Decompress, true)) {
byte[] header = new byte[16];
return ReadHeader(gs, header);
return ReadHeader(header, gs);
}
}

View File

@ -30,15 +30,20 @@ namespace MCGalaxy.Levels.IO {
/// <summary> Reads the data for a level from a file containing data encoded in this format. </summary>
/// <param name="metadata"> Whether metadata should be loaded. </param>
public Level Read(string path, string name, bool metadata) {
using (FileStream fs = File.OpenRead(path)) {
using (FileStream fs = File.OpenRead(path))
return Read(fs, name, metadata);
}
}
/// <summary> Reads the data for a level from a file containing data encoded in this format. </summary>
/// <param name="metadata"> Whether metadata should be loaded. </param>
public abstract Level Read(Stream src, string name, bool metadata);
/// <summary> Reads the dimensions for a level from a file containing data encoded in this format. </summary>
public Vec3U16 ReadDimensions(string path) {
using (FileStream fs = File.OpenRead(path))
return ReadDimensions(fs);
}
/// <summary> Reads the dimensions for a level from a file containing data encoded in this format. </summary>
public abstract Vec3U16 ReadDimensions(Stream src);
@ -59,7 +64,7 @@ namespace MCGalaxy.Levels.IO {
}
}
/// <summary> Writes/Saves block data (and potentially metadata) encoded in a particular format. </summary>
/// <summary> Writes/Saves block data (and potentially metadata) encoded in a particular format. </summary>
public abstract class IMapExporter {
/// <summary> The file extension of this format. </summary>

View File

@ -49,9 +49,8 @@ namespace MCGalaxy.Undo {
continue;
}
ushort width, height, length;
LvlImporter.LoadDimensions(LevelInfo.LevelPath(uP.mapName), out width, out height, out length);
node.Width = width; node.Height = height; node.Length = length;
Vec3U16 dims = IMapImporter.Formats[0].ReadDimensions(LevelInfo.LevelPath(uP.mapName));
node.Width = dims.X; node.Height = dims.Y; node.Length = dims.Z;
WriteChunkEntries(w, last.Entries, entriesPos);
node.MapName = uP.mapName;
last = WriteEmptyChunk(w, node, time, ref entriesPos);