public abstract void ForEachKnownChunk(int Dimension, ChunkIteratorDelegate cmd);
public abstract void ForEachChunk(ChunkIteratorDelegate cmd);
public override void ForEachChunk(ChunkIteratorDelegate cmd) { string[] f = Directory.GetFiles(mFolder, "c*.*.dat", SearchOption.AllDirectories); int Complete = 0; foreach (string file in f) { if (ForEachProgress != null) ForEachProgress(f.Length, Complete++); //if(_DEBUG) Console.WriteLine(Path.GetExtension(file)); if (Path.GetExtension(file) == "dat") continue; if (file.EndsWith(".genlock")) continue; NbtFile nf = new NbtFile(file); try { nf.LoadFile(); NbtCompound Level = (NbtCompound)nf.RootTag["Level"]; long x = (Level["xPos"] as NbtInt).Value; long y = (Level["zPos"] as NbtInt).Value; nf.Dispose(); cmd(this, x, y); } catch (Exception e) { if (CorruptChunk != null) { Vector2i pos = GetChunkCoordsFromFile(file); if(pos!=null) CorruptChunk(pos.X, pos.Y, "[" + Complete.ToString() + "]" + e.ToString(), file); } // continue; } } // This MUST be done. ForEachProgress = null; }
public override void ForEachKnownChunk(int dimension, ChunkIteratorDelegate cmd) { List<Vector2i> knownChunks = new List<Vector2i>(Cache.GetKnownChunks(dimension)); int c=0; foreach (Vector2i pos in knownChunks) { c++; cmd(this, pos.X, pos.Y); if (ForEachProgress != null) ForEachProgress(knownChunks.Count, c); } }
public abstract void ForEachKnownChunk(int Dimension, ChunkIteratorDelegate cmd);
public abstract void ForEachChunk(ChunkIteratorDelegate cmd);